Merge branch 'develop'

This commit is contained in:
Paulo Gustavo Veiga 2022-10-21 18:45:00 -07:00
commit b1f0704696
42 changed files with 187 additions and 341 deletions

View File

@ -1,6 +1,6 @@
CREATE TABLE COLLABORATOR ( CREATE TABLE COLLABORATOR (
id INTEGER NOT NULL IDENTITY, id INTEGER NOT NULL IDENTITY,
email VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL UNIQUE,
creation_date DATE creation_date DATE
); );
@ -27,7 +27,6 @@ CREATE TABLE MINDMAP (
creation_date DATETIME, creation_date DATETIME,
edition_date DATETIME, edition_date DATETIME,
creator_id INTEGER NOT NULL, creator_id INTEGER NOT NULL,
tags VARCHAR(1014),
last_editor_id INTEGER NOT NULL last_editor_id INTEGER NOT NULL
--FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id) --FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id)
); );
@ -76,14 +75,6 @@ CREATE TABLE COLLABORATION (
FOREIGN KEY (properties_id) REFERENCES COLLABORATION_PROPERTIES (id) 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 ( CREATE TABLE ACCESS_AUDITORY (
id INTEGER NOT NULL IDENTITY, id INTEGER NOT NULL IDENTITY,
user_id INTEGER NOT NULL, user_id INTEGER NOT NULL,

View File

@ -1,5 +1,4 @@
DROP TABLE IF EXISTS ACCESS_AUDITORY; DROP TABLE IF EXISTS ACCESS_AUDITORY;
DROP TABLE IF EXISTS TAG;
DROP TABLE IF EXISTS COLLABORATION; DROP TABLE IF EXISTS COLLABORATION;
DROP TABLE IF EXISTS COLLABORATION_PROPERTIES; DROP TABLE IF EXISTS COLLABORATION_PROPERTIES;
DROP TABLE IF EXISTS MINDMAP_HISTORY; DROP TABLE IF EXISTS MINDMAP_HISTORY;

View File

@ -42,8 +42,6 @@ CREATE TABLE MINDMAP (
creation_date DATETIME, creation_date DATETIME,
edition_date DATETIME, edition_date DATETIME,
creator_id INTEGER NOT NULL, creator_id INTEGER NOT NULL,
tags VARCHAR(1014)
CHARACTER SET utf8,
last_editor_id INTEGER NOT NULL, last_editor_id INTEGER NOT NULL,
FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id) FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id)
ON DELETE CASCADE ON DELETE CASCADE
@ -110,17 +108,7 @@ CREATE TABLE COLLABORATION (
FOREIGN KEY (properties_id) REFERENCES COLLABORATION_PROPERTIES (id) FOREIGN KEY (properties_id) REFERENCES COLLABORATION_PROPERTIES (id)
ON DELETE CASCADE ON DELETE CASCADE
ON UPDATE NO ACTION ON UPDATE NO ACTION
) UNIQUE KEY UC_ROLE (mindmap_id,colaborator_id)
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
) )
CHARACTER SET utf8; CHARACTER SET utf8;

View File

@ -1,4 +1,3 @@
DROP TABLE IF EXISTS TAG;
DROP TABLE IF EXISTS ACCESS_AUDITORY; DROP TABLE IF EXISTS ACCESS_AUDITORY;
DROP TABLE IF EXISTS COLLABORATION; DROP TABLE IF EXISTS COLLABORATION;
DROP TABLE IF EXISTS COLLABORATION_PROPERTIES; DROP TABLE IF EXISTS COLLABORATION_PROPERTIES;

View File

@ -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;

View File

