Fix encoding on map title.

This commit is contained in:
Paulo Gustavo Veiga 2022-10-24 19:02:41 -07:00
parent 6cd0f635d5
commit 24e2ba93f3
4 changed files with 11 additions and 31 deletions

View File

@ -113,17 +113,6 @@ CREATE TABLE COLLABORATION (
)
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;
CREATE TABLE ACCESS_AUDITORY (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
login_date DATE,

View File

@ -19,8 +19,6 @@
package com.wisemapping.model;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.jetbrains.annotations.Nullable;
import javax.persistence.*;

View File

@ -105,7 +105,7 @@ public class Collaborator implements Serializable {
int id = this.getId();
String email = this.getEmail();
int result = (int) (id ^ (id >>> 32));
int result = id ^ (id >>> 32);
result = 31 * result + (email != null ? email.hashCode() : 0);
return result;
}

View File

@ -83,13 +83,9 @@ public class Mindmap implements Serializable {
@Basic(fetch = FetchType.LAZY)
private byte[] zippedXml;
//~ Constructors .........................................................................................
public Mindmap() {
}
//~ Methods ..............................................................................................
public void setUnzipXml(@NotNull byte[] value) {
try {
final byte[] zip = ZipUtils.bytesToZip(value);
@ -318,11 +314,20 @@ public class Mindmap implements Serializable {
final StringBuilder result = new StringBuilder();
result.append("<map version=\"tango\">");
result.append("<topic central=\"true\" text=\"");
result.append(StringEscapeUtils.escapeXml(title));
result.append(escapeXmlAttribute(title));
result.append("\"/></map>");
return result.toString();
}
static private String escapeXmlAttribute(String attValue) {
// Hack: Find out of the box function.
String result = attValue.replace("&", "&amp;");
result = result.replace("<", "&lt;");
result = result.replace("gt", "&gt;");
result = result.replace("\"", "&quot;");
return result;
}
public Mindmap shallowClone() {
final Mindmap result = new Mindmap();
result.setDescription(this.getDescription());
@ -353,18 +358,6 @@ public class Mindmap implements Serializable {
return false;
}
@Nullable
public Label findLabel(int labelId) {
Label result = null;
for (Label label : this.labels) {
if (label.getId() == labelId) {
result = label;
break;
}
}
return result;
}
public void removeLabel(@NotNull final Label label) {
this.labels.remove(label);
}