diff --git a/config/database/hsql/create-schemas.sql b/config/database/hsql/create-schemas.sql
index 30a919bb..3e98ae79 100644
--- a/config/database/hsql/create-schemas.sql
+++ b/config/database/hsql/create-schemas.sql
@@ -1,6 +1,6 @@
CREATE TABLE COLLABORATOR (
id INTEGER NOT NULL IDENTITY,
- email VARCHAR(255) NOT NULL,
+ email VARCHAR(255) NOT NULL UNIQUE,
creation_date DATE
);
@@ -27,7 +27,6 @@ CREATE TABLE MINDMAP (
creation_date DATETIME,
edition_date DATETIME,
creator_id INTEGER NOT NULL,
- tags VARCHAR(1014),
last_editor_id INTEGER NOT NULL
--FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id)
);
@@ -76,14 +75,6 @@ CREATE TABLE COLLABORATION (
FOREIGN KEY (properties_id) REFERENCES COLLABORATION_PROPERTIES (id)
);
-
-CREATE TABLE TAG (
- id INTEGER NOT NULL IDENTITY,
- name VARCHAR(255) NOT NULL,
- user_id INTEGER NOT NULL,
---FOREIGN KEY(user_id) REFERENCES USER(colaborator_id)
-);
-
CREATE TABLE ACCESS_AUDITORY (
id INTEGER NOT NULL IDENTITY,
user_id INTEGER NOT NULL,
diff --git a/config/database/hsql/drop-schemas.sql b/config/database/hsql/drop-schemas.sql
index 701bb2c8..22dc8016 100644
--- a/config/database/hsql/drop-schemas.sql
+++ b/config/database/hsql/drop-schemas.sql
@@ -1,5 +1,4 @@
DROP TABLE IF EXISTS ACCESS_AUDITORY;
-DROP TABLE IF EXISTS TAG;
DROP TABLE IF EXISTS COLLABORATION;
DROP TABLE IF EXISTS COLLABORATION_PROPERTIES;
DROP TABLE IF EXISTS MINDMAP_HISTORY;
diff --git a/config/database/mysql/create-schemas.sql b/config/database/mysql/create-schemas.sql
index eba00226..974a14a4 100644
--- a/config/database/mysql/create-schemas.sql
+++ b/config/database/mysql/create-schemas.sql
@@ -42,8 +42,6 @@ CREATE TABLE MINDMAP (
creation_date DATETIME,
edition_date DATETIME,
creator_id INTEGER NOT NULL,
- tags VARCHAR(1014)
- CHARACTER SET utf8,
last_editor_id INTEGER NOT NULL,
FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id)
ON DELETE CASCADE
@@ -110,17 +108,7 @@ CREATE TABLE COLLABORATION (
FOREIGN KEY (properties_id) REFERENCES COLLABORATION_PROPERTIES (id)
ON DELETE CASCADE
ON UPDATE NO ACTION
-)
- CHARACTER SET utf8;
-
-CREATE TABLE TAG (
- id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
- name VARCHAR(255)
- CHARACTER SET utf8 NOT NULL,
- user_id INTEGER NOT NULL,
- FOREIGN KEY (user_id) REFERENCES USER (colaborator_id)
- ON DELETE CASCADE
- ON UPDATE NO ACTION
+ UNIQUE KEY UC_ROLE (mindmap_id,colaborator_id)
)
CHARACTER SET utf8;
diff --git a/config/database/mysql/drop-schemas.sql b/config/database/mysql/drop-schemas.sql
index 40880f18..d1a1e95d 100644
--- a/config/database/mysql/drop-schemas.sql
+++ b/config/database/mysql/drop-schemas.sql
@@ -1,4 +1,3 @@
-DROP TABLE IF EXISTS TAG;
DROP TABLE IF EXISTS ACCESS_AUDITORY;
DROP TABLE IF EXISTS COLLABORATION;
DROP TABLE IF EXISTS COLLABORATION_PROPERTIES;
diff --git a/config/database/mysql/v2.0-to-v3.0.sql b/config/database/mysql/v2.0-to-v3.0.sql
deleted file mode 100644
index 5d7cf10d..00000000
--- a/config/database/mysql/v2.0-to-v3.0.sql
+++ /dev/null
@@ -1,57 +0,0 @@
-CREATE TABLE COLLABORATION_PROPERTIES (
- id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
- starred BOOL NOT NULL DEFAULT 0,
- mindmap_properties VARCHAR(512)
- CHARACTER SET utf8
-)
- CHARACTER SET utf8;
-
-DROP TABLE `MINDMAP_NATIVE`;
-ALTER TABLE `MINDMAP_COLABORATOR` RENAME TO `COLLABORATION`;
-ALTER TABLE `COLABORATOR` RENAME TO `COLLABORATOR`;
-
-ALTER TABLE `MINDMAP` DROP COLUMN `editor_properties`, DROP COLUMN `mindMapNative_id`;
-
-ALTER TABLE `MINDMAP` CHANGE COLUMN `owner_id` `creator_id` INT(11) NOT NULL
-, DROP INDEX `owner_id`
-, ADD INDEX `owner_id` (`creator_id` ASC);
-
-ALTER TABLE `COLLABORATION` ADD COLUMN `properties_id` INT(11) NULL DEFAULT NULL
-AFTER `role_id`;
-DROP TABLE USER_LOGIN;
-
-CREATE TABLE ACCESS_AUDITORY (
- id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
- user_id INTEGER NOT NULL,
- login_date DATE
-)
- CHARACTER SET utf8;
-
-#ALTER TABLE ACCESS_AUDITORY
-# ADD CONSTRAINT `user_id`
-# FOREIGN KEY ()
-# REFERENCES `USER` ()
-# ON DELETE CASCADE
-# ON UPDATE NO ACTION
-#, ADD INDEX `user_id` () ;
-
-ALTER TABLE `MINDMAP_HISTORY` DROP COLUMN `creator_user`, ADD COLUMN `editor_id` INT(11) NULL DEFAULT NULL AFTER `creation_date`;
-
-ALTER TABLE `USER` ADD COLUMN `locale` VARCHAR(5) NULL
-AFTER `allowSendEmail`;
-
-ALTER TABLE `MINDMAP` DROP COLUMN `last_editor`, ADD COLUMN `last_editor_id` INT(11) NULL DEFAULT 2
-AFTER `tags`;
-
-ALTER TABLE `USER` DROP COLUMN `username`, CHANGE COLUMN `activationCode` `activation_code` BIGINT(20) NOT NULL, CHANGE COLUMN `allowSendEmail` `allow_send_email` CHAR(1) NOT NULL DEFAULT '0';
-
-INSERT INTO `MINDMAP` (`last_editor_id`) VALUES (1);
-
-INSERT INTO `COLLABORATOR` (`id`, `email`, `creation_date`) VALUES (8081, 'migfake@wis.com', '2007-10-09');
-DELETE FROM `USER`
-WHERE activation_date IS null;
-DROP TABLE FEEDBACK;
-
-
-ALTER TABLE `MINDMAP` CHANGE COLUMN `XML` `XML` MEDIUMBLOB NULL DEFAULT NULL;
-ALTER TABLE `MINDMAP_HISTORY` CHANGE COLUMN `XML` `XML` MEDIUMBLOB NULL DEFAULT NULL;
diff --git a/config/database/mysql/v3.0-to-v3.0.1.sql b/config/database/mysql/v3.0-to-v3.0.1.sql
deleted file mode 100644
index 4f7b822a..00000000
--- a/config/database/mysql/v3.0-to-v3.0.1.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-ALTER TABLE `USER` ADD COLUMN `authentication_type` CHAR(1) CHARACTER SET utf8 NOT NULL DEFAULT 'D'
-AFTER `colaborator_id`;
-
-ALTER TABLE `USER` ADD COLUMN `authenticator_uri` VARCHAR(255) CHARACTER SET utf8
-AFTER `authentication_type`;
\ No newline at end of file
diff --git a/config/database/mysql/v3.0.2-to-v3.0.3.sql b/config/database/mysql/v3.0.2-to-v3.0.3.sql
deleted file mode 100644
index 094dfa9d..00000000
--- a/config/database/mysql/v3.0.2-to-v3.0.3.sql
+++ /dev/null
@@ -1,37 +0,0 @@
-ALTER TABLE `USER` DROP COLUMN `id`;
-
-ALTER TABLE `ACCESS_AUDITORY`
- ADD CONSTRAINT
- FOREIGN KEY (user_id) REFERENCES USER (colaborator_id)
- ON DELETE CASCADE
- ON UPDATE NO ACTION;
-
-CREATE TABLE LABEL (
- id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
- title VARCHAR(30)
- CHARACTER SET utf8 NOT NULL,
- creator_id INTEGER NOT NULL,
- parent_label_id INTEGER,
- color VARCHAR(7) NOT NULL,
- FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id),
- FOREIGN KEY (parent_label_id) REFERENCES LABEL (id)
- ON DELETE CASCADE
- ON UPDATE NO ACTION
-)
- CHARACTER SET utf8;
-
-CREATE TABLE R_LABEL_MINDMAP (
- mindmap_id INTEGER NOT NULL,
- label_id INTEGER NOT NULL,
- PRIMARY KEY (mindmap_id, label_id),
- FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id),
- FOREIGN KEY (label_id) REFERENCES LABEL (id)
- ON DELETE CASCADE
- ON UPDATE NO ACTION
-)
- CHARACTER SET utf8;
-
-ALTER TABLE `LABEL`
- ADD COLUMN iconName VARCHAR(50) NOT NULL;
-
-UPDATE LABEL SET iconName = 'glyphicon glyphicon-tag';
diff --git a/distribution/build-image.sh b/distribution/build-image.sh
index fba25e92..ad4f6232 100755
--- a/distribution/build-image.sh
+++ b/distribution/build-image.sh
@@ -4,4 +4,4 @@ set -o
set -u
mvn -f ../pom.xml clean package
-docker build -t wisemapping/wisemapping:latest -f ./Dockerfile ../wise-webapp/target/
+docker build --platform linux/amd64 -t wisemapping/wisemapping:latest -f ./Dockerfile ../wise-webapp/target/
diff --git a/pom.xml b/pom.xml
index e7c4cee3..b6bf10ca 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- 5.0.12
+ 5.0.13-SNAPSHOT
${project.basedir}/wise-webapps
@@ -16,7 +16,7 @@
org.wisemapping
wisemapping
WiseMapping Project
- 5.0.12
+ 5.0.13-SNAPSHOT
pom
diff --git a/wise-ui/pom.xml b/wise-ui/pom.xml
index d2bbb19c..9350db06 100644
--- a/wise-ui/pom.xml
+++ b/wise-ui/pom.xml
@@ -12,7 +12,7 @@
org.wisemapping
wisemapping
../pom.xml
- 5.0.12
+ 5.0.13-SNAPSHOT
@@ -29,11 +29,11 @@
-
+
-
+
@@ -42,11 +42,11 @@
-
+
-
+
diff --git a/wise-webapp/pom.xml b/wise-webapp/pom.xml
index c8799a2c..0f170990 100644
--- a/wise-webapp/pom.xml
+++ b/wise-webapp/pom.xml
@@ -8,7 +8,7 @@
org.wisemapping
wisemapping
../pom.xml
- 5.0.12
+ 5.0.13-SNAPSHOT
diff --git a/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManager.java b/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManager.java
index abb9fa20..2d0b298d 100644
--- a/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManager.java
+++ b/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManager.java
@@ -29,16 +29,8 @@ public interface MindmapManager {
Collaborator findCollaborator(@NotNull String email);
- Collaborator findCollaborator(int id);
-
List findCollaboration(final int collaboratorId);
- List findCollaboration(final CollaborationRole userRole);
-
- Collaboration findCollaboration(final int mindmapId, final User user);
-
- List getAllMindmaps();
-
@Nullable
Mindmap getMindmapById(int mindmapId);
diff --git a/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManagerImpl.java b/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManagerImpl.java
index 42683d26..907a3a5e 100644
--- a/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManagerImpl.java
+++ b/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManagerImpl.java
@@ -116,6 +116,7 @@ public class MindmapManagerImpl
@Override
public List findMindmapByUser(@NotNull User user) {
+
final Mindmap collaborator;
final Query query = currentSession()
.createQuery("from com.wisemapping.model.Mindmap m where m.id in (select c.mindMap.id from com.wisemapping.model.Collaboration as c where c.collaborator.id=:collabId )");
@@ -147,23 +148,11 @@ public class MindmapManagerImpl
final SimpleExpression descriptionRestriction = Restrictions.like("description", "%" + criteria.getDescription() + "%");
junction.add(descriptionRestriction);
}
- if (criteria.getTags().size() > 0) {
- for (String tag : criteria.getTags()) {
- final SimpleExpression tagRestriction = Restrictions.like("tags", "%" + tag + "%");
- junction.add(tagRestriction);
- }
- }
-
hibernateCriteria.add(junction);
}
return hibernateCriteria.list();
}
- @Override
- public Collaborator findCollaborator(int id) {
- return getHibernateTemplate().get(Collaborator.class, id);
- }
-
@Override
public List findCollaboration(final int collaboratorId) {
Query query = currentSession().createQuery("from com.wisemapping.model.Collaboration c where c.collaborator.id=:collaboratorId");
@@ -171,32 +160,6 @@ public class MindmapManagerImpl
return query.getResultList();
}
- @Override
- public List findCollaboration(final CollaborationRole collaborationRole) {
- Query query = currentSession().createQuery("from com.wisemapping.model.Collaboration c where c.role=:roleId");
- query.setParameter("roleId", collaborationRole.ordinal());
- return query.getResultList();
- }
-
- @Override
- public Collaboration findCollaboration(final int mindmapId, final User user) {
- final Collaboration result;
-
- Query query = currentSession().createQuery("from com.wisemapping.model.Collaboration c where c.mindMap.id=:mindmapId and c.id=:collaboratorId");
- query.setParameter("mindmapId", mindmapId);
- query.setParameter("collaboratorId", user.getId());
-
- final List mindMaps = query.getResultList();
-
- if (mindMaps != null && !mindMaps.isEmpty()) {
- result = mindMaps.get(0);
- } else {
- result = null;
- }
-
- return result;
- }
-
@Override
public void addCollaborator(@NotNull Collaborator collaborator) {
assert collaborator != null : "ADD MINDMAP COLLABORATOR: Collaborator is required!";
@@ -213,12 +176,6 @@ public class MindmapManagerImpl
getHibernateTemplate().delete(collaborator);
}
- @Override
- @SuppressWarnings("unchecked")
- public List getAllMindmaps() {
- return currentSession().createQuery("from com.wisemapping.model.Mindmap wisemapping").list();
- }
-
@Override
@Nullable
public Mindmap getMindmapById(int id) {
@@ -263,15 +220,18 @@ public class MindmapManagerImpl
}
@Override
- public void removeMindmap(@NotNull final Mindmap mindMap) {
+ public void removeMindmap(@NotNull final Mindmap mindmap) {
// Delete history first ...
final Criteria hibernateCriteria = currentSession().createCriteria(MindMapHistory.class);
- hibernateCriteria.add(Restrictions.eq("mindmapId", mindMap.getId()));
- List list = hibernateCriteria.list();
+ hibernateCriteria.add(Restrictions.eq("mindmapId", mindmap.getId()));
+ final List list = hibernateCriteria.list();
getHibernateTemplate().deleteAll(list);
+ // Remove collaborations ...
+ mindmap.removedCollaboration(mindmap.getCollaborations());
+
// Delete mindmap ....
- getHibernateTemplate().delete(mindMap);
+ getHibernateTemplate().delete(mindmap);
}
private void saveHistory(@NotNull final Mindmap mindMap) {
diff --git a/wise-webapp/src/main/java/com/wisemapping/dao/UserManagerImpl.java b/wise-webapp/src/main/java/com/wisemapping/dao/UserManagerImpl.java
index 663fe9d2..d331d2e6 100644
--- a/wise-webapp/src/main/java/com/wisemapping/dao/UserManagerImpl.java
+++ b/wise-webapp/src/main/java/com/wisemapping/dao/UserManagerImpl.java
@@ -34,6 +34,7 @@ import org.springframework.security.crypto.password.PasswordEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
public class UserManagerImpl
extends HibernateDaoSupport
@@ -109,27 +110,22 @@ public class UserManagerImpl
assert user != null : "Trying to store a null user";
// Migrate from previous temporal collab to new user ...
- List newCollabs = new ArrayList<>();
- final Set collaborations = collaborator.getCollaborations();
- for (Collaboration oldCollab : collaborations) {
- Collaboration newCollab = new Collaboration();
- newCollab.setRoleId(oldCollab.getRole().ordinal());
- newCollab.setMindMap(oldCollab.getMindMap());
- newCollab.setCollaborator(user);
- user.addCollaboration(newCollab);
- newCollabs.add(newCollab);
- }
-
- // Delete old collaboration
final HibernateTemplate template = getHibernateTemplate();
- collaborations.forEach(c -> template.delete(c));
- template.delete(collaborator);
+ collaborator.setEmail(collaborator.getEmail() + "_toRemove");
+ template.saveOrUpdate(collaborator);
template.flush();
// Save all new...
this.createUser(user);
- newCollabs.forEach(c -> template.saveOrUpdate(c));
+ // Update mindmap ...
+ final Set collaborations = new CopyOnWriteArraySet<>(collaborator.getCollaborations());
+ for (Collaboration collabs : collaborations) {
+ collabs.setCollaborator(user);
+ }
+
+ // Delete old user ...
+ template.delete(collaborator);
return user;
}
diff --git a/wise-webapp/src/main/java/com/wisemapping/exceptions/CollabChangeException.java b/wise-webapp/src/main/java/com/wisemapping/exceptions/OwnerCannotChangeException.java
similarity index 89%
rename from wise-webapp/src/main/java/com/wisemapping/exceptions/CollabChangeException.java
rename to wise-webapp/src/main/java/com/wisemapping/exceptions/OwnerCannotChangeException.java
index ee792603..0d10c695 100755
--- a/wise-webapp/src/main/java/com/wisemapping/exceptions/CollabChangeException.java
+++ b/wise-webapp/src/main/java/com/wisemapping/exceptions/OwnerCannotChangeException.java
@@ -20,13 +20,13 @@ package com.wisemapping.exceptions;
import org.jetbrains.annotations.NotNull;
-public class CollabChangeException
+public class OwnerCannotChangeException
extends ClientException
{
private static final String MSG_KEY = "OWNER_ROLE_CAN_NOT_BE_CHANGED";
- public CollabChangeException(@NotNull String email)
+ public OwnerCannotChangeException(@NotNull String email)
{
super("Collab email can not be change. " + email + " is the the owner.",Severity.WARNING);
}
diff --git a/wise-webapp/src/main/java/com/wisemapping/model/Collaboration.java b/wise-webapp/src/main/java/com/wisemapping/model/Collaboration.java
index a5bc1e44..7446b6f5 100644
--- a/wise-webapp/src/main/java/com/wisemapping/model/Collaboration.java
+++ b/wise-webapp/src/main/java/com/wisemapping/model/Collaboration.java
@@ -19,6 +19,10 @@
package com.wisemapping.model;
+import org.hibernate.annotations.Fetch;
+import org.hibernate.annotations.FetchMode;
+import org.jetbrains.annotations.Nullable;
+
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@@ -43,7 +47,7 @@ public class Collaboration implements Serializable {
private Collaborator collaborator;
@ManyToOne(cascade = CascadeType.ALL)
- @JoinColumn(name = "properties_id", nullable = false, unique = true)
+ @JoinColumn(name = "properties_id", nullable = true, unique = true)
private CollaborationProperties collaborationProperties = new CollaborationProperties();
public Collaboration() {
@@ -100,12 +104,13 @@ public class Collaboration implements Serializable {
this.collaborator = collaborator;
}
- @NotNull
+
+ @Nullable
public CollaborationProperties getCollaborationProperties() {
return this.collaborationProperties;
}
- public void setCollaborationProperties(@NotNull CollaborationProperties collaborationProperties) {
+ public void setCollaborationProperties(@Nullable CollaborationProperties collaborationProperties) {
this.collaborationProperties = collaborationProperties;
}
diff --git a/wise-webapp/src/main/java/com/wisemapping/model/Collaborator.java b/wise-webapp/src/main/java/com/wisemapping/model/Collaborator.java
index 9499a794..bf1d1c2e 100755
--- a/wise-webapp/src/main/java/com/wisemapping/model/Collaborator.java
+++ b/wise-webapp/src/main/java/com/wisemapping/model/Collaborator.java
@@ -1,20 +1,20 @@
/*
-* Copyright [2022] [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.
-*/
+ * Copyright [2022] [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.model;
@@ -32,18 +32,18 @@ import java.util.Set;
@Entity
@Table(name = "COLLABORATOR")
@Inheritance(strategy = InheritanceType.JOINED)
-//@Cacheable
-//@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
+@Cacheable
+@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Collaborator implements Serializable {
@Id
- @GeneratedValue(strategy= GenerationType.IDENTITY)
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
private String email;
@Column(name = "creation_date")
private Calendar creationDate;
- @OneToMany(mappedBy="collaborator")
+ @OneToMany(mappedBy = "collaborator")
private Set collaborations = new HashSet<>();
public Collaborator() {
@@ -112,12 +112,19 @@ public class Collaborator implements Serializable {
public boolean identityEquality(@Nullable Collaborator that) {
- if (this == that) return true;
- if (that == null) return false;
+ if (this == that) {
+ return true;
+ }
+
+ if (that == null) {
+ return false;
+ }
+
+ if (id != that.getId()) {
+ return false;
+ }
- if (id != that.getId()) return false;
return email != null ? email.equals(that.getEmail()) : that.getEmail() == null;
-
}
}
diff --git a/wise-webapp/src/main/java/com/wisemapping/model/MindMapCriteria.java b/wise-webapp/src/main/java/com/wisemapping/model/MindMapCriteria.java
index 05f88d7f..c57f3c21 100644
--- a/wise-webapp/src/main/java/com/wisemapping/model/MindMapCriteria.java
+++ b/wise-webapp/src/main/java/com/wisemapping/model/MindMapCriteria.java
@@ -24,7 +24,6 @@ import java.util.List;
public class MindMapCriteria {
private String title;
private String description;
- private List tags = new ArrayList();
private boolean orConnector = false;
private int pageNro = 0;
@@ -41,18 +40,9 @@ public class MindMapCriteria {
this.pageNro = page;
}
- public List getTags() {
- return tags;
- }
-
- public void setTags(List tags) {
- this.tags = tags;
- }
-
public String getTitle() {
return title;
}
-
public void setTitle(String title) {
this.title = title;
}
@@ -78,8 +68,7 @@ public class MindMapCriteria {
}
public boolean isEmpty() {
- return !(getTags() != null && !getTags().isEmpty() || getTitle() != null || getDescription() != null);
+ return getTitle() != null || getDescription() != null;
}
- public static MindMapCriteria EMPTY_CRITERIA = new MindMapCriteria();
}
diff --git a/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java b/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java
index 5cf58ef6..d3cdf366 100644
--- a/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java
+++ b/wise-webapp/src/main/java/com/wisemapping/model/Mindmap.java
@@ -23,6 +23,8 @@ import com.wisemapping.exceptions.InvalidMindmapException;
import com.wisemapping.exceptions.WiseMappingException;
import com.wisemapping.util.ZipUtils;
import org.apache.commons.lang.StringEscapeUtils;
+import org.hibernate.annotations.Fetch;
+import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.jetbrains.annotations.NotNull;
@@ -63,10 +65,12 @@ public class Mindmap implements Serializable {
@Column(name = "public")
private boolean isPublic;
- @OneToMany(mappedBy = "mindMap", orphanRemoval = true, cascade = {CascadeType.ALL})
+ @OneToMany(mappedBy = "mindMap", orphanRemoval = true, cascade = {CascadeType.ALL}, fetch = FetchType.LAZY)
+ @Fetch(FetchMode.JOIN)
private Set collaborations = new HashSet<>();
@ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE})
+ @Fetch(FetchMode.JOIN)
@JoinTable(
name = "R_LABEL_MINDMAP",
joinColumns = @JoinColumn(name = "mindmap_id"),
@@ -142,7 +146,11 @@ public class Mindmap implements Serializable {
}
public void removedCollaboration(@NotNull Collaboration collaboration) {
- collaborations.add(collaboration);
+ collaborations.remove(collaboration);
+ }
+
+ public void removedCollaboration(@NotNull Set collaborations) {
+ this.collaborations.removeAll(collaborations);
}
@NotNull
@@ -177,15 +185,14 @@ public class Mindmap implements Serializable {
return result;
}
+ public boolean isCreator(@NotNull User user) {
+ return this.getCreator() != null && this.getCreator().identityEquality(user);
+ }
+
public boolean isPublic() {
return isPublic;
}
- //@Todo: This is a hack to overcome some problem with JS EL. For some reason, ${mindmap.public} fails as not supported.
- // More research is needed...
- public boolean isAccessible() {
- return isPublic();
- }
public void setPublic(boolean isPublic) {
this.isPublic = isPublic;
diff --git a/wise-webapp/src/main/java/com/wisemapping/model/User.java b/wise-webapp/src/main/java/com/wisemapping/model/User.java
index b90e0da6..261471a8 100644
--- a/wise-webapp/src/main/java/com/wisemapping/model/User.java
+++ b/wise-webapp/src/main/java/com/wisemapping/model/User.java
@@ -31,8 +31,6 @@ import java.util.Set;
@Entity
@Table(name = "USER")
@PrimaryKeyJoinColumn(name = "colaborator_id")
-//@Cacheable
-//@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class User
extends Collaborator
implements Serializable {
@@ -57,22 +55,9 @@ public class User
@Column(name = "authenticator_uri")
private String authenticatorUri;
- @ElementCollection
- @CollectionTable(name = "TAG", joinColumns = @JoinColumn(name = "user_id"))
- @Column(name = "name")
- private Set tags = new HashSet<>();
-
public User() {
}
- public void setTags(Set tags) {
- this.tags = tags;
- }
-
- public Set getTags() {
- return tags;
- }
-
public String getFullName() {
return this.getFirstname() + " " + this.getLastname();
}
diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/AccountController.java b/wise-webapp/src/main/java/com/wisemapping/rest/AccountController.java
index b9f6d93c..d6f0921b 100644
--- a/wise-webapp/src/main/java/com/wisemapping/rest/AccountController.java
+++ b/wise-webapp/src/main/java/com/wisemapping/rest/AccountController.java
@@ -129,7 +129,7 @@ public class AccountController extends BaseController {
}
// Delete labels ....
- List