diff --git a/wise-webapp/pom.xml b/wise-webapp/pom.xml index 48d2e549..f9083b49 100644 --- a/wise-webapp/pom.xml +++ b/wise-webapp/pom.xml @@ -413,7 +413,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.7.2 + 2.12 true diff --git a/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java b/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java index 6e2c39fe..09d63ad0 100755 --- a/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java +++ b/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java @@ -94,10 +94,12 @@ public class FreemindExporter Arrowlink arrowlink = objectFactory.createArrowlink(); Node dstNode = nodesMap.get(relationship.getDestTopicId()); arrowlink.setDESTINATION(dstNode.getID()); - if (relationship.isEndArrow()) + if (relationship.isEndArrow()!=null && relationship.isEndArrow()) arrowlink.setENDARROW("Default"); - if (relationship.isStartArrow()) + + if (relationship.isStartArrow()!=null && relationship.isStartArrow()) arrowlink.setSTARTARROW("Default"); + List cloudOrEdge = srcNode.getArrowlinkOrCloudOrEdge(); cloudOrEdge.add(arrowlink); } diff --git a/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java b/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java index abfd2900..224ae963 100755 --- a/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java +++ b/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java @@ -94,7 +94,7 @@ public class FreemindImporter } - public MindMap importMap(@NotNull String mapName, @NotNull String description, @NotNull InputStream input) throws ImporterException { + public MindMap importMap(@NotNull String mapName, @NotNull String description, @NotNull InputStream input) throws ImporterException { final MindMap result = new MindMap(); nodesMap = new HashMap(); @@ -181,28 +181,37 @@ public class FreemindImporter TopicType destTopicType = nodesMap.get(rel.getDestTopicId()); //Fix x coord - final Coord srcCtrlCoord = Coord.parse(rel.getSrcCtrlPoint()); - final Coord destCtrlCoord = Coord.parse(rel.getDestCtrlPoint()); + final String srcCtrlPoint = rel.getSrcCtrlPoint(); + if (srcCtrlPoint != null) { + final Coord srcCtrlCoord = Coord.parse(srcCtrlPoint); - if (Coord.parse(srcTopic.getPosition()).isOnLeftSide()) { - int x = srcCtrlCoord.x * -1; - rel.setSrcCtrlPoint(x + "," + srcCtrlCoord.y); - } - if (Coord.parse(destTopicType.getPosition()).isOnLeftSide()) { - int x = destCtrlCoord.x * -1; - rel.setDestCtrlPoint(x + "," + destCtrlCoord.y); - } + if (Coord.parse(srcTopic.getPosition()).isOnLeftSide()) { + int x = srcCtrlCoord.x * -1; + rel.setSrcCtrlPoint(x + "," + srcCtrlCoord.y); - //Fix coord - if (srcTopic.getOrder() != null && srcTopic.getOrder() % 2 != 0) { //Odd order. - int y = srcCtrlCoord.y * -1; - rel.setSrcCtrlPoint(srcCtrlCoord.x + "," + y); - } - if (destTopicType.getOrder() != null && destTopicType.getOrder() % 2 != 0) { //Odd order. - int y = destCtrlCoord.y * -1; - rel.setDestCtrlPoint(destCtrlCoord.x + "," + y); + //Fix coord + if (srcTopic.getOrder() != null && srcTopic.getOrder() % 2 != 0) { //Odd order. + int y = srcCtrlCoord.y * -1; + rel.setSrcCtrlPoint(srcCtrlCoord.x + "," + y); + } + } } + final String destCtrlPoint = rel.getDestCtrlPoint(); + if (destCtrlPoint != null) { + final Coord destCtrlCoord = Coord.parse(destCtrlPoint); + + if (Coord.parse(destTopicType.getPosition()).isOnLeftSide()) { + int x = destCtrlCoord.x * -1; + rel.setDestCtrlPoint(x + "," + destCtrlCoord.y); + } + + + if (destTopicType.getOrder() != null && destTopicType.getOrder() % 2 != 0) { //Odd order. + int y = destCtrlCoord.y * -1; + rel.setDestCtrlPoint(destCtrlCoord.x + "," + y); + } + } } private void convertChildNodes(@NotNull Node freeParent, @NotNull TopicType wiseParent, final int depth) { @@ -299,13 +308,26 @@ public class FreemindImporter String destId = arrow.getDESTINATION(); relt.setSrcTopicId(freeParent.getID()); relt.setDestTopicId(destId); - String[] inclination = arrow.getENDINCLINATION().split(";"); - relt.setDestCtrlPoint(inclination[0] + "," + inclination[1]); - inclination = arrow.getSTARTINCLINATION().split(";"); - relt.setSrcCtrlPoint(inclination[0] + "," + inclination[1]); - //relationship.setCtrlPointRelative(true); - relt.setEndArrow(!arrow.getENDARROW().toLowerCase().equals("none")); - relt.setStartArrow(!arrow.getSTARTARROW().toLowerCase().equals("none")); + final String endinclination = arrow.getENDINCLINATION(); + if (endinclination != null) { + String[] inclination = endinclination.split(";"); + relt.setDestCtrlPoint(inclination[0] + "," + inclination[1]); + } + final String startinclination = arrow.getSTARTINCLINATION(); + if (startinclination != null) { + String[] inclination = startinclination.split(";"); + relt.setSrcCtrlPoint(inclination[0] + "," + inclination[1]); + } + + final String endarrow = arrow.getENDARROW(); + if (endarrow != null) { + relt.setEndArrow(!endarrow.toLowerCase().equals("none")); + } + + final String startarrow = arrow.getSTARTARROW(); + if (startarrow != null) { + relt.setStartArrow(!startarrow.toLowerCase().equals("none")); + } relt.setLineType("3"); relationships.add(relt); } diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/BaseController.java b/wise-webapp/src/main/java/com/wisemapping/rest/BaseController.java index 201c4eb3..ecdfa21d 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/BaseController.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/BaseController.java @@ -1,6 +1,7 @@ package com.wisemapping.rest; +import org.jetbrains.annotations.NotNull; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; @@ -11,7 +12,7 @@ public class BaseController { @ExceptionHandler(IllegalArgumentException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) @ResponseBody - public String handleClientErrors(Exception ex) { + public String handleClientErrors(@NotNull Exception ex) { ex.printStackTrace(); return ex.getMessage(); } @@ -19,7 +20,7 @@ public class BaseController { @ExceptionHandler(Exception.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) @ResponseBody - public String handleServerErrors(Exception ex) { + public String handleServerErrors(@NotNull Exception ex) { ex.printStackTrace(); // LOGGER.error(ex.getMessage(), ex); return ex.getMessage(); diff --git a/wise-webapp/src/test/data/freemind/process.mm b/wise-webapp/src/test/data/freemind/process.mm new file mode 100644 index 00000000..a1863efd --- /dev/null +++ b/wise-webapp/src/test/data/freemind/process.mm @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Part%20of%20Tissue%20Banks%20International + + + + + + + + EIN%20953138799 + + + + + + + + + + + + + + + EIN%20581990866 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wise-webapp/src/test/data/freemind/process.mmr b/wise-webapp/src/test/data/freemind/process.mmr new file mode 100644 index 00000000..fff79e47 --- /dev/null +++ b/wise-webapp/src/test/data/freemind/process.mmr @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/wise-webapp/src/test/data/freemind/process.wxml b/wise-webapp/src/test/data/freemind/process.wxml new file mode 100644 index 00000000..60a65b85 --- /dev/null +++ b/wise-webapp/src/test/data/freemind/process.wxml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/wise-webapp/src/test/data/svg/map1.svg b/wise-webapp/src/test/data/svg/map1.svg index b9c723fd..daa5d473 100644 --- a/wise-webapp/src/test/data/svg/map1.svg +++ b/wise-webapp/src/test/data/svg/map1.svg @@ -72,7 +72,7 @@ fill="#525c61" style="cursor: move;" y="9" x="20" visibility="visible">Aval de la Municipalidad - + Es tan fuerte ? - + Web Lista (Gratuita) - - + + web - + @@ -223,7 +223,7 @@ fill="#ffffff" style="cursor: move;" y="12" x="22" visibility="visible">Plan de Negocio - + @@ -240,8 +240,8 @@ fill="#525c61" style="cursor: move;" y="9" x="32" visibility="visible">ascTimeTable - - + + lantiv - + Competencia - + @@ -452,7 +452,7 @@ fill="#525c61" style="cursor: move;" y="12" x="22" visibility="visible">Features - + diff --git a/wise-webapp/src/test/data/svg/map4.svg b/wise-webapp/src/test/data/svg/map4.svg index 231534c5..4e68c232 100644 --- a/wise-webapp/src/test/data/svg/map4.svg +++ b/wise-webapp/src/test/data/svg/map4.svg @@ -148,7 +148,7 @@ fill="#525c61" style="cursor: move;" y="12" x="22" visibility="visible">web - + @@ -223,7 +223,7 @@ fill="#ffffff" style="cursor: move;" y="12" x="22" visibility="visible">Plan de Negocio - + @@ -240,8 +240,8 @@ fill="#525c61" style="cursor: move;" y="9" x="32" visibility="visible">ascTimeTable - - + + lantiv - + Competencia - + @@ -452,7 +452,7 @@ fill="#525c61" style="cursor: move;" y="12" x="22" visibility="visible">Features - +