mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 06:07:57 +01:00
Finish collaboration update ...
This commit is contained in:
parent
aeb0ef0668
commit
249080cc20
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.wisemapping.exceptions;
|
||||
|
||||
public class NoMapFoundException extends WiseMappingException
|
||||
{
|
||||
public NoMapFoundException(final long mapId) {
|
||||
super("Could not find a mindmap with id '" + mapId + "'");
|
||||
}
|
||||
}
|
@ -22,10 +22,11 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class Collaboration {
|
||||
|
||||
private int id;
|
||||
private long id;
|
||||
private CollaborationRole role;
|
||||
private MindMap mindMap;
|
||||
private Collaborator collaborator;
|
||||
private CollaborationProperties collaborationProperties;
|
||||
|
||||
public Collaboration() {
|
||||
}
|
||||
@ -40,11 +41,11 @@ public class Collaboration {
|
||||
collaborator.addMindmapUser(this);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@ -92,4 +93,12 @@ public class Collaboration {
|
||||
public void setCollaborator(@NotNull Collaborator collaborator) {
|
||||
this.collaborator = collaborator;
|
||||
}
|
||||
|
||||
public CollaborationProperties getCollaborationProperties() {
|
||||
return collaborationProperties;
|
||||
}
|
||||
|
||||
public void setCollaborationProperties(@NotNull CollaborationProperties collaborationProperties) {
|
||||
this.collaborationProperties = collaborationProperties;
|
||||
}
|
||||
}
|
||||
|
@ -23,14 +23,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class CollaborationProperties {
|
||||
private long id;
|
||||
private boolean starred;
|
||||
private Collaborator collaborator;
|
||||
private MindMap mindmap;
|
||||
|
||||
|
||||
public CollaborationProperties(@NotNull Collaborator collaborator, @NotNull MindMap mindmap) {
|
||||
this.collaborator = collaborator;
|
||||
this.mindmap = mindmap;
|
||||
}
|
||||
|
||||
public CollaborationProperties(){
|
||||
|
||||
@ -43,13 +35,6 @@ public class CollaborationProperties {
|
||||
public void setStarred(boolean starred) {
|
||||
this.starred = starred;
|
||||
}
|
||||
public Collaborator getCollaborator() {
|
||||
return collaborator;
|
||||
}
|
||||
|
||||
public void setCollaborator(Collaborator collaborator) {
|
||||
this.collaborator = collaborator;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
@ -58,12 +43,4 @@ public class CollaborationProperties {
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public MindMap getMindmap() {
|
||||
return mindmap;
|
||||
}
|
||||
|
||||
public void setMindmap(@NotNull MindMap mindmap) {
|
||||
this.mindmap = mindmap;
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
package com.wisemapping.model;
|
||||
|
||||
import com.wisemapping.exceptions.WiseMappingException;
|
||||
import com.wisemapping.util.ZipUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@ -43,7 +44,6 @@ public class MindMap {
|
||||
private String lastModifierUser;
|
||||
|
||||
private Set<Collaboration> collaborations = new HashSet<Collaboration>();
|
||||
private Set<CollaborationProperties> collaborationProperties = new HashSet<CollaborationProperties>();
|
||||
|
||||
private User owner;
|
||||
private String properties;
|
||||
@ -125,7 +125,12 @@ public class MindMap {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Collaboration findCollaborationByEmail(@NotNull String email) {
|
||||
public Collaboration findCollaboration(@NotNull Collaborator collaborator) {
|
||||
return this.findCollaboration(collaborator.getEmail());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Collaboration findCollaboration(@NotNull String email) {
|
||||
Collaboration result = null;
|
||||
for (Collaboration collaboration : collaborations) {
|
||||
if (collaboration.getCollaborator().getEmail().equals(email)) {
|
||||
@ -235,38 +240,25 @@ public class MindMap {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public Set<CollaborationProperties> getCollaborationProperties() {
|
||||
return collaborationProperties;
|
||||
}
|
||||
|
||||
public void setCollaborationProperties(@NotNull Set<CollaborationProperties> collaborationProperties) {
|
||||
this.collaborationProperties = collaborationProperties;
|
||||
}
|
||||
|
||||
private CollaborationProperties findUserProperty(@NotNull Collaborator collaborator) {
|
||||
final Set<CollaborationProperties> collaborationProp = this.getCollaborationProperties();
|
||||
CollaborationProperties result = null;
|
||||
for (CollaborationProperties collaboratorProperty : collaborationProp) {
|
||||
final Collaborator propCollab = collaboratorProperty.getCollaborator();
|
||||
if (propCollab != null && propCollab.getEmail().equals(collaborator.getEmail())) {
|
||||
result = collaboratorProperty;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
final Collaboration collaboration = this.findCollaboration(collaborator);
|
||||
return collaboration != null ? collaboration.getCollaborationProperties() : null;
|
||||
}
|
||||
|
||||
public void setStarred(@NotNull Collaborator collaborator, boolean value) {
|
||||
public void setStarred(@NotNull Collaborator collaborator, boolean value) throws WiseMappingException {
|
||||
if (collaborator == null) {
|
||||
throw new IllegalStateException("Collaborator can not be null");
|
||||
}
|
||||
|
||||
CollaborationProperties collaboratorProperties = this.findUserProperty(collaborator);
|
||||
if (collaboratorProperties == null) {
|
||||
collaboratorProperties = new CollaborationProperties(collaborator, this);
|
||||
final Collaboration collaboration = this.findCollaboration(collaborator);
|
||||
if(collaboration==null){
|
||||
throw new WiseMappingException("User is not collaborator");
|
||||
}
|
||||
collaboratorProperties.setStarred(value);
|
||||
this.getCollaborationProperties().add(collaboratorProperties);
|
||||
|
||||
if (collaboration.getCollaborationProperties() == null) {
|
||||
collaboration.setCollaborationProperties(new CollaborationProperties());
|
||||
}
|
||||
collaboration.getCollaborationProperties().setStarred(value);
|
||||
}
|
||||
|
||||
public boolean isStarred(@NotNull Collaborator collaborator) {
|
||||
|
@ -1,3 +1,21 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.wisemapping.ncontroller;
|
||||
|
||||
|
||||
|
@ -27,7 +27,7 @@ import com.wisemapping.importer.ImporterFactory;
|
||||
import com.wisemapping.model.*;
|
||||
import com.wisemapping.rest.model.*;
|
||||
import com.wisemapping.security.Utils;
|
||||
import com.wisemapping.service.InvalidCollaborationException;
|
||||
import com.wisemapping.service.CollaborationException;
|
||||
import com.wisemapping.service.MindmapService;
|
||||
import com.wisemapping.validator.MapInfoValidator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -205,7 +205,7 @@ public class MindmapController extends BaseController {
|
||||
|
||||
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/collabs", consumes = {"application/json", "application/xml"}, produces = {"application/json", "text/html", "application/xml"})
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
public void updateCollabs(@PathVariable int id, @NotNull @RequestBody RestCollaborationList restCollabs) throws InvalidCollaborationException {
|
||||
public void updateCollabs(@PathVariable int id, @NotNull @RequestBody RestCollaborationList restCollabs) throws CollaborationException {
|
||||
final MindMap mindMap = mindmapService.getMindmapById(id);
|
||||
final User user = Utils.getUser();
|
||||
if (!mindMap.getOwner().equals(user)) {
|
||||
@ -215,16 +215,16 @@ public class MindmapController extends BaseController {
|
||||
// Compare one by one if some of the elements has been changed ....
|
||||
final Set<Collaboration> collabsToRemove = new HashSet<Collaboration>(mindMap.getCollaborations());
|
||||
for (RestCollaboration restCollab : restCollabs.getCollaborations()) {
|
||||
final Collaboration collaboration = mindMap.findCollaborationByEmail(restCollab.getEmail());
|
||||
final Collaboration collaboration = mindMap.findCollaboration(restCollab.getEmail());
|
||||
// Validate role format ...
|
||||
String roleStr = restCollab.getRole();
|
||||
if (roleStr == null) {
|
||||
throw new IllegalArgumentException(roleStr + " is not a valid role");
|
||||
}
|
||||
|
||||
if (CollaborationRole.valueOf(restCollab.getRole()) != CollaborationRole.OWNER) {
|
||||
|
||||
// Validate role ...
|
||||
String roleStr = restCollab.getRole();
|
||||
if (roleStr == null) {
|
||||
throw new IllegalArgumentException(roleStr + " is not a valid role");
|
||||
}
|
||||
final CollaborationRole role = CollaborationRole.valueOf(roleStr.toUpperCase());
|
||||
// Is owner ?
|
||||
final CollaborationRole role = CollaborationRole.valueOf(roleStr.toUpperCase());
|
||||
if (role != CollaborationRole.OWNER) {
|
||||
mindmapService.addCollaboration(mindMap, restCollab.getEmail(), role);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.wisemapping.rest.model;
|
||||
|
||||
|
||||
import com.wisemapping.exceptions.WiseMappingException;
|
||||
import com.wisemapping.model.Collaborator;
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.User;
|
||||
@ -161,7 +162,7 @@ public class RestMindmap {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setStarred(boolean value) {
|
||||
public void setStarred(boolean value) throws WiseMappingException {
|
||||
if (collaborator != null) {
|
||||
mindmap.setStarred(collaborator, value);
|
||||
}
|
||||
|
@ -18,10 +18,12 @@
|
||||
|
||||
package com.wisemapping.service;
|
||||
|
||||
public class InvalidCollaborationException
|
||||
extends Exception
|
||||
import com.wisemapping.exceptions.WiseMappingException;
|
||||
|
||||
public class CollaborationException
|
||||
extends WiseMappingException
|
||||
{
|
||||
public InvalidCollaborationException(String msg)
|
||||
public CollaborationException(String msg)
|
||||
{
|
||||
super(msg);
|
||||
}
|
@ -18,8 +18,10 @@
|
||||
|
||||
package com.wisemapping.service;
|
||||
|
||||
import com.wisemapping.exceptions.WiseMappingException;
|
||||
|
||||
public class InvalidActivationCodeException
|
||||
extends Exception
|
||||
extends WiseMappingException
|
||||
{
|
||||
public InvalidActivationCodeException(String msg)
|
||||
{
|
||||
|
@ -18,7 +18,9 @@
|
||||
|
||||
package com.wisemapping.service;
|
||||
|
||||
public class InvalidUserEmailException extends Exception
|
||||
import com.wisemapping.exceptions.WiseMappingException;
|
||||
|
||||
public class InvalidUserEmailException extends WiseMappingException
|
||||
{
|
||||
public InvalidUserEmailException(String msg)
|
||||
{
|
||||
|
@ -42,9 +42,9 @@ public interface MindmapService {
|
||||
public void addMindmap(MindMap map, User user) throws WiseMappingException;
|
||||
|
||||
public void addCollaboration(@NotNull MindMap mindmap, @NotNull String email, @NotNull CollaborationRole role)
|
||||
throws InvalidCollaborationException;
|
||||
throws CollaborationException;
|
||||
|
||||
public void removeCollaboration(@NotNull Collaboration collaboration);
|
||||
public void removeCollaboration(@NotNull Collaboration collaboration) throws CollaborationException;
|
||||
|
||||
public void addTags(MindMap mindmap, String tags);
|
||||
|
||||
|
@ -114,14 +114,18 @@ public class MindmapServiceImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCollaboration(@NotNull Collaboration collaboration) {
|
||||
public void removeCollaboration(@NotNull Collaboration collaboration) throws CollaborationException {
|
||||
// remove collaborator association
|
||||
final MindMap mindMap = collaboration.getMindMap();
|
||||
Set<Collaboration> collaborations = mindMap.getCollaborations();
|
||||
final Set<Collaboration> collaborations = mindMap.getCollaborations();
|
||||
|
||||
// When you delete an object from hibernate you have to delete it from *all* collections it exists in...
|
||||
collaborations.remove(collaboration);
|
||||
if (mindMap.getOwner().getEmail().equals(collaboration.getCollaborator().getEmail())) {
|
||||
throw new CollaborationException("User is the creator and must have ownership permissions");
|
||||
}
|
||||
|
||||
mindmapManager.removeCollaboration(collaboration);
|
||||
collaborations.remove(collaboration);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -129,7 +133,7 @@ public class MindmapServiceImpl
|
||||
if (mindmap.getOwner().equals(user)) {
|
||||
mindmapManager.removeMindmap(mindmap);
|
||||
} else {
|
||||
final Collaboration collaboration = mindmap.findCollaborationByEmail(user.getEmail());
|
||||
final Collaboration collaboration = mindmap.findCollaboration(user);
|
||||
if (collaboration != null) {
|
||||
this.removeCollaboration(collaboration);
|
||||
}
|
||||
@ -157,7 +161,7 @@ public class MindmapServiceImpl
|
||||
map.setLastModificationTime(creationTime);
|
||||
map.setOwner(user);
|
||||
|
||||
// Hack to reload dbuser ...
|
||||
// Add map creator with owner permissions ...
|
||||
final User dbUser = userService.getUserBy(user.getId());
|
||||
final Collaboration collaboration = new Collaboration(CollaborationRole.OWNER, dbUser, map);
|
||||
map.getCollaborations().add(collaboration);
|
||||
@ -167,13 +171,18 @@ public class MindmapServiceImpl
|
||||
|
||||
@Override
|
||||
public void addCollaboration(@NotNull MindMap mindmap, @NotNull String email, @NotNull CollaborationRole role)
|
||||
throws InvalidCollaborationException {
|
||||
throws CollaborationException {
|
||||
|
||||
// Validate
|
||||
final Collaborator owner = mindmap.getOwner();
|
||||
final Set<Collaboration> collaborations = mindmap.getCollaborations();
|
||||
if (owner.getEmail().equals(email)) {
|
||||
throw new InvalidCollaborationException("The user " + owner.getEmail() + " is the owner");
|
||||
throw new CollaborationException("The user " + owner.getEmail() + " is the owner");
|
||||
}
|
||||
|
||||
if (role == CollaborationRole.OWNER) {
|
||||
throw new CollaborationException("Ownership can not be modified");
|
||||
|
||||
}
|
||||
|
||||
Collaboration collaboration = getCollaborationBy(email, collaborations);
|
||||
|
@ -74,20 +74,6 @@ public class MindMapBean {
|
||||
return mindMap.getLastModifierUser();
|
||||
}
|
||||
|
||||
public String getLastEditDate() {
|
||||
String result = "";
|
||||
Calendar lastEditTime = Calendar.getInstance();
|
||||
lastEditTime.setTime(mindMap.getLastModificationTime().getTime());
|
||||
Calendar now = Calendar.getInstance();
|
||||
int dayDiff = getDaysBetween(now, lastEditTime);
|
||||
if (dayDiff > 0) {
|
||||
result = dayDiff + " days ago";
|
||||
} else if (dayDiff == 0) {
|
||||
result = "today";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getLastEditTime() {
|
||||
return DateFormat.getInstance().format(mindMap.getLastModificationTime().getTime());
|
||||
}
|
||||
@ -116,32 +102,6 @@ public class MindMapBean {
|
||||
return col;
|
||||
}
|
||||
|
||||
private static int getDaysBetween(java.util.Calendar d1, java.util.Calendar d2) {
|
||||
if (d1.after(d2)) { // swap dates so that d1 is start and d2 is end
|
||||
java.util.Calendar swap = d1;
|
||||
d1 = d2;
|
||||
d2 = swap;
|
||||
}
|
||||
int days = d2.get(java.util.Calendar.DAY_OF_YEAR) -
|
||||
d1.get(java.util.Calendar.DAY_OF_YEAR);
|
||||
int y2 = d2.get(java.util.Calendar.YEAR);
|
||||
if (d1.get(java.util.Calendar.YEAR) != y2) {
|
||||
d1 = (java.util.Calendar) d1.clone();
|
||||
do {
|
||||
days += d1.getActualMaximum(java.util.Calendar.DAY_OF_YEAR);
|
||||
d1.add(java.util.Calendar.YEAR, 1);
|
||||
} while (d1.get(java.util.Calendar.YEAR) != y2);
|
||||
}
|
||||
return days;
|
||||
}
|
||||
|
||||
public static class MindMapBeanComparator implements Comparator<MindMapBean> {
|
||||
|
||||
public int compare(MindMapBean o1, MindMapBean o2) {
|
||||
return o1.getLastEditTime().compareTo(o2.getLastEditTime());
|
||||
}
|
||||
}
|
||||
|
||||
public int getCountColaborators() {
|
||||
return colaborators != null ? colaborators.size() : 0;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<hibernate-mapping>
|
||||
|
||||
<class name="com.wisemapping.model.Collaboration" table="MINDMAP_COLABORATOR">
|
||||
<class name="com.wisemapping.model.Collaboration" table="COLLABORATION">
|
||||
<id name="id">
|
||||
<generator class="increment"/>
|
||||
</id>
|
||||
@ -17,13 +17,18 @@
|
||||
column="MINDMAP_ID"
|
||||
not-null="true"
|
||||
class="com.wisemapping.model.MindMap"
|
||||
/>
|
||||
/>
|
||||
|
||||
<many-to-one name="collaborator"
|
||||
column="COLABORATOR_ID"
|
||||
not-null="true"
|
||||
class="com.wisemapping.model.Collaborator"
|
||||
/>
|
||||
|
||||
|
||||
<many-to-one name="collaborationProperties" class="com.wisemapping.model.CollaborationProperties"
|
||||
column="properties_id" not-null="false" cascade="all" unique="true"/>
|
||||
|
||||
</class>
|
||||
|
||||
</hibernate-mapping>
|
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE hibernate-mapping PUBLIC
|
||||
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
|
||||
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
|
||||
|
||||
<hibernate-mapping>
|
||||
|
||||
<class name="com.wisemapping.model.CollaborationProperties" table="COLLABORATION_PROPERTIES">
|
||||
<id name="id">
|
||||
<generator class="increment"/>
|
||||
</id>
|
||||
<property name="starred" column="starred" unique="false" not-null="true"/>
|
||||
</class>
|
||||
|
||||
</hibernate-mapping>
|
@ -28,14 +28,6 @@
|
||||
<key column="MINDMAP_ID" not-null="true"/>
|
||||
<one-to-many class="com.wisemapping.model.Collaboration"/>
|
||||
</set>
|
||||
|
||||
<set name="collaborationProperties"
|
||||
cascade="all, delete-orphan"
|
||||
inverse="true">
|
||||
<key column="MINDMAP_ID" not-null="true"/>
|
||||
<one-to-many class="com.wisemapping.model.CollaborationProperties"/>
|
||||
</set>
|
||||
|
||||
</class>
|
||||
|
||||
</hibernate-mapping>
|
@ -1,29 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE hibernate-mapping PUBLIC
|
||||
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
|
||||
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
|
||||
|
||||
<hibernate-mapping>
|
||||
|
||||
<class name="com.wisemapping.model.CollaborationProperties" table="MINDMAP_COLLABORATION_PROPERTIES">
|
||||
<id name="id">
|
||||
<generator class="increment"/>
|
||||
</id>
|
||||
|
||||
<property name="starred" column="starred" unique="false" not-null="true"/>
|
||||
|
||||
<!-- Read-only association property -->
|
||||
<many-to-one name="mindmap"
|
||||
column="MINDMAP_ID"
|
||||
not-null="true"
|
||||
class="com.wisemapping.model.MindMap"
|
||||
/>
|
||||
|
||||
<many-to-one name="collaborator"
|
||||
column="COLLABORATOR_ID"
|
||||
not-null="true"
|
||||
class="com.wisemapping.model.Collaborator"
|
||||
/>
|
||||
</class>
|
||||
|
||||
</hibernate-mapping>
|
@ -26,8 +26,8 @@
|
||||
<list>
|
||||
<value>com/wisemapping/model/Collaborator.hbm.xml</value>
|
||||
<value>com/wisemapping/model/MindMap.hbm.xml</value>
|
||||
<value>com/wisemapping/model/MindmapCollaboration.hbm.xml</value>
|
||||
<value>com/wisemapping/model/MindmapCollaborationProperties.hbm.xml</value>
|
||||
<value>com/wisemapping/model/Collaboration.hbm.xml</value>
|
||||
<value>com/wisemapping/model/CollaborationProperties.hbm.xml</value>
|
||||
<value>com/wisemapping/model/UserLogin.hbm.xml</value>
|
||||
<value>com/wisemapping/model/MindMapHistory.hbm.xml</value>
|
||||
</list>
|
||||
|
@ -32,14 +32,6 @@ editor_properties varchar(512)
|
||||
--FOREIGN KEY(owner_id) REFERENCES USER(colaborator_id)
|
||||
);
|
||||
|
||||
CREATE TABLE MINDMAP_COLLABORATION_PROPERTIES
|
||||
(id INTEGER NOT NULL IDENTITY,
|
||||
mindmap_id INTEGER NOT NULL,
|
||||
collaborator_id INTEGER NOT NULL,
|
||||
starred BOOLEAN NOT NULL,
|
||||
FOREIGN KEY(collaborator_id) REFERENCES COLABORATOR(id),
|
||||
FOREIGN KEY(mindmap_id) REFERENCES MINDMAP(id)
|
||||
);
|
||||
|
||||
CREATE TABLE MINDMAP_HISTORY
|
||||
(id INTEGER NOT NULL IDENTITY,
|
||||
@ -48,15 +40,23 @@ mindmap_id INTEGER NOT NULL,
|
||||
creation_date DATETIME,
|
||||
creator_user varchar(255));
|
||||
|
||||
CREATE TABLE MINDMAP_COLABORATOR
|
||||
CREATE TABLE COLLABORATION_PROPERTIES
|
||||
(id INTEGER NOT NULL IDENTITY,
|
||||
starred BOOLEAN NOT NULL,
|
||||
);
|
||||
|
||||
CREATE TABLE COLLABORATION
|
||||
(id INTEGER NOT NULL IDENTITY,
|
||||
colaborator_id INTEGER NOT NULL,
|
||||
properties_id INTEGER,
|
||||
mindmap_id INTEGER NOT NULL,
|
||||
role_id INTEGER NOT NULL,
|
||||
FOREIGN KEY(colaborator_id) REFERENCES COLABORATOR(id),
|
||||
FOREIGN KEY(mindmap_id) REFERENCES MINDMAP(id)
|
||||
FOREIGN KEY(mindmap_id) REFERENCES MINDMAP(id),
|
||||
FOREIGN KEY(properties_id) REFERENCES COLLABORATION_PROPERTIES(id)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE TAG
|
||||
(id INTEGER NOT NULL IDENTITY,
|
||||
name varchar(255) NOT NULL,
|
||||
|
@ -1,6 +1,6 @@
|
||||
DROP TABLE TAG;
|
||||
DROP TABLE MINDMAP_COLLABORATION_PROPERTIES;
|
||||
DROP TABLE MINDMAP_COLABORATOR;
|
||||
DROP TABLE COLLABORATION_PROPERTIES;
|
||||
DROP TABLE COLLABORATION;
|
||||
DROP TABLE MINDMAP_HISTORY;
|
||||
DROP TABLE MINDMAP;
|
||||
DROP TABLE USER;
|
||||
|
@ -34,15 +34,6 @@ FOREIGN KEY(owner_id) REFERENCES USER(colaborator_id)
|
||||
) CHARACTER SET utf8 ;
|
||||
|
||||
|
||||
CREATE TABLE MINDMAP_COLLABORATION_PROPERTIES(
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
mindmap_id INTEGER NOT NULL,
|
||||
collaborator_id INTEGER NOT NULL,
|
||||
starred BOOL NOT NULL default 0,
|
||||
FOREIGN KEY(collaborator_id) REFERENCES COLABORATOR(id),
|
||||
FOREIGN KEY(mindmap_id) REFERENCES MINDMAP(id)
|
||||
) CHARACTER SET utf8;
|
||||
|
||||
CREATE TABLE MINDMAP_HISTORY
|
||||
(id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
xml blob NOT NULL,
|
||||
@ -51,13 +42,20 @@ creation_date datetime,
|
||||
creator_user varchar(255) CHARACTER SET utf8
|
||||
) CHARACTER SET utf8 ;
|
||||
|
||||
CREATE TABLE MINDMAP_COLABORATOR (
|
||||
CREATE TABLE COLLABORATION_PROPERTIES(
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
starred BOOL NOT NULL default 0,
|
||||
) CHARACTER SET utf8;
|
||||
|
||||
CREATE TABLE COLLABORATION (
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
colaborator_id INTEGER NOT NULL,
|
||||
properties_id INTEGER NOT NULL,
|
||||
mindmap_id INTEGER NOT NULL,
|
||||
role_id INTEGER NOT NULL,
|
||||
FOREIGN KEY(colaborator_id) REFERENCES COLABORATOR(id),
|
||||
FOREIGN KEY(mindmap_id) REFERENCES MINDMAP(id)
|
||||
FOREIGN KEY(properties_id) REFERENCES COLLABORATION_PROPERTIES(id),
|
||||
) CHARACTER SET utf8 ;
|
||||
|
||||
CREATE TABLE TAG(
|
||||
|
@ -1,6 +1,6 @@
|
||||
DROP TABLE TAG;
|
||||
DROP TABLE MINDMAP_COLLABORATION_PROPERTIES;
|
||||
DROP TABLE MINDMAP_COLABORATOR;
|
||||
DROP TABLE COLLABORATION_PROPERTIES;
|
||||
DROP TABLE COLLABORATION;
|
||||
DROP TABLE MINDMAP_HISTORY;
|
||||
DROP TABLE MINDMAP;
|
||||
DROP TABLE USER;
|
||||
|
Loading…
Reference in New Issue
Block a user