- Add support for starred.
- Remove tags temporally.
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.wisemapping.model;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class CollaboratorProperties {
|
||||
private long id;
|
||||
private boolean starred;
|
||||
private Collaborator collaborator;
|
||||
private MindMap mindmap;
|
||||
|
||||
|
||||
public CollaboratorProperties(@NotNull Collaborator collaborator, @NotNull MindMap mindmap) {
|
||||
this.collaborator = collaborator;
|
||||
this.mindmap = mindmap;
|
||||
}
|
||||
|
||||
public CollaboratorProperties(){
|
||||
|
||||
}
|
||||
|
||||
public boolean getStarred() {
|
||||
return starred;
|
||||
}
|
||||
|
||||
public void setStarred(boolean starred) {
|
||||
this.starred = starred;
|
||||
}
|
||||
public Collaborator getCollaborator() {
|
||||
return collaborator;
|
||||
}
|
||||
|
||||
public void setCollaborator(Collaborator collaborator) {
|
||||
this.collaborator = collaborator;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public MindMap getMindmap() {
|
||||
return mindmap;
|
||||
}
|
||||
|
||||
public void setMindmap(@NotNull MindMap mindmap) {
|
||||
this.mindmap = mindmap;
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,6 @@
|
||||
package com.wisemapping.model;
|
||||
|
||||
import com.wisemapping.util.ZipUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -33,17 +32,18 @@ public class MindMap {
|
||||
private static final String UTF_8 = "UTF-8";
|
||||
|
||||
//~ Instance fields ......................................................................................
|
||||
|
||||
private int id;
|
||||
private Calendar creationTime;
|
||||
private String creator;
|
||||
private String description;
|
||||
|
||||
private int id;
|
||||
private boolean isPublic;
|
||||
private Calendar lastModificationTime;
|
||||
private String lastModifierUser;
|
||||
|
||||
private Set<MindmapUser> mindmapUsers = new HashSet<MindmapUser>();
|
||||
private Set<CollaboratorProperties> collaboratorProperties = new HashSet<CollaboratorProperties>();
|
||||
|
||||
private User owner;
|
||||
private String properties;
|
||||
private String tags;
|
||||
@@ -86,7 +86,7 @@ public class MindMap {
|
||||
throws IOException {
|
||||
byte[] result = this.xml;
|
||||
if (result != null) {
|
||||
result = ZipUtils.stringToZip(new String(result, UTF_8));
|
||||
result = ZipUtils.stringToZip(new String(result, UTF_8));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -219,6 +219,41 @@ public class MindMap {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public Set<CollaboratorProperties> getCollaboratorProperties() {
|
||||
return collaboratorProperties;
|
||||
}
|
||||
|
||||
public void setCollaboratorProperties(@NotNull Set<CollaboratorProperties> collaboratorProperties) {
|
||||
this.collaboratorProperties = collaboratorProperties;
|
||||
}
|
||||
|
||||
private CollaboratorProperties findUserProperty(@NotNull Collaborator collaborator) {
|
||||
final Set<CollaboratorProperties> collaboratorProperties = this.getCollaboratorProperties();
|
||||
CollaboratorProperties result = null;
|
||||
for (CollaboratorProperties collaboratorProperty : collaboratorProperties) {
|
||||
final Collaborator propCollab = collaboratorProperty.getCollaborator();
|
||||
if (propCollab != null && propCollab.getEmail().equals(collaborator.getEmail())) {
|
||||
result = collaboratorProperty;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setStarred(@NotNull Collaborator collaborator, boolean value) {
|
||||
CollaboratorProperties collaboratorProperties = this.findUserProperty(collaborator);
|
||||
if (collaboratorProperties == null) {
|
||||
collaboratorProperties = new CollaboratorProperties(collaborator, this);
|
||||
}
|
||||
collaboratorProperties.setStarred(value);
|
||||
this.getCollaboratorProperties().add(collaboratorProperties);
|
||||
}
|
||||
|
||||
public boolean isStarred(@NotNull Collaborator collaborator) {
|
||||
final CollaboratorProperties collaboratorProperty = this.findUserProperty(collaborator);
|
||||
return collaboratorProperty != null && collaboratorProperty.getStarred();
|
||||
}
|
||||
|
||||
public static String getDefaultMindmapXml(@NotNull final String title) {
|
||||
|
||||
final StringBuilder result = new StringBuilder();
|
||||
|
||||
@@ -21,9 +21,9 @@ package com.wisemapping.model;
|
||||
public enum ShapeStyle
|
||||
{
|
||||
LINE("line"),
|
||||
ROUNDED_RETAGLE("rounded rectagle"),
|
||||
RECTAGLE("rectagle"),
|
||||
ELIPSE("elipse");
|
||||
ROUNDED_RECTANGLE("rounded rectagle"),
|
||||
RECTANGLE("rectagle"),
|
||||
ELLIPSE("elipse");
|
||||
|
||||
private String style;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user