mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-26 07:44:56 +01:00
Fix toolbar title bug
Add properties peer user.
This commit is contained in:
parent
c73934aadf
commit
521111fac2
@ -47,7 +47,7 @@ div#headerActions a {
|
|||||||
}
|
}
|
||||||
|
|
||||||
div#headerMapTitle {
|
div#headerMapTitle {
|
||||||
width: 200px;
|
min-width: 200px;
|
||||||
height:@header-info-height - 13;
|
height:@header-info-height - 13;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
padding-top: 13px;
|
padding-top: 13px;
|
||||||
@ -65,6 +65,7 @@ div#headerMapTitle span {
|
|||||||
-webkit-border-radius: 3px;
|
-webkit-border-radius: 3px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);
|
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);
|
||||||
|
white-space:nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
div#headerNotifier {
|
div#headerNotifier {
|
||||||
|
@ -27,13 +27,13 @@ public interface MindmapManager {
|
|||||||
|
|
||||||
Collaborator getCollaboratorBy(@NotNull String email);
|
Collaborator getCollaboratorBy(@NotNull String email);
|
||||||
|
|
||||||
Collaborator getCollaboratorBy(long id);
|
Collaborator findCollaborator(long id);
|
||||||
|
|
||||||
List<Collaboration> getMindmapUserByCollaborator(final long collaboratorId);
|
List<Collaboration> findCollaboration(final long collaboratorId);
|
||||||
|
|
||||||
List<Collaboration> getMindmapUserByRole(final CollaborationRole userRole);
|
List<Collaboration> findCollaboration(final CollaborationRole userRole);
|
||||||
|
|
||||||
Collaboration getMindmapUserBy(final int mindmapId, final User user);
|
Collaboration findCollaboration(final int mindmapId, final User user);
|
||||||
|
|
||||||
List<MindMap> getAllMindmaps();
|
List<MindMap> getAllMindmaps();
|
||||||
|
|
||||||
|
@ -109,25 +109,25 @@ public class MindmapManagerImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collaborator getCollaboratorBy(long id) {
|
public Collaborator findCollaborator(long id) {
|
||||||
return getHibernateTemplate().get(Collaborator.class, id);
|
return getHibernateTemplate().get(Collaborator.class, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Collaboration> getMindmapUserByCollaborator(final long colaboratorId) {
|
public List<Collaboration> findCollaboration(final long collaboratorId) {
|
||||||
return getHibernateTemplate().find("from com.wisemapping.model.Collaboration mindmapUser where colaborator_id=?", colaboratorId);
|
return getHibernateTemplate().find("from com.wisemapping.model.Collaboration collaboration where colaborator_id=?", collaboratorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Collaboration> getMindmapUserByRole(final CollaborationRole collaborationRole) {
|
public List<Collaboration> findCollaboration(final CollaborationRole collaborationRole) {
|
||||||
return getHibernateTemplate().find("from com.wisemapping.model.Collaboration mindmapUser where roleId=?", collaborationRole.ordinal());
|
return getHibernateTemplate().find("from com.wisemapping.model.Collaboration collaboration where roleId=?", collaborationRole.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collaboration getMindmapUserBy(final int mindmapId, final User user) {
|
public Collaboration findCollaboration(final int mindmapId, final User user) {
|
||||||
final Collaboration result;
|
final Collaboration result;
|
||||||
|
|
||||||
final List<Collaboration> mindMaps = getHibernateTemplate().find("from com.wisemapping.model.Collaboration mindmapUser where mindMap.id=? and colaborator_id=?", new Object[]{mindmapId, user.getId()});
|
final List<Collaboration> mindMaps = getHibernateTemplate().find("from com.wisemapping.model.Collaboration collaboration where mindMap.id=? and colaborator_id=?", new Object[]{mindmapId, user.getId()});
|
||||||
if (mindMaps != null && !mindMaps.isEmpty()) {
|
if (mindMaps != null && !mindMaps.isEmpty()) {
|
||||||
result = mindMaps.get(0);
|
result = mindMaps.get(0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -82,8 +82,14 @@ public class Collaboration {
|
|||||||
this.collaborator = collaborator;
|
this.collaborator = collaborator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
public CollaborationProperties getCollaborationProperties() {
|
public CollaborationProperties getCollaborationProperties() {
|
||||||
return collaborationProperties;
|
CollaborationProperties result = collaborationProperties;
|
||||||
|
if (result == null) {
|
||||||
|
collaborationProperties = new CollaborationProperties();
|
||||||
|
result = collaborationProperties;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCollaborationProperties(@NotNull CollaborationProperties collaborationProperties) {
|
public void setCollaborationProperties(@NotNull CollaborationProperties collaborationProperties) {
|
||||||
|
@ -18,11 +18,15 @@
|
|||||||
|
|
||||||
package com.wisemapping.model;
|
package com.wisemapping.model;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class CollaborationProperties {
|
public class CollaborationProperties {
|
||||||
|
private static final String DEFAULT_JSON_PROPERTIES = "{zoom:0.8}";
|
||||||
private int id;
|
private int id;
|
||||||
private boolean starred;
|
private boolean starred;
|
||||||
|
private String mindmapProperties;
|
||||||
|
|
||||||
public CollaborationProperties(){
|
public CollaborationProperties() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,4 +45,13 @@ public class CollaborationProperties {
|
|||||||
public void setId(int id) {
|
public void setId(int id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public String getMindmapProperties() {
|
||||||
|
return mindmapProperties == null ? DEFAULT_JSON_PROPERTIES : mindmapProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMindmapProperties(@NotNull String mindmapProperties) {
|
||||||
|
this.mindmapProperties = mindmapProperties;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,21 +92,6 @@ public class MindMap {
|
|||||||
this.xml = ZipUtils.zipToString(xml).getBytes(UTF_8);
|
this.xml = ZipUtils.zipToString(xml).getBytes(UTF_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProperties(String properties) {
|
|
||||||
this.properties = properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProperties() {
|
|
||||||
String ret;
|
|
||||||
if (properties == null) {
|
|
||||||
ret = "{zoom:0.85,saveOnLoad:true}";
|
|
||||||
} else {
|
|
||||||
ret = properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<Collaboration> getCollaborations() {
|
public Set<Collaboration> getCollaborations() {
|
||||||
return collaborations;
|
return collaborations;
|
||||||
}
|
}
|
||||||
@ -237,6 +222,12 @@ public class MindMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setStarred(@NotNull Collaborator collaborator, boolean value) throws WiseMappingException {
|
public void setStarred(@NotNull Collaborator collaborator, boolean value) throws WiseMappingException {
|
||||||
|
final CollaborationProperties collaborationProperties = getCollaborationProperties(collaborator);
|
||||||
|
collaborationProperties.setStarred(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public CollaborationProperties getCollaborationProperties(@NotNull Collaborator collaborator) throws WiseMappingException {
|
||||||
if (collaborator == null) {
|
if (collaborator == null) {
|
||||||
throw new IllegalStateException("Collaborator can not be null");
|
throw new IllegalStateException("Collaborator can not be null");
|
||||||
}
|
}
|
||||||
@ -245,11 +236,7 @@ public class MindMap {
|
|||||||
if (collaboration == null) {
|
if (collaboration == null) {
|
||||||
throw new WiseMappingException("User is not collaborator");
|
throw new WiseMappingException("User is not collaborator");
|
||||||
}
|
}
|
||||||
|
return collaboration.getCollaborationProperties();
|
||||||
if (collaboration.getCollaborationProperties() == null) {
|
|
||||||
collaboration.setCollaborationProperties(new CollaborationProperties());
|
|
||||||
}
|
|
||||||
collaboration.getCollaborationProperties().setStarred(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isStarred(@NotNull Collaborator collaborator) {
|
public boolean isStarred(@NotNull Collaborator collaborator) {
|
||||||
@ -271,7 +258,6 @@ public class MindMap {
|
|||||||
final MindMap result = new MindMap();
|
final MindMap result = new MindMap();
|
||||||
result.setDescription(this.getDescription());
|
result.setDescription(this.getDescription());
|
||||||
result.setTitle(this.getTitle());
|
result.setTitle(this.getTitle());
|
||||||
result.setProperties(this.getProperties());
|
|
||||||
result.setXml(this.getXml());
|
result.setXml(this.getXml());
|
||||||
result.setTags(this.getTags());
|
result.setTags(this.getTags());
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ public class MindmapController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private MindMapBean findMindmapBean(long mapId) {
|
private MindMapBean findMindmapBean(long mapId) {
|
||||||
return new MindMapBean(findMindmap(mapId));
|
return new MindMapBean(findMindmap(mapId), Utils.getUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isWelcomeMap(MindMapBean map) {
|
private boolean isWelcomeMap(MindMapBean map) {
|
||||||
|
@ -21,6 +21,7 @@ package com.wisemapping.rest;
|
|||||||
import com.wisemapping.rest.model.RestErrors;
|
import com.wisemapping.rest.model.RestErrors;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.context.support.ResourceBundleMessageSource;
|
import org.springframework.context.support.ResourceBundleMessageSource;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
@ -29,6 +30,7 @@ import org.springframework.web.bind.annotation.ResponseStatus;
|
|||||||
|
|
||||||
public class BaseController {
|
public class BaseController {
|
||||||
|
|
||||||
|
@Qualifier("messageSource")
|
||||||
@Autowired
|
@Autowired
|
||||||
private ResourceBundleMessageSource messageSource;
|
private ResourceBundleMessageSource messageSource;
|
||||||
|
|
||||||
@ -36,6 +38,7 @@ public class BaseController {
|
|||||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public RestErrors handleClientErrors(@NotNull IllegalArgumentException ex) {
|
public RestErrors handleClientErrors(@NotNull IllegalArgumentException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
return new RestErrors(ex.getMessage());
|
return new RestErrors(ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ public class MindmapController extends BaseController {
|
|||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser();
|
||||||
|
|
||||||
final MindmapFilter filter = MindmapFilter.parse(q);
|
final MindmapFilter filter = MindmapFilter.parse(q);
|
||||||
final List<Collaboration> collaborations = mindmapService.findCollaborationsBy(user);
|
final List<Collaboration> collaborations = mindmapService.findCollaborations(user);
|
||||||
|
|
||||||
final List<MindMap> mindmaps = new ArrayList<MindMap>();
|
final List<MindMap> mindmaps = new ArrayList<MindMap>();
|
||||||
for (Collaboration collaboration : collaborations) {
|
for (Collaboration collaboration : collaborations) {
|
||||||
@ -125,7 +125,7 @@ public class MindmapController extends BaseController {
|
|||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void updateDocument(@RequestBody RestMindmap restMindmap, @PathVariable int id, @RequestParam(required = false) boolean minor) throws IOException, WiseMappingException {
|
public void updateDocument(@RequestBody RestMindmap restMindmap, @PathVariable int id, @RequestParam(required = false) boolean minor) throws IOException, WiseMappingException {
|
||||||
|
|
||||||
final MindMap mindMap = mindmapService.findMindmapById(id);
|
final MindMap mindmap = mindmapService.findMindmapById(id);
|
||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser();
|
||||||
|
|
||||||
// Validate arguments ...
|
// Validate arguments ...
|
||||||
@ -133,17 +133,20 @@ public class MindmapController extends BaseController {
|
|||||||
if (properties == null) {
|
if (properties == null) {
|
||||||
throw new IllegalArgumentException("Map properties can not be null");
|
throw new IllegalArgumentException("Map properties can not be null");
|
||||||
}
|
}
|
||||||
mindMap.setProperties(properties);
|
|
||||||
|
// Update collaboration properties ...
|
||||||
|
final CollaborationProperties collaborationProperties = mindmap.getCollaborationProperties(user);
|
||||||
|
collaborationProperties.setMindmapProperties(properties);
|
||||||
|
|
||||||
// Validate content ...
|
// Validate content ...
|
||||||
final String xml = restMindmap.getXml();
|
final String xml = restMindmap.getXml();
|
||||||
if (xml == null) {
|
if (xml == null) {
|
||||||
throw new IllegalArgumentException("Map xml can not be null");
|
throw new IllegalArgumentException("Map xml can not be null");
|
||||||
}
|
}
|
||||||
mindMap.setXmlStr(xml);
|
mindmap.setXmlStr(xml);
|
||||||
|
|
||||||
// Update map ...
|
// Update map ...
|
||||||
saveMindmap(minor, mindMap, user);
|
saveMindmap(minor, mindmap, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -153,41 +156,43 @@ public class MindmapController extends BaseController {
|
|||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void update(@RequestBody RestMindmap restMindmap, @PathVariable int id, @RequestParam(required = false) boolean minor) throws IOException, WiseMappingException {
|
public void update(@RequestBody RestMindmap restMindmap, @PathVariable int id, @RequestParam(required = false) boolean minor) throws IOException, WiseMappingException {
|
||||||
|
|
||||||
final MindMap mindMap = mindmapService.findMindmapById(id);
|
final MindMap mindmap = mindmapService.findMindmapById(id);
|
||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser();
|
||||||
|
|
||||||
// Update document properties ...
|
|
||||||
final String properties = restMindmap.getProperties();
|
|
||||||
if (properties != null) {
|
|
||||||
mindMap.setProperties(properties);
|
|
||||||
}
|
|
||||||
final String xml = restMindmap.getXml();
|
final String xml = restMindmap.getXml();
|
||||||
if (xml != null) {
|
if (xml != null) {
|
||||||
mindMap.setXmlStr(xml);
|
mindmap.setXmlStr(xml);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update title ...
|
// Update title ...
|
||||||
final String title = restMindmap.getTitle();
|
final String title = restMindmap.getTitle();
|
||||||
if (title != null && !title.equals(mindMap.getTitle())) {
|
if (title != null && !title.equals(mindmap.getTitle())) {
|
||||||
if (mindmapService.getMindmapByTitle(title, user) != null) {
|
if (mindmapService.getMindmapByTitle(title, user) != null) {
|
||||||
throw buildValidationException("title", "You already have a map with this title");
|
throw buildValidationException("title", "You already have a map with this title");
|
||||||
}
|
}
|
||||||
mindMap.setTitle(title);
|
mindmap.setTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update description ...
|
// Update description ...
|
||||||
final String description = restMindmap.getDescription();
|
final String description = restMindmap.getDescription();
|
||||||
if (description != null) {
|
if (description != null) {
|
||||||
mindMap.setDescription(description);
|
mindmap.setDescription(description);
|
||||||
}
|
}
|
||||||
|
|
||||||
final String tags = restMindmap.getTags();
|
final String tags = restMindmap.getTags();
|
||||||
if (tags != null) {
|
if (tags != null) {
|
||||||
mindMap.setTags(tags);
|
mindmap.setTags(tags);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update document properties ...
|
||||||
|
final String properties = restMindmap.getProperties();
|
||||||
|
if (properties != null) {
|
||||||
|
final CollaborationProperties collaborationProperties = mindmap.getCollaborationProperties(user);
|
||||||
|
collaborationProperties.setMindmapProperties(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update map ...
|
// Update map ...
|
||||||
saveMindmap(minor, mindMap, user);
|
saveMindmap(minor, mindmap, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ public class RestErrors {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public RestErrors(@NotNull String errorMsg) {
|
public RestErrors(@NotNull String errorMsg) {
|
||||||
|
globalErrors = new ArrayList<String>();
|
||||||
globalErrors.add(errorMsg);
|
globalErrors.add(errorMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,9 +69,11 @@ public class RestErrors {
|
|||||||
|
|
||||||
public Map<String, String> getFieldErrors() {
|
public Map<String, String> getFieldErrors() {
|
||||||
final Map<String, String> result = new HashMap<String, String>();
|
final Map<String, String> result = new HashMap<String, String>();
|
||||||
final List<FieldError> fieldErrors = errors.getFieldErrors();
|
if (errors != null) {
|
||||||
for (FieldError fieldError : fieldErrors) {
|
final List<FieldError> fieldErrors = errors.getFieldErrors();
|
||||||
result.put(fieldError.getField(), messageSource.getMessage(fieldError, Locale.ENGLISH));
|
for (FieldError fieldError : fieldErrors) {
|
||||||
|
result.put(fieldError.getField(), messageSource.getMessage(fieldError, Locale.ENGLISH));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,8 @@ package com.wisemapping.rest.model;
|
|||||||
|
|
||||||
|
|
||||||
import com.wisemapping.exceptions.WiseMappingException;
|
import com.wisemapping.exceptions.WiseMappingException;
|
||||||
import com.wisemapping.model.Collaborator;
|
import com.wisemapping.model.*;
|
||||||
import com.wisemapping.model.MindMap;
|
import com.wisemapping.security.Utils;
|
||||||
import com.wisemapping.model.User;
|
|
||||||
import org.codehaus.jackson.annotate.*;
|
import org.codehaus.jackson.annotate.*;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@ -32,22 +31,28 @@ public class RestMindmap {
|
|||||||
private MindMap mindmap;
|
private MindMap mindmap;
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
static private SimpleDateFormat sdf;
|
static private SimpleDateFormat sdf;
|
||||||
|
private String properties;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
||||||
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
|
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public RestMindmap() {
|
public RestMindmap() throws WiseMappingException {
|
||||||
this(new MindMap(), null);
|
this(new MindMap(), null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public RestMindmap(@NotNull MindMap mindmap, @Nullable Collaborator collaborator) {
|
public RestMindmap(@NotNull MindMap mindmap, @Nullable Collaborator collaborator) throws WiseMappingException {
|
||||||
this.mindmap = mindmap;
|
this.mindmap = mindmap;
|
||||||
this.collaborator = collaborator;
|
this.collaborator = collaborator;
|
||||||
|
if (collaborator != null) {
|
||||||
|
final CollaborationProperties collaborationProperties = mindmap.getCollaborationProperties(collaborator);
|
||||||
|
this.properties = collaborationProperties.getMindmapProperties();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getCreationTime() {
|
public String getCreationTime() {
|
||||||
final Calendar creationTime = mindmap.getCreationTime();
|
final Calendar creationTime = mindmap.getCreationTime();
|
||||||
String result = null;
|
String result = null;
|
||||||
@ -139,8 +144,8 @@ public class RestMindmap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setProperties(String properties) {
|
public void setProperties(@Nullable String properties) {
|
||||||
mindmap.setProperties(properties);
|
this.properties = properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLastModificationTime(final String value) {
|
public void setLastModificationTime(final String value) {
|
||||||
@ -150,7 +155,7 @@ public class RestMindmap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getProperties() {
|
public String getProperties() {
|
||||||
return mindmap.getProperties();
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getStarred() {
|
public boolean getStarred() {
|
||||||
|
@ -34,7 +34,7 @@ public interface MindmapService {
|
|||||||
|
|
||||||
public MindMap getMindmapByTitle(String title, User user);
|
public MindMap getMindmapByTitle(String title, User user);
|
||||||
|
|
||||||
public List<Collaboration> findCollaborationsBy(@NotNull User user);
|
public List<Collaboration> findCollaborations(@NotNull User user);
|
||||||
|
|
||||||
public void updateMindmap(MindMap mindMap, boolean saveHistory) throws WiseMappingException;
|
public void updateMindmap(MindMap mindMap, boolean saveHistory) throws WiseMappingException;
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ public interface MindmapService {
|
|||||||
public void addCollaboration(@NotNull MindMap mindmap, @NotNull String email, @NotNull CollaborationRole role, @Nullable String message)
|
public void addCollaboration(@NotNull MindMap mindmap, @NotNull String email, @NotNull CollaborationRole role, @Nullable String message)
|
||||||
throws CollaborationException;
|
throws CollaborationException;
|
||||||
|
|
||||||
public void removeCollaboration(@NotNull MindMap mindmap, @NotNull Collaboration collaboration) throws CollaborationException;
|
public void removeCollaboration(@NotNull MindMap mindmap, @NotNull Collaboration collaboration) throws CollaborationException;
|
||||||
|
|
||||||
public void addTags(@NotNull MindMap mindmap, String tags);
|
public void addTags(@NotNull MindMap mindmap, String tags);
|
||||||
|
|
||||||
|
@ -78,8 +78,8 @@ public class MindmapServiceImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Collaboration> findCollaborationsBy(@NotNull User user) {
|
public List<Collaboration> findCollaborations(@NotNull User user) {
|
||||||
return mindmapManager.getMindmapUserByCollaborator(user.getId());
|
return mindmapManager.findCollaboration(user.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -18,45 +18,46 @@
|
|||||||
|
|
||||||
package com.wisemapping.view;
|
package com.wisemapping.view;
|
||||||
|
|
||||||
import com.wisemapping.model.Collaboration;
|
import com.wisemapping.exceptions.WiseMappingException;
|
||||||
import com.wisemapping.model.CollaborationRole;
|
import com.wisemapping.model.*;
|
||||||
import com.wisemapping.model.MindMap;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import com.wisemapping.model.User;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import com.wisemapping.security.Utils;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class MindMapBean {
|
public class MindMapBean {
|
||||||
private MindMap mindMap;
|
private MindMap mindmap;
|
||||||
private List<CollaboratorBean> viewers;
|
private List<CollaboratorBean> viewers;
|
||||||
private List<CollaboratorBean> collaborators;
|
private List<CollaboratorBean> collaborators;
|
||||||
|
private Collaborator collaborator;
|
||||||
|
|
||||||
public MindMapBean(final MindMap mindmap) {
|
public MindMapBean(@NotNull final MindMap mindmap, @Nullable final Collaborator collaborator) {
|
||||||
this.mindMap = mindmap;
|
this.mindmap = mindmap;
|
||||||
|
this.collaborator = collaborator;
|
||||||
this.collaborators = filterCollaboratorBy(mindmap.getCollaborations(), CollaborationRole.EDITOR);
|
this.collaborators = filterCollaboratorBy(mindmap.getCollaborations(), CollaborationRole.EDITOR);
|
||||||
this.viewers = filterCollaboratorBy(mindmap.getCollaborations(), CollaborationRole.VIEWER);
|
this.viewers = filterCollaboratorBy(mindmap.getCollaborations(), CollaborationRole.VIEWER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getPublic() {
|
public boolean getPublic() {
|
||||||
return mindMap.isPublic();
|
return mindmap.isPublic();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return mindMap.getTitle();
|
return mindmap.getTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return mindMap.getDescription();
|
return mindmap.getDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return mindMap.getId();
|
return mindmap.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isStarred() {
|
public boolean isStarred() {
|
||||||
return mindMap.isStarred(Utils.getUser());
|
return mindmap.isStarred(collaborator);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CollaboratorBean> getViewers() {
|
public List<CollaboratorBean> getViewers() {
|
||||||
@ -68,19 +69,19 @@ public class MindMapBean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getLastEditor() {
|
public String getLastEditor() {
|
||||||
return mindMap.getLastModifierUser();
|
return mindmap.getLastModifierUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLastEditTime() {
|
public String getLastEditTime() {
|
||||||
return DateFormat.getInstance().format(mindMap.getLastModificationTime().getTime());
|
return DateFormat.getInstance().format(mindmap.getLastModificationTime().getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCreationTime() {
|
public String getCreationTime() {
|
||||||
return DateFormat.getInstance().format(mindMap.getCreationTime().getTime());
|
return DateFormat.getInstance().format(mindmap.getCreationTime().getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTags() {
|
public String getTags() {
|
||||||
return mindMap.getTags();
|
return mindmap.getTags();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<CollaboratorBean> filterCollaboratorBy(Set<Collaboration> source, CollaborationRole role) {
|
private List<CollaboratorBean> filterCollaboratorBy(Set<Collaboration> source, CollaborationRole role) {
|
||||||
@ -112,35 +113,36 @@ public class MindMapBean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setTitle(String t) {
|
public void setTitle(String t) {
|
||||||
mindMap.setTitle(t);
|
mindmap.setTitle(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(String d) {
|
public void setDescription(String d) {
|
||||||
mindMap.setDescription(d);
|
mindmap.setDescription(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getXmlAsJsLiteral() throws IOException {
|
public String getXmlAsJsLiteral() throws IOException {
|
||||||
return this.mindMap.getXmlAsJsLiteral();
|
return this.mindmap.getXmlAsJsLiteral();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProperties() {
|
public String getProperties() throws WiseMappingException {
|
||||||
return this.mindMap.getProperties();
|
final CollaborationProperties collaboration = this.mindmap.getCollaborationProperties(collaborator);
|
||||||
|
return collaboration.getMindmapProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getCreator() {
|
public User getCreator() {
|
||||||
return mindMap.getCreator();
|
return mindmap.getCreator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOwner() {
|
public boolean isOwner() {
|
||||||
return mindMap.hasPermissions(Utils.getUser(), CollaborationRole.OWNER);
|
return mindmap.hasPermissions(collaborator, CollaborationRole.OWNER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEditor() {
|
public boolean isEditor() {
|
||||||
return mindMap.hasPermissions(Utils.getUser(), CollaborationRole.EDITOR);
|
return mindmap.hasPermissions(collaborator, CollaborationRole.EDITOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MindMap getDelegated(){
|
public MindMap getDelegated() {
|
||||||
return mindMap;
|
return mindmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
<id name="id">
|
<id name="id">
|
||||||
<generator class="increment"/>
|
<generator class="increment"/>
|
||||||
</id>
|
</id>
|
||||||
|
<property name="mindmapProperties" column="mindmap_properties" unique="false" not-null="false"/>
|
||||||
<property name="starred" column="starred" unique="false" not-null="true"/>
|
<property name="starred" column="starred" unique="false" not-null="true"/>
|
||||||
</class>
|
</class>
|
||||||
|
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
<property name="lastModificationTime" column="edition_date"/>
|
<property name="lastModificationTime" column="edition_date"/>
|
||||||
<property name="creationTime" column="creation_date"/>
|
<property name="creationTime" column="creation_date"/>
|
||||||
<property name="tags" column="tags"/>
|
<property name="tags" column="tags"/>
|
||||||
<property name="properties" column="editor_properties"/>
|
|
||||||
|
|
||||||
<many-to-one name="creator" column="creator_id" unique="true" not-null="true"/>
|
<many-to-one name="creator" column="creator_id" unique="true" not-null="true"/>
|
||||||
|
|
||||||
<set name="collaborations"
|
<set name="collaborations"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
log4j.rootLogger=WARN, stdout, R
|
log4j.rootLogger=WARN, stdout, R
|
||||||
log4j.logger.com.wisemapping=WARN,stdout,R
|
log4j.logger.com.wisemapping=WARN,stdout,R
|
||||||
log4j.logger.org.springframework=DEBUG,stdout,R
|
log4j.logger.org.springframework=WARN,stdout,R
|
||||||
log4j.logger.org.codehaus.jackson=WARN,stdout,R
|
log4j.logger.org.codehaus.jackson=WARN,stdout,R
|
||||||
log4j.additivity.org.hibernate.SQL=false
|
log4j.additivity.org.hibernate.SQL=false
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
<spring:message code="LOGOUT"/>
|
<spring:message code="LOGOUT"/>
|
||||||
</a></span>
|
</a></span>
|
||||||
</div>
|
</div>
|
||||||
<a href="${pageContext.request.contextPath}/c/maps/">
|
<a href="c/maps/">
|
||||||
<div id="headerLogo"></div>
|
<div id="headerLogo"></div>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@ edition_date DATETIME,
|
|||||||
creator_id INTEGER NOT NULL,
|
creator_id INTEGER NOT NULL,
|
||||||
tags varchar(1014) ,
|
tags varchar(1014) ,
|
||||||
last_editor varchar(255) ,
|
last_editor varchar(255) ,
|
||||||
editor_properties varchar(512)
|
|
||||||
--FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id)
|
--FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -40,13 +39,14 @@ creator_user varchar(255));
|
|||||||
|
|
||||||
CREATE TABLE COLLABORATION_PROPERTIES
|
CREATE TABLE COLLABORATION_PROPERTIES
|
||||||
(id INTEGER NOT NULL IDENTITY,
|
(id INTEGER NOT NULL IDENTITY,
|
||||||
starred BOOLEAN NOT NULL
|
starred BOOLEAN NOT NULL,
|
||||||
|
mindmap_properties varchar(512)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE COLLABORATION
|
CREATE TABLE COLLABORATION
|
||||||
(id INTEGER NOT NULL IDENTITY,
|
(id INTEGER NOT NULL IDENTITY,
|
||||||
colaborator_id INTEGER NOT NULL,
|
colaborator_id INTEGER NOT NULL,
|
||||||
properties_id INTEGER,
|
properties_id INTEGER NOT NULL,
|
||||||
mindmap_id INTEGER NOT NULL,
|
mindmap_id INTEGER NOT NULL,
|
||||||
role_id INTEGER NOT NULL,
|
role_id INTEGER NOT NULL,
|
||||||
FOREIGN KEY(colaborator_id) REFERENCES COLABORATOR(id),
|
FOREIGN KEY(colaborator_id) REFERENCES COLABORATOR(id),
|
||||||
|
@ -28,7 +28,6 @@ edition_date datetime,
|
|||||||
creator_id INTEGER not null,
|
creator_id INTEGER not null,
|
||||||
tags varchar(1014) CHARACTER SET utf8 ,
|
tags varchar(1014) CHARACTER SET utf8 ,
|
||||||
last_editor varchar(255) CHARACTER SET utf8 ,
|
last_editor varchar(255) CHARACTER SET utf8 ,
|
||||||
editor_properties varchar(512) CHARACTER SET utf8 ,
|
|
||||||
FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id)
|
FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id)
|
||||||
) CHARACTER SET utf8 ;
|
) CHARACTER SET utf8 ;
|
||||||
|
|
||||||
@ -43,7 +42,8 @@ creator_user varchar(255) CHARACTER SET utf8
|
|||||||
|
|
||||||
CREATE TABLE COLLABORATION_PROPERTIES(
|
CREATE TABLE COLLABORATION_PROPERTIES(
|
||||||
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
starred BOOL NOT NULL default 0
|
starred BOOL NOT NULL default 0,
|
||||||
|
mindmap_properties varchar(512) CHARACTER SET utf8
|
||||||
) CHARACTER SET utf8;
|
) CHARACTER SET utf8;
|
||||||
|
|
||||||
CREATE TABLE COLLABORATION (
|
CREATE TABLE COLLABORATION (
|
||||||
|
Loading…
Reference in New Issue
Block a user