@ -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`;

View File

@ -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';

View File

@ -4,4 +4,4 @@ set -o
set -u set -u
mvn -f ../pom.xml clean package 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/

View File

@ -4,7 +4,7 @@
http://maven.apache.org/xsd/maven-4.0.0.xsd"> http://maven.apache.org/xsd/maven-4.0.0.xsd">
<properties> <properties>
<com.wisemapping.version>5.0.12</com.wisemapping.version> <com.wisemapping.version>5.0.13-SNAPSHOT</com.wisemapping.version>
<superpom.dir>${project.basedir}/wise-webapps</superpom.dir> <superpom.dir>${project.basedir}/wise-webapps</superpom.dir>
</properties> </properties>
@ -16,7 +16,7 @@
<groupId>org.wisemapping</groupId> <groupId>org.wisemapping</groupId>
<artifactId>wisemapping</artifactId> <artifactId>wisemapping</artifactId>
<name>WiseMapping Project</name> <name>WiseMapping Project</name>
<version>5.0.12</version> <version>5.0.13-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<licenses> <licenses>

View File

@ -12,7 +12,7 @@
<groupId>org.wisemapping</groupId> <groupId>org.wisemapping</groupId>
<artifactId>wisemapping</artifactId> <artifactId>wisemapping</artifactId>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
<version>5.0.12</version> <version>5.0.13-SNAPSHOT</version>
</parent> </parent>
<build> <build>
@ -29,11 +29,11 @@
<mkdir dir="target/wisemapping-mindplot"/> <mkdir dir="target/wisemapping-mindplot"/>
<exec executable="npm" dir="target" failonerror="true"> <exec executable="npm" dir="target" failonerror="true">
<arg value="pack"/> <arg value="pack"/>
<arg value="@wisemapping/mindplot@5.0.16"/> <arg value="@wisemapping/mindplot@5.0.17"/>
</exec> </exec>
<exec executable="tar" dir="target" failonerror="true"> <exec executable="tar" dir="target" failonerror="true">
<arg value="-xvzf"/> <arg value="-xvzf"/>
<arg value="wisemapping-mindplot-5.0.16.tgz"/> <arg value="wisemapping-mindplot-5.0.17.tgz"/>
<arg value="-C"/> <arg value="-C"/>
<arg value="wisemapping-mindplot"/> <arg value="wisemapping-mindplot"/>
</exec> </exec>
@ -42,11 +42,11 @@
<mkdir dir="target/wisemapping-webapp"/> <mkdir dir="target/wisemapping-webapp"/>
<exec executable="npm" dir="target" failonerror="true"> <exec executable="npm" dir="target" failonerror="true">
<arg value="pack"/> <arg value="pack"/>
<arg value="@wisemapping/webapp@5.0.15"/> <arg value="@wisemapping/webapp@5.0.18"/>
</exec> </exec>
<exec executable="tar" dir="target" failonerror="true"> <exec executable="tar" dir="target" failonerror="true">
<arg value="-xvzf"/> <arg value="-xvzf"/>
<arg value="wisemapping-webapp-5.0.15.tgz"/> <arg value="wisemapping-webapp-5.0.18.tgz"/>
<arg value="-C"/> <arg value="-C"/>
<arg value="wisemapping-webapp"/> <arg value="wisemapping-webapp"/>
</exec> </exec>

View File

@ -8,7 +8,7 @@
<groupId>org.wisemapping</groupId> <groupId>org.wisemapping</groupId>
<artifactId>wisemapping</artifactId> <artifactId>wisemapping</artifactId>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
<version>5.0.12</version> <version>5.0.13-SNAPSHOT</version>
</parent> </parent>
<properties> <properties>

View File

@ -29,16 +29,8 @@ public interface MindmapManager {
Collaborator findCollaborator(@NotNull String email); Collaborator findCollaborator(@NotNull String email);
Collaborator findCollaborator(int id);
List<Collaboration> findCollaboration(final int collaboratorId); List<Collaboration> findCollaboration(final int collaboratorId);
List<Collaboration> findCollaboration(final CollaborationRole userRole);
Collaboration findCollaboration(final int mindmapId, final User user);
List<Mindmap> getAllMindmaps();
@Nullable @Nullable
Mindmap getMindmapById(int mindmapId); Mindmap getMindmapById(int mindmapId);

View File

@ -116,6 +116,7 @@ public class MindmapManagerImpl
@Override @Override
public List<Mindmap> findMindmapByUser(@NotNull User user) { public List<Mindmap> findMindmapByUser(@NotNull User user) {
final Mindmap collaborator; final Mindmap collaborator;
final Query query = currentSession() 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 )"); .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() + "%"); final SimpleExpression descriptionRestriction = Restrictions.like("description", "%" + criteria.getDescription() + "%");
junction.add(descriptionRestriction); 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); hibernateCriteria.add(junction);
} }
return hibernateCriteria.list(); return hibernateCriteria.list();
} }
@Override
public Collaborator findCollaborator(int id) {
return getHibernateTemplate().get(Collaborator.class, id);
}
@Override @Override
public List<Collaboration> findCollaboration(final int collaboratorId) { public List<Collaboration> findCollaboration(final int collaboratorId) {
Query query = currentSession().createQuery("from com.wisemapping.model.Collaboration c where c.collaborator.id=: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(); return query.getResultList();
} }
@Override
public List<Collaboration> 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<Collaboration> mindMaps = query.getResultList();
if (mindMaps != null && !mindMaps.isEmpty()) {
result = mindMaps.get(0);
} else {
result = null;
}
return result;
}
@Override @Override
public void addCollaborator(@NotNull Collaborator collaborator) { public void addCollaborator(@NotNull Collaborator collaborator) {
assert collaborator != null : "ADD MINDMAP COLLABORATOR: Collaborator is required!"; assert collaborator != null : "ADD MINDMAP COLLABORATOR: Collaborator is required!";
@ -213,12 +176,6 @@ public class MindmapManagerImpl
getHibernateTemplate().delete(collaborator); getHibernateTemplate().delete(collaborator);
} }
@Override
@SuppressWarnings("unchecked")
public List<Mindmap> getAllMindmaps() {
return currentSession().createQuery("from com.wisemapping.model.Mindmap wisemapping").list();
}
@Override @Override
@Nullable @Nullable
public Mindmap getMindmapById(int id) { public Mindmap getMindmapById(int id) {
@ -263,15 +220,18 @@ public class MindmapManagerImpl
} }
@Override @Override
public void removeMindmap(@NotNull final Mindmap mindMap) { public void removeMindmap(@NotNull final Mindmap mindmap) {
// Delete history first ... // Delete history first ...
final Criteria hibernateCriteria = currentSession().createCriteria(MindMapHistory.class); final Criteria hibernateCriteria = currentSession().createCriteria(MindMapHistory.class);
hibernateCriteria.add(Restrictions.eq("mindmapId", mindMap.getId())); hibernateCriteria.add(Restrictions.eq("mindmapId", mindmap.getId()));
List list = hibernateCriteria.list(); final List list = hibernateCriteria.list();
getHibernateTemplate().deleteAll(list); getHibernateTemplate().deleteAll(list);
// Remove collaborations ...
mindmap.removedCollaboration(mindmap.getCollaborations());
// Delete mindmap .... // Delete mindmap ....
getHibernateTemplate().delete(mindMap); getHibernateTemplate().delete(mindmap);
} }
private void saveHistory(@NotNull final Mindmap mindMap) { private void saveHistory(@NotNull final Mindmap mindMap) {

View File

@ -34,6 +34,7 @@ import org.springframework.security.crypto.password.PasswordEncoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
public class UserManagerImpl public class UserManagerImpl
extends HibernateDaoSupport extends HibernateDaoSupport
@ -109,27 +110,22 @@ public class UserManagerImpl
assert user != null : "Trying to store a null user"; assert user != null : "Trying to store a null user";
// Migrate from previous temporal collab to new user ... // Migrate from previous temporal collab to new user ...
List<Collaboration> newCollabs = new ArrayList<>();
final Set<Collaboration> 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(); final HibernateTemplate template = getHibernateTemplate();
collaborations.forEach(c -> template.delete(c)); collaborator.setEmail(collaborator.getEmail() + "_toRemove");
template.delete(collaborator); template.saveOrUpdate(collaborator);
template.flush(); template.flush();
// Save all new... // Save all new...
this.createUser(user); this.createUser(user);
newCollabs.forEach(c -> template.saveOrUpdate(c));
// Update mindmap ...
final Set<Collaboration> collaborations = new CopyOnWriteArraySet<>(collaborator.getCollaborations());
for (Collaboration collabs : collaborations) {
collabs.setCollaborator(user);
}
// Delete old user ...
template.delete(collaborator);
return user; return user;
} }

View File

@ -20,13 +20,13 @@ package com.wisemapping.exceptions;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
public class CollabChangeException public class OwnerCannotChangeException
extends ClientException extends ClientException
{ {
private static final String MSG_KEY = "OWNER_ROLE_CAN_NOT_BE_CHANGED"; 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); super("Collab email can not be change. " + email + " is the the owner.",Severity.WARNING);
} }

View File

@ -19,6 +19,10 @@
package com.wisemapping.model; package com.wisemapping.model;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.jetbrains.annotations.Nullable;
import javax.persistence.*; import javax.persistence.*;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
@ -43,7 +47,7 @@ public class Collaboration implements Serializable {
private Collaborator collaborator; private Collaborator collaborator;
@ManyToOne(cascade = CascadeType.ALL) @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(); private CollaborationProperties collaborationProperties = new CollaborationProperties();
public Collaboration() { public Collaboration() {
@ -100,12 +104,13 @@ public class Collaboration implements Serializable {
this.collaborator = collaborator; this.collaborator = collaborator;
} }
@NotNull
@Nullable
public CollaborationProperties getCollaborationProperties() { public CollaborationProperties getCollaborationProperties() {
return this.collaborationProperties; return this.collaborationProperties;
} }
public void setCollaborationProperties(@NotNull CollaborationProperties collaborationProperties) { public void setCollaborationProperties(@Nullable CollaborationProperties collaborationProperties) {
this.collaborationProperties = collaborationProperties; this.collaborationProperties = collaborationProperties;
} }

View File

@ -1,20 +1,20 @@
/* /*
* Copyright [2022] [wisemapping] * Copyright [2022] [wisemapping]
* *
* Licensed under WiseMapping Public License, Version 1.0 (the "License"). * Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the * It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page; * "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the license at * You may obtain a copy of the license at
* *
* http://www.wisemapping.org/license * http://www.wisemapping.org/license
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.wisemapping.model; package com.wisemapping.model;
@ -32,18 +32,18 @@ import java.util.Set;
@Entity @Entity
@Table(name = "COLLABORATOR") @Table(name = "COLLABORATOR")
@Inheritance(strategy = InheritanceType.JOINED) @Inheritance(strategy = InheritanceType.JOINED)
//@Cacheable @Cacheable
//@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE) @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Collaborator implements Serializable { public class Collaborator implements Serializable {
@Id @Id
@GeneratedValue(strategy= GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
private int id; private int id;
private String email; private String email;
@Column(name = "creation_date") @Column(name = "creation_date")
private Calendar creationDate; private Calendar creationDate;
@OneToMany(mappedBy="collaborator") @OneToMany(mappedBy = "collaborator")
private Set<Collaboration> collaborations = new HashSet<>(); private Set<Collaboration> collaborations = new HashSet<>();
public Collaborator() { public Collaborator() {
@ -112,12 +112,19 @@ public class Collaborator implements Serializable {
public boolean identityEquality(@Nullable Collaborator that) { public boolean identityEquality(@Nullable Collaborator that) {
if (this == that) return true; if (this == that) {
if (that == null) return false; 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; return email != null ? email.equals(that.getEmail()) : that.getEmail() == null;
} }
} }

View File

@ -24,7 +24,6 @@ import java.util.List;
public class MindMapCriteria { public class MindMapCriteria {
private String title; private String title;
private String description; private String description;
private List<String> tags = new ArrayList<String>();
private boolean orConnector = false; private boolean orConnector = false;
private int pageNro = 0; private int pageNro = 0;
@ -41,18 +40,9 @@ public class MindMapCriteria {
this.pageNro = page; this.pageNro = page;
} }
public List<String> getTags() {
return tags;
}
public void setTags(List<String> tags) {
this.tags = tags;
}
public String getTitle() { public String getTitle() {
return title; return title;
} }
public void setTitle(String title) { public void setTitle(String title) {
this.title = title; this.title = title;
} }
@ -78,8 +68,7 @@ public class MindMapCriteria {
} }
public boolean isEmpty() { public boolean isEmpty() {
return !(getTags() != null && !getTags().isEmpty() || getTitle() != null || getDescription() != null); return getTitle() != null || getDescription() != null;
} }
public static MindMapCriteria EMPTY_CRITERIA = new MindMapCriteria();
} }

View File

@ -23,6 +23,8 @@ import com.wisemapping.exceptions.InvalidMindmapException;
import com.wisemapping.exceptions.WiseMappingException; import com.wisemapping.exceptions.WiseMappingException;
import com.wisemapping.util.ZipUtils; import com.wisemapping.util.ZipUtils;
import org.apache.commons.lang.StringEscapeUtils; 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.NotFound;
import org.hibernate.annotations.NotFoundAction; import org.hibernate.annotations.NotFoundAction;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -63,10 +65,12 @@ public class Mindmap implements Serializable {
@Column(name = "public") @Column(name = "public")
private boolean isPublic; 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<Collaboration> collaborations = new HashSet<>(); private Set<Collaboration> collaborations = new HashSet<>();
@ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE}) @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE})
@Fetch(FetchMode.JOIN)
@JoinTable( @JoinTable(
name = "R_LABEL_MINDMAP", name = "R_LABEL_MINDMAP",
joinColumns = @JoinColumn(name = "mindmap_id"), joinColumns = @JoinColumn(name = "mindmap_id"),
@ -142,7 +146,11 @@ public class Mindmap implements Serializable {
} }
public void removedCollaboration(@NotNull Collaboration collaboration) { public void removedCollaboration(@NotNull Collaboration collaboration) {
collaborations.add(collaboration); collaborations.remove(collaboration);
}
public void removedCollaboration(@NotNull Set<Collaboration> collaborations) {
this.collaborations.removeAll(collaborations);
} }
@NotNull @NotNull
@ -177,15 +185,14 @@ public class Mindmap implements Serializable {
return result; return result;
} }
public boolean isCreator(@NotNull User user) {
return this.getCreator() != null && this.getCreator().identityEquality(user);
}
public boolean isPublic() { public boolean isPublic() {
return 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) { public void setPublic(boolean isPublic) {
this.isPublic = isPublic; this.isPublic = isPublic;

View File

@ -31,8 +31,6 @@ import java.util.Set;
@Entity @Entity
@Table(name = "USER") @Table(name = "USER")
@PrimaryKeyJoinColumn(name = "colaborator_id") @PrimaryKeyJoinColumn(name = "colaborator_id")
//@Cacheable
//@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class User public class User
extends Collaborator extends Collaborator
implements Serializable { implements Serializable {
@ -57,22 +55,9 @@ public class User
@Column(name = "authenticator_uri") @Column(name = "authenticator_uri")
private String authenticatorUri; private String authenticatorUri;
@ElementCollection
@CollectionTable(name = "TAG", joinColumns = @JoinColumn(name = "user_id"))
@Column(name = "name")
private Set<String> tags = new HashSet<>();
public User() { public User() {
} }
public void setTags(Set<String> tags) {
this.tags = tags;
}
public Set<String> getTags() {
return tags;
}
public String getFullName() { public String getFullName() {
return this.getFirstname() + " " + this.getLastname(); return this.getFirstname() + " " + this.getLastname();
} }

View File

@ -129,7 +129,7 @@ public class AccountController extends BaseController {
} }
// Delete labels .... // Delete labels ....
List<Label> labels = labelService.getAll(user); final List<Label> labels = labelService.getAll(user);
labels.forEach(l -> { labels.forEach(l -> {
try { try {
labelService.removeLabel(l, user); labelService.removeLabel(l, user);

View File

@ -74,7 +74,7 @@ public class MindmapController extends BaseController {
} }
@RequestMapping(method = RequestMethod.GET, value = "/maps/", produces = {"application/json"}) @RequestMapping(method = RequestMethod.GET, value = "/maps/", produces = {"application/json"})
public RestMindmapList retrieveList(@RequestParam(required = false) String q) throws IOException { public RestMindmapList retrieveList(@RequestParam(required = false) String q) {
final User user = Utils.getUser(); final User user = Utils.getUser();
final MindmapFilter filter = MindmapFilter.parse(q); final MindmapFilter filter = MindmapFilter.parse(q);
@ -299,7 +299,7 @@ public class MindmapController extends BaseController {
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/collabs/", consumes = {"application/json"}, produces = {"application/json"}) @RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/collabs/", consumes = {"application/json"}, produces = {"application/json"})
@ResponseStatus(value = HttpStatus.NO_CONTENT) @ResponseStatus(value = HttpStatus.NO_CONTENT)
public void addCollab(@PathVariable int id, @NotNull @RequestBody RestCollaborationList restCollabs) throws CollaborationException, MapCouldNotFoundException, AccessDeniedSecurityException, InvalidEmailException, TooManyInactiveAccountsExceptions, CollabChangeException { public void addCollab(@PathVariable int id, @NotNull @RequestBody RestCollaborationList restCollabs) throws CollaborationException, MapCouldNotFoundException, AccessDeniedSecurityException, InvalidEmailException, TooManyInactiveAccountsExceptions, OwnerCannotChangeException {
final Mindmap mindMap = findMindmapById(id); final Mindmap mindMap = findMindmapById(id);
// Only owner can change collaborators... // Only owner can change collaborators...
@ -346,12 +346,12 @@ public class MindmapController extends BaseController {
// Are we trying to change the owner ... // Are we trying to change the owner ...
if (currentCollab != null && currentCollab.getRole() == CollaborationRole.OWNER) { if (currentCollab != null && currentCollab.getRole() == CollaborationRole.OWNER) {
throw new CollabChangeException(collabEmail); throw new OwnerCannotChangeException(collabEmail);
} }
// Role can not be changed ... // Role can not be changed ...
if (newRole == CollaborationRole.OWNER) { if (newRole == CollaborationRole.OWNER) {
throw new CollabChangeException(collabEmail); throw new OwnerCannotChangeException(collabEmail);
} }
// This is collaboration that with different newRole, try to change it ... // This is collaboration that with different newRole, try to change it ...
@ -462,6 +462,20 @@ public class MindmapController extends BaseController {
mindmapService.updateCollaboration(user, collaboration.get()); mindmapService.updateCollaboration(user, collaboration.get());
} }
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}/starred", produces = {"text/plain"})
@ResponseBody
public String fetchStarred(@PathVariable int id) throws WiseMappingException {
final Mindmap mindmap = findMindmapById(id);
final User user = Utils.getUser();
final Optional<Collaboration> collaboration = mindmap.findCollaboration(user);
if (!collaboration.isPresent()) {
throw new WiseMappingException("No enough permissions.");
}
boolean result = collaboration.get().getCollaborationProperties().getStarred();
return Boolean.toString(result);
}
@RequestMapping(method = RequestMethod.DELETE, value = "/maps/batch") @RequestMapping(method = RequestMethod.DELETE, value = "/maps/batch")
@ResponseStatus(value = HttpStatus.NO_CONTENT) @ResponseStatus(value = HttpStatus.NO_CONTENT)
public void batchDelete(@RequestParam() String ids) throws IOException, WiseMappingException { public void batchDelete(@RequestParam() String ids) throws IOException, WiseMappingException {

View File

@ -91,7 +91,7 @@ public class RestMindmapInfo {
public Set<RestLabel> getLabels() { public Set<RestLabel> getLabels() {
// Support test deserialization... // Support test deserialization...
Set<RestLabel> result = this.restLabels; Set<RestLabel> result = this.restLabels;
if(result==null) { if (result == null) {
final User me = Utils.getUser(); final User me = Utils.getUser();
result = mindmap.getLabels(). result = mindmap.getLabels().
stream() stream()
@ -108,7 +108,7 @@ public class RestMindmapInfo {
public int getId() { public int getId() {
int result = this.mapId; int result = this.mapId;
if(mapId==-1) { if (mapId == -1) {
result = mindmap.getId(); result = mindmap.getId();
} }
return result; return result;
@ -132,7 +132,9 @@ public class RestMindmapInfo {
} }
public String getRole() { public String getRole() {
final Optional<Collaboration> collaboration = mindmap.findCollaboration(Utils.getUser()); final User user = Utils.getUser();
String result;
final Optional<Collaboration> collaboration = mindmap.findCollaboration(user);
return collaboration.map(value -> value.getRole().getLabel()).orElse(ROLE_NONE); return collaboration.map(value -> value.getRole().getLabel()).orElse(ROLE_NONE);
} }

View File

@ -38,6 +38,7 @@ public class ViewBaseSecurityAdvise
@Override @Override
protected boolean isAllowed(@Nullable User user, Mindmap map) { protected boolean isAllowed(@Nullable User user, Mindmap map) {
System.out.println("VIEWWWWWWWWWWWWW");
return getMindmapService().hasPermissions(user, map, CollaborationRole.VIEWER); return getMindmapService().hasPermissions(user, map, CollaborationRole.VIEWER);
} }

View File

@ -68,6 +68,4 @@ public interface MindmapService {
LockManager getLockManager(); LockManager getLockManager();
boolean isAdmin(@Nullable User user); boolean isAdmin(@Nullable User user);
void purgeHistory(int mapId) throws IOException;
} }

View File

@ -91,11 +91,6 @@ public class MindmapServiceImpl
return user != null && user.getEmail() != null && user.getEmail().equals(adminUser); return user != null && user.getEmail() != null && user.getEmail().equals(adminUser);
} }
@Override
public void purgeHistory(int mapId) throws IOException {
mindmapManager.purgeHistory(mapId);
}
@Override @Override
public Mindmap getMindmapByTitle(String title, User user) { public Mindmap getMindmapByTitle(String title, User user) {
return mindmapManager.getMindmapByTitle(title, user); return mindmapManager.getMindmapByTitle(title, user);

View File

@ -24,7 +24,7 @@ public interface Messages {
String FIELD_REQUIRED = "FIELD_REQUIRED"; String FIELD_REQUIRED = "FIELD_REQUIRED";
String MAP_TITLE_ALREADY_EXISTS = "MAP_TITLE_ALREADY_EXISTS"; String MAP_TITLE_ALREADY_EXISTS = "MAP_TITLE_ALREADY_EXISTS";
String LABEL_TITLE_ALREADY_EXISTS = "LABEL_TITLE_ALREADY_EXISTS"; String LABEL_TITLE_ALREADY_EXISTS = "LABEL_TITLE_ALREADY_EXISTS";
String PASSWORD_MISMATCH = "PASSWORD_MISMATCH";
String CAPTCHA_LOADING_ERROR = "CAPTCHA_LOADING_ERROR"; String CAPTCHA_LOADING_ERROR = "CAPTCHA_LOADING_ERROR";
String CAPTCHA_TIMEOUT_OUT_DUPLICATE = "CAPTCHA_TIMEOUT_OUT_DUPLICATE"; String CAPTCHA_TIMEOUT_OUT_DUPLICATE = "CAPTCHA_TIMEOUT_OUT_DUPLICATE";

View File

@ -4,7 +4,6 @@ SITE.TITLE=WiseMapping
FIELD_REQUIRED=Ein benötigtes Feld kann icht leer gelassen werden FIELD_REQUIRED=Ein benötigtes Feld kann icht leer gelassen werden
EMAIL_ALREADY_EXIST=Die email Adresse existiert bereits. EMAIL_ALREADY_EXIST=Die email Adresse existiert bereits.
NO_VALID_EMAIL_ADDRESS=Ungültige email Adresse NO_VALID_EMAIL_ADDRESS=Ungültige email Adresse
PASSWORD_MISMATCH=Ihre Passwort Angaben sind nicht identisch
CREATOR=Urheber CREATOR=Urheber
WELCOME=Willkommen WELCOME=Willkommen
SHARE=Veröffentlichen SHARE=Veröffentlichen

View File

@ -5,7 +5,6 @@ FIELD_REQUIRED=Required field cannot be left blank
EMAIL_ALREADY_EXIST=There is an account already with this email. EMAIL_ALREADY_EXIST=There is an account already with this email.
NO_VALID_EMAIL_ADDRESS=Invalid email address NO_VALID_EMAIL_ADDRESS=Invalid email address
INVALID_EMAIL_ADDRESS=Invalid email address. Please, verify that your entered valid email address. INVALID_EMAIL_ADDRESS=Invalid email address. Please, verify that your entered valid email address.
PASSWORD_MISMATCH=Your password entries did not match
CREATOR=Creator CREATOR=Creator
WELCOME=Welcome WELCOME=Welcome
SHARE=Share SHARE=Share

View File

@ -4,7 +4,6 @@ SITE.TITLE = WiseMapping
FIELD_REQUIRED = Campo requerido FIELD_REQUIRED = Campo requerido
EMAIL_ALREADY_EXIST = E-mail ya existente. EMAIL_ALREADY_EXIST = E-mail ya existente.
NO_VALID_EMAIL_ADDRESS = E-mail invalido NO_VALID_EMAIL_ADDRESS = E-mail invalido
PASSWORD_MISMATCH = La contraseña no concuerda
CREATOR = Creador CREATOR = Creador
WELCOME = Bienvenido/a WELCOME = Bienvenido/a
SHARE = Compartir SHARE = Compartir

View File

@ -4,7 +4,6 @@ SITE.TITLE=WiseMapping
FIELD_REQUIRED=Ce champ ne peut pas rester vide FIELD_REQUIRED=Ce champ ne peut pas rester vide
EMAIL_ALREADY_EXIST=Cet email est déjà utilisé EMAIL_ALREADY_EXIST=Cet email est déjà utilisé
NO_VALID_EMAIL_ADDRESS=Email non valide NO_VALID_EMAIL_ADDRESS=Email non valide
PASSWORD_MISMATCH=Le mot de passe saisi ne correspond pas
CREATOR=Créateur CREATOR=Créateur
WELCOME=Bienvenue WELCOME=Bienvenue
SHARE=Partager SHARE=Partager

View File

@ -4,7 +4,6 @@ SITE.TITLE=WiseMapping
FIELD_REQUIRED=Это поле обязательно для заполненияю FIELD_REQUIRED=Это поле обязательно для заполненияю
EMAIL_ALREADY_EXIST=Аккаунт с таким e-mail уже существует. EMAIL_ALREADY_EXIST=Аккаунт с таким e-mail уже существует.
NO_VALID_EMAIL_ADDRESS=Некорректный адрес электронной почты. NO_VALID_EMAIL_ADDRESS=Некорректный адрес электронной почты.
PASSWORD_MISMATCH=Пароли не совпадают
CREATOR=Создатель CREATOR=Создатель
WELCOME=Добро пожаловать WELCOME=Добро пожаловать
SHARE=Поделиться SHARE=Поделиться

View File

@ -4,7 +4,6 @@ SITE.TITLE=WiseMapping
FIELD_REQUIRED=必填字段不能为空 FIELD_REQUIRED=必填字段不能为空
EMAIL_ALREADY_EXIST=已经有一个账号使用此电子邮件。 EMAIL_ALREADY_EXIST=已经有一个账号使用此电子邮件。
NO_VALID_EMAIL_ADDRESS=无效的电子邮件地址 NO_VALID_EMAIL_ADDRESS=无效的电子邮件地址
PASSWORD_MISMATCH=您输入的密码不一致
CREATOR=创建人 CREATOR=创建人
WELCOME=欢迎 WELCOME=欢迎
SHARE=分享 SHARE=分享

View File

@ -135,6 +135,6 @@
</welcome-file> </welcome-file>
</welcome-file-list> </welcome-file-list>
<session-config> <session-config>
<session-timeout>180</session-timeout> <session-timeout>1440</session-timeout>
</session-config> </session-config>
</web-app> </web-app>

View File

@ -14,6 +14,8 @@
<value>linkLabel</value> <value>linkLabel</value>
<value>find*</value> <value>find*</value>
<value>filter*</value> <value>filter*</value>
<!-- Remove can be performed in view only maps -->
<value>removeMindmap</value>
</list> </list>
</property> </property>
</bean> </bean>
@ -26,19 +28,18 @@
<value>save*</value> <value>save*</value>
<value>update*</value> <value>update*</value>
<value>add*</value> <value>add*</value>
<value>remove*</value>
<value>purge*</value>
<value>revert*</value> <value>revert*</value>
<value>removeCollaboration</value>
</list> </list>
</property> </property>
</bean> </bean>
<bean id="updateSecurityAdvice" class="com.wisemapping.security.aop.UpdateSecurityAdvise">
<property name="mindmapService" ref="mindmapService"/>
</bean>
<bean id="viewSecurityAdvice" class="com.wisemapping.security.aop.ViewBaseSecurityAdvise"> <bean id="viewSecurityAdvice" class="com.wisemapping.security.aop.ViewBaseSecurityAdvise">
<property name="mindmapService" ref="mindmapService"/> <property name="mindmapService" ref="mindmapService"/>
</bean> </bean>
<bean id="updateSecurityAdvice" class="com.wisemapping.security.aop.UpdateSecurityAdvise">
<property name="mindmapService" ref="mindmapService"/>
</bean>
</beans> </beans>

View File

@ -24,12 +24,14 @@
<prop key="hibernate.cache.use_second_level_cache">true</prop> <prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</prop> <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</prop>
<prop key="hibernate.default_batch_fetch_size">200</prop> <prop key="hibernate.default_batch_fetch_size">200</prop>
<prop key="hibernate.nestedTransactionAllowed">true</prop>
</props> </props>
</property> </property>
</bean> </bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager"> <bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
<property name="sessionFactory" ref="mindmapSessionFactory"/> <property name="sessionFactory" ref="mindmapSessionFactory"/>
<property name="nestedTransactionAllowed" value="true"/>
</bean> </bean>
<!-- Hibernate Template Definition --> <!-- Hibernate Template Definition -->

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,6 @@
/********************************************************************************/ /********************************************************************************/
/* Header & Toolbar Styles */ /* Header & Toolbar Styles */
/********************************************************************************/ /********************************************************************************/
@import "bootstrap.min.css";
body { body {
margin: 0; margin: 0;
font-family:Arial; font-family:Arial;
@ -57,20 +56,16 @@ div#mindplot {
align-items: stretch; align-items: stretch;
} }
div#position {
margin-top: 5px;
}
#position-button { #position-button {
cursor: pointer; cursor: pointer;
border: solid black 1px; border: solid white 1px;
width: 40px; width: 40px;
height: 40px; height: 40px;
background-position: center; background-position: center;
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 40px 40px; background-size: 40px 40px;
background-color: #FFF; background-color: #FFF;
border-radius: 8px;
padding: 0; padding: 0;
} }
@ -81,11 +76,12 @@ div#position {
#zoom-button { #zoom-button {
width: 40px; width: 40px;
border: 0; border: 0;
box-shadow: 0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12);
} }
#zoom-plus, #zoom-plus,
#zoom-minus { #zoom-minus {
border: solid black 1px; border: solid white 1px;
height: 40px; height: 40px;
width: 40px; width: 40px;
background-repeat: no-repeat; background-repeat: no-repeat;
@ -102,14 +98,6 @@ div#position {
vertical-align: middle; vertical-align: middle;
} }
#zoom-plus {
border-radius: 8px 8px 0 0;
}
#zoom-minus {
border-radius: 0 0 8px 8px;
}
div#footerLogo { div#footerLogo {
position: fixed; position: fixed;
display: list-item; display: list-item;

View File

@ -14,8 +14,9 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta charset="utf-8" /> <meta charset="utf-8" />
<base href="${requestScope['site.baseurl']}/static/webapp/"> <base href="${requestScope['site.baseurl']}/static/webapp/">
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;600&display=swap" rel="stylesheet" /> <link rel="preconnect" href="https://fonts.googleapis.com" crossorigin>
<link rel="stylesheet" media="print" onload="this.onload=null;this.removeAttribute('media');" href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;600&display=swap"/>
<%@ include file="/jsp/pageHeaders.jsf" %> <%@ include file="/jsp/pageHeaders.jsf" %>
@ -36,9 +37,9 @@
var mindmapLocked = ${mindmapLocked}; var mindmapLocked = ${mindmapLocked};
var mindmapLockedMsg = '<spring:message code="MINDMAP_LOCKED" arguments="${lockInfo.user.fullName},${lockInfo.user.email}"/>'; var mindmapLockedMsg = '<spring:message code="MINDMAP_LOCKED" arguments="${lockInfo.user.fullName},${lockInfo.user.email}"/>';
var userOptions = ${mindmap.properties}; var userOptions = ${mindmap.properties};
var accountName = '${principal.fullName}'; var accountName = '${fn:replace(principal.fullName,'\'','\\\'')}';
var accountEmail = '${principal.email}'; var accountEmail = '${principal.email}';
var mapTitle = '${mindmap.title}'; var mapTitle = '${fn:replace(mindmap.title,'\'','\\\'')}';
</script> </script>
</head> </head>

View File

@ -10,9 +10,14 @@
<meta name="viewport" content="initial-scale=1"> <meta name="viewport" content="initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<base href="${requestScope['site.baseurl']}/static/mindplot/"> <base href="${requestScope['site.baseurl']}/static/mindplot/">
<link rel="preconnect" href="https://fonts.googleapis.com" crossorigin>
<link rel="stylesheet" media="print" onload="this.onload=null;this.removeAttribute('media');" href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;600&display=swap"/>
<title>${mindmap.title} | <spring:message code="SITE.TITLE"/></title> <title>${mindmap.title} | <spring:message code="SITE.TITLE"/></title>
<link rel="stylesheet" href="../../css/viewonly.css"/> <link rel="stylesheet" href="../../css/viewonly.css"/>
<%@ include file="/jsp/pageHeaders.jsf" %> <%@ include file="/jsp/pageHeaders.jsf" %>
<script type="text/javascript"> <script type="text/javascript">
var mapId = '${mindmap.id}'; var mapId = '${mindmap.id}';
var historyId = '${hid}'; var historyId = '${hid}';
@ -20,6 +25,7 @@
var locale = '${locale}'; var locale = '${locale}';
var isAuth = ${principal != null}; var isAuth = ${principal != null};
</script> </script>
<c:if test="${requestScope['google.analytics.enabled']}"> <c:if test="${requestScope['google.analytics.enabled']}">
<!-- Global site tag (gtag.js) - Google Analytics --> <!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=${requestScope['google.analytics.account']}"></script> <script async src="https://www.googletagmanager.com/gtag/js?id=${requestScope['google.analytics.account']}"></script>
@ -34,6 +40,23 @@
</script> </script>
</c:if> </c:if>
<c:if test="${requestScope['google.analytics.enabled']}">
<!-- Google Ads Sense Config. Lazy loading optimization -->
<script type="text/javascript">
function downloadJsAtOnload() {
setTimeout(function downloadJs() {
var element = document.createElement("script");
element.setAttribute("data-ad-client", "ca-pub-4996113942657337");
element.async = true;
element.src = "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js";
document.body.appendChild(element);
}, 2000);
};
window.addEventListener("load", downloadJsAtOnload, false);
</script>
</c:if>
<style> <style>
body { body {
height: 100vh; height: 100vh;
@ -70,15 +93,15 @@
<div id="floating-panel"> <div id="floating-panel">
<div id="zoom-button"> <div id="zoom-button">
<button id="zoom-plus"> <button id="zoom-plus" title="Zoom Out">
<img src="../../images/add.svg" /> <img src="../../images/add.svg" width="24" height="24"/>
</button> </button>
<button id="zoom-minus"> <button id="zoom-minus" title="Zoom In">
<img src="../../images/minus.svg" /> <img src="../../images/minus.svg" width="24" height="24"/>
</button> </button>
<div id="position"> <div id="position">
<button id="position-button"> <button id="position-button" title="Center">
<img src="../../images/center_focus.svg" /> <img src="../../images/center_focus.svg" width="24" height="24"/>
</button> </button>
</div> </div>
</div> </div>

View File

@ -6,8 +6,10 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta charset="utf-8" /> <meta charset="utf-8" />
<base href="${requestScope['site.baseurl']}/static/webapp/"> <base href="${requestScope['site.baseurl']}/static/webapp/">
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;600&display=swap" rel="stylesheet" /> <link rel="preconnect" href="https://fonts.googleapis.com" crossorigin>
<link rel="stylesheet" media="print" onload="this.onload=null;this.removeAttribute('media');" href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;600&display=swap"/>
<%@ include file="/jsp/pageHeaders.jsf" %> <%@ include file="/jsp/pageHeaders.jsf" %>
<title>Loading | WiseMapping</title> <title>Loading | WiseMapping</title>
@ -23,8 +25,20 @@
</script> </script>
<c:if test="${requestScope['google.analytics.enabled']}"> <c:if test="${requestScope['google.analytics.enabled']}">
<!-- Google Ads Sense Config--> <!-- Google Ads Sense Config. Lazy loading optimization -->
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4996113942657337" crossorigin="anonymous"></script> <script type="text/javascript">
function downloadJsAtOnload() {
setTimeout(function downloadJs() {
var element = document.createElement("script");
element.setAttribute("data-ad-client", "ca-pub-4996113942657337");
element.async = true;
element.src = "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js";
document.body.appendChild(element);
}, 2000);
};
window.addEventListener("load", downloadJsAtOnload, false);
</script>
</c:if> </c:if>
</head> </head>

View File

@ -26,6 +26,7 @@ import java.util.stream.Stream;
import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestClientException;
import static com.wisemapping.test.rest.RestHelper.createHeaders;
import static org.testng.Assert.*; import static org.testng.Assert.*;
@Test @Test
@ -223,11 +224,11 @@ public class RestMindmapITCase {
template.put(resourceUrl, updateEntity); template.put(resourceUrl, updateEntity);
// Has been updated ?. // Has been updated ?.
final String mapId = mapUri.getPath().replace("/service/maps/", "");
Optional<RestMindmapInfo> mindmapInfo = fetchMap(requestHeaders, template, mapId);
// @todo: Enforce check... final HttpEntity findLabelEntity = new HttpEntity(createHeaders(MediaType.TEXT_PLAIN));
// assertTrue(mindmapInfo.get().getStarred() == true); final ResponseEntity<String> response = template.exchange(resourceUrl, HttpMethod.GET, findLabelEntity, String.class);
assertTrue(Boolean.parseBoolean(response.getBody()), "Starred has been updated");
} }
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function") @Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")