Update to HSQLDB driver

Remove DWR
Remove native SVG tables
Add new REST services for persistence.
This commit is contained in:
Paulo Gustavo Veiga
2012-02-21 14:22:43 -03:00
parent 89f7fd8d3c
commit fb3f9946ae
58 changed files with 419 additions and 624 deletions

View File

@@ -32,16 +32,17 @@ import org.apache.log4j.Logger;
import org.jetbrains.annotations.NotNull;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
public class MindMap {
private static final String UTF_8 = "UTF-8";
//~ Instance fields ......................................................................................
final Logger logger = Logger.getLogger(MindMap.class.getName());
private Calendar creationTime;
private String creator;
private String description;
@@ -52,24 +53,12 @@ public class MindMap {
private String lastModifierUser;
private Set<MindmapUser> mindmapUsers = new HashSet<MindmapUser>();
private MindMapNative nativeBrowser = new MindMapNative();
private User owner;
private String properties;
private String tags;
private String title;
private byte[] xml;
public static void main(String argv[]) {
String xml = "pepe\n hole";
xml = xml.replace("'", "\\'");
xml = xml.replace("\n", "");
xml = xml.trim();
System.out.println("xml:" + xml);
}
//~ Constructors .........................................................................................
public MindMap() {
@@ -85,13 +74,27 @@ public class MindMap {
this.xml = xml;
}
public void setXmlStr(@NotNull String xml)
throws IOException {
this.xml = xml.getBytes(UTF_8);
}
public byte[] getXml() {
return xml;
}
public String getUnzippedXml()
public String getXmlStr() throws UnsupportedEncodingException {
return new String(this.xml, UTF_8);
}
public byte[] getZippedXml()
throws IOException {
return ZipUtils.zipToString(xml);
return ZipUtils.stringToZip(new String(this.xml, UTF_8));
}
public void setZippedXml(byte[] xml)
throws IOException {
this.xml = ZipUtils.zipToString(xml).getBytes(UTF_8);
}
public void setProperties(String properties) {
@@ -117,8 +120,8 @@ public class MindMap {
this.mindmapUsers = mindmapUsers;
}
public void addMindmapUser(MindmapUser mindmaUser) {
mindmapUsers.add(mindmaUser);
public void addMindmapUser(MindmapUser mindmapUser) {
mindmapUsers.add(mindmapUser);
}
public boolean isPublic() {
@@ -173,15 +176,9 @@ public class MindMap {
this.title = title;
}
public String getNativeXml()
public String getXmlAsJsLiteral()
throws IOException {
return getUnzippedXml();
}
public String getNativeXmlAsJsLiteral()
throws IOException {
String xml = getNativeXml();
String xml = this.getXmlStr();
if (xml != null) {
xml = xml.replace("'", "\\'");
xml = xml.replaceAll("\\r|\\n", "");
@@ -190,10 +187,6 @@ public class MindMap {
return xml;
}
public void setNativeXml(@NotNull String nativeXml)
throws IOException {
this.xml = ZipUtils.stringToZip(nativeXml);
}
public void setTags(String tags) {
this.tags = tags;
@@ -226,12 +219,4 @@ public class MindMap {
public User getOwner() {
return owner;
}
public MindMapNative getNativeBrowser() {
return nativeBrowser;
}
public void setNativeBrowser(MindMapNative nativeBrowser) {
this.nativeBrowser = nativeBrowser;
}
}