Fix freemind import bug with relationships.

This commit is contained in:
Paulo Gustavo Veiga 2012-02-25 11:56:20 -03:00
parent f96b0d49c2
commit e401d73cb6
10 changed files with 201 additions and 49 deletions

View File

@ -413,7 +413,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.2</version>
<version>2.12</version>
<configuration>
<parallel>true</parallel>
<suiteXmlFiles>

View File

@ -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<Object> cloudOrEdge = srcNode.getArrowlinkOrCloudOrEdge();
cloudOrEdge.add(arrowlink);
}

View File

@ -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<String, TopicType>();
@ -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);
}

View File

@ -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();

View File

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<map version="0.9.0">
<node TEXT="California" ID="ID_1">
<node TEXT="Northern California" POSITION="left" ID="ID_24">
<node TEXT="Oakland/Berkeley" POSITION="left" ID="ID_28"/>
<node TEXT="San Mateo" POSITION="left" ID="ID_27"/>
<node TEXT="Other North" POSITION="left" ID="ID_31"/>
<node TEXT="San Francisco" POSITION="left" ID="ID_29"/>
<node TEXT="Santa Clara" POSITION="left" ID="ID_30"/>
<node TEXT="Marin/Napa/Solano" POSITION="left" ID="ID_26"/>
</node>
<node TEXT="Hawaii" POSITION="left" ID="ID_2"/>
<node TEXT="Southern California" POSITION="left" ID="ID_25">
<node TEXT="Los Angeles" POSITION="left" ID="ID_33"/>
<node TEXT="Anaheim/Santa Ana" POSITION="left" ID="ID_34"/>
<node TEXT="Ventura" POSITION="left" ID="ID_32"/>
<node TEXT="Other South" POSITION="left" ID="ID_35"/>
</node>
<node TEXT="Policy Bodies" POSITION="left" ID="ID_36">
<node TEXT="Advocacy" POSITION="left" ID="ID_50">
<node TEXT="AAO" POSITION="left" ID="ID_42"/>
<node TEXT="ASCRS" POSITION="left" ID="ID_43"/>
<node TEXT="EBAA" POSITION="left" ID="ID_41"/>
</node>
<node TEXT="Military" POSITION="left" ID="ID_47"/>
<node TEXT="United Network for Organ Sharing" POSITION="left" ID="ID_40"/>
<node TEXT="Kaiser Hospital System" POSITION="left" ID="ID_48"/>
<node TEXT="University of California System" POSITION="left" ID="ID_49"/>
<node TEXT="CMS" POSITION="left" ID="ID_44">
<node TEXT="Medicare Part A" POSITION="left" ID="ID_45"/>
<node TEXT="Medicare Part B" POSITION="left" ID="ID_46"/>
</node>
</node>
<node TEXT="Corneal Tissue OPS" POSITION="right" ID="ID_51">
<node TEXT="Transplant Bank International" POSITION="right" ID="ID_57">
<node TEXT="Orange County Eye and Transplant Bank" POSITION="right" ID="ID_58"/>
<node wORDER="1" wCOORDS="554,152" TEXT="Northern California Transplant Bank" STYLE="bubble"
POSITION="right" ID="ID_59" BACKGROUND_COLOR="#00ffd5">
<node wORDER="0" wCOORDS="815,143" TEXT="In 2010, 2,500 referrals forwarded to OneLegacy"
STYLE="elipse" POSITION="right" ID="ID_72"/>
</node>
<node wORDER="2" wCOORDS="577,179" TEXT="Doheny Eye and Tissue Transplant Bank" STYLE="bubble"
POSITION="right" LINK="http://www.dohenyeyebank.org/" ID="ID_56" BACKGROUND_COLOR="#00ffd5">
<hook NAME="accessories/plugins/NodeNote.properties">
<text>Part%20of%20Tissue%20Banks%20International</text>
</hook>
</node>
<arrowlink ENDARROW="Default" DESTINATION="ID_52"/>
<arrowlink ENDARROW="Default" DESTINATION="ID_55"/>
</node>
<node wORDER="1" wCOORDS="289,209" TEXT="OneLegacy" STYLE="bubble" POSITION="right" ID="ID_52"
BACKGROUND_COLOR="#00ffd5">
<hook NAME="accessories/plugins/NodeNote.properties">
<text>EIN%20953138799</text>
</hook>
<node wORDER="0" wCOORDS="454,200" TEXT="In 2010, 11,828 referrals" STYLE="elipse" POSITION="right"
ID="ID_60"/>
</node>
<node wORDER="2" wCOORDS="300,239" TEXT="San Diego Eye Bank" STYLE="bubble" POSITION="right" ID="ID_65"
BACKGROUND_COLOR="#00ffd5">
<node wORDER="0" wCOORDS="474,230" TEXT="In 2010, 2,555 referrals" STYLE="elipse" POSITION="right"
ID="ID_67"/>
</node>
<node TEXT="California Transplant Donor Network" POSITION="right" ID="ID_55"/>
<node TEXT="California Transplant Services" POSITION="right" ID="ID_70">
<node wORDER="0" wCOORDS="508,293" TEXT="In 2010, 0 referrals" STYLE="elipse" POSITION="right"
ID="ID_71"/>
</node>
<node TEXT="Lifesharing" POSITION="right" ID="ID_54"/>
<node TEXT="DCI Donor Services" POSITION="right" ID="ID_62">
<node wORDER="0" wCOORDS="509,350" TEXT="Sierra Eye and Tissue Donor Services" STYLE="bubble"
POSITION="right" ID="ID_53" BACKGROUND_COLOR="#00ffd5">
<hook NAME="accessories/plugins/NodeNote.properties">
<text>EIN%20581990866</text>
</hook>
<node wORDER="0" wCOORDS="728,341" TEXT="In 2010, 2.023 referrals" STYLE="elipse" POSITION="right"
ID="ID_63"/>
</node>
</node>
<node wORDER="7" wCOORDS="276,380" TEXT="SightLife" STYLE="bubble" POSITION="right" ID="ID_61"
BACKGROUND_COLOR="#00ffd5"/>
</node>
<node TEXT="Tools" POSITION="left" ID="ID_38">
<node TEXT="Darthmouth Atlas of Health" POSITION="left" ID="ID_37"/>
<node TEXT="HealthLandscape" POSITION="left" ID="ID_39"/>
</node>
<node TEXT="QE Medicare" POSITION="right" ID="ID_84"/>
<node TEXT="CMS Data" POSITION="right" ID="ID_85"/>
<node TEXT="Ambulatory Payment Classification" POSITION="right" ID="ID_3">
<node TEXT="CPT's which don't allow V2785" POSITION="right" ID="ID_89">
<node TEXT="Ocular Reconstruction Transplant" POSITION="right" ID="ID_77">
<node TEXT="65780 (amniotic membrane tranplant" POSITION="right" ID="ID_78"/>
<node TEXT="65781 (limbal stem cell allograft)" POSITION="right" ID="ID_79"/>
<node TEXT="65782 (limbal conjunctiva autograft)" POSITION="right" ID="ID_80"/>
</node>
<node TEXT="Endothelial keratoplasty" POSITION="right" ID="ID_12">
<node TEXT="65756" POSITION="right" ID="ID_23"/>
</node>
<node TEXT="Epikeratoplasty" POSITION="right" ID="ID_82">
<node TEXT="65767" POSITION="right" ID="ID_83"/>
</node>
</node>
<node TEXT="Anterior lamellar keratoplasty" POSITION="right" ID="ID_8">
<node TEXT="65710" POSITION="right" ID="ID_17"/>
</node>
<node wORDER="2" wCOORDS="557,-166" TEXT="Processing, preserving, and transporting corneal tissue"
STYLE="elipse" POSITION="right" ID="ID_86">
<node TEXT="V2785" POSITION="right" ID="ID_87"/>
<node wORDER="1" wCOORDS="810,-163" TEXT="Laser incision in recepient" STYLE="elipse" POSITION="right"
ID="ID_75">
<node TEXT="0290T" POSITION="right" ID="ID_76"/>
</node>
</node>
<node wORDER="3" wCOORDS="488,-121" TEXT="Laser incision in donor" STYLE="elipse" POSITION="right"
ID="ID_73">
<node TEXT="0289T" POSITION="right" ID="ID_74"/>
</node>
<node TEXT="Penetrating keratoplasty" POSITION="right" ID="ID_9">
<node TEXT="65730 (in other)" POSITION="right" ID="ID_18"/>
<node TEXT="65755 (in pseudoaphakia)" POSITION="right" ID="ID_20"/>
<node TEXT="65750 (in aphakia)" POSITION="right" ID="ID_19"/>
</node>
</node>
</node>
</map>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -72,7 +72,7 @@
fill="#525c61" style="cursor: move;" y="9" x="20" visibility="visible">Aval de la Municipalidad
</text>
<g preserveAspectRatio="none" focusable="true" width="14" height="12" transform="translate(3, 3) scale(1)">
<image href="../images/thumb_up.png" width="12" height="12" y="0" x="2"/>
<image href="../icons/legacy/thumb_up.png" width="12" height="12" y="0" x="2"/>
</g>
</g>
<g preserveAspectRatio="none" focusable="true" width="100" height="100" transform="translate(184, -95) scale(1)"
@ -375,7 +375,7 @@
fill="#525c61" style="cursor: move;" y="9" x="20" visibility="visible">Es tan fuerte ?
</text>
<g preserveAspectRatio="none" focusable="true" width="14" height="12" transform="translate(3, 3) scale(1)">
<image href="../images/world_link.png" width="12" height="12" y="0" x="2"/>
<image href="../icons/legacy/world_link.png" width="12" height="12" y="0" x="2"/>
</g>
</g>
<g preserveAspectRatio="none" focusable="true" width="100" height="100" transform="translate(-491, 145) scale(1)"
@ -390,8 +390,8 @@
fill="#525c61" style="cursor: move;" y="9" x="32" visibility="visible">Web Lista (Gratuita)
</text>
<g preserveAspectRatio="none" focusable="true" width="26" height="12" transform="translate(3, 3) scale(1)">
<image href="../images/money.png" width="12" height="12" y="0" x="2"/>
<image href="../images/note.png" width="12" height="12" y="0" x="14"/>
<image href="../icons/legacy/money.png" width="12" height="12" y="0" x="2"/>
<image href="../icons/legacy/note.png" width="12" height="12" y="0" x="14"/>
</g>
</g>
<g preserveAspectRatio="none" focusable="true" width="100" height="100" transform="translate(-347, 139) scale(1)"

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -148,7 +148,7 @@
fill="#525c61" style="cursor: move;" y="12" x="22" visibility="visible">web
</text>
<g preserveAspectRatio="none" focusable="true" width="14" height="12" transform="translate(4, 4) scale(1)">
<image href="../images/lightbulb.png" width="12" height="12" y="0" x="2"/>
<image href="../icons/legacy/lightbulb.png" width="12" height="12" y="0" x="2"/>
</g>
<ellipse width="6" height="6" rx="3" ry="3" cx="-3" cy="11" stroke-width="1px" fill="#a6ffc2"
style="cursor: default;" visibility="visible" stroke="#33a36f"/>
@ -223,7 +223,7 @@
fill="#ffffff" style="cursor: move;" y="12" x="22" visibility="visible">Plan de Negocio
</text>
<g preserveAspectRatio="none" focusable="true" width="14" height="12" transform="translate(4, 4) scale(1)">
<image href="../images/money.png" width="12" height="12" y="0" x="2"/>
<image href="../icons/legacy/money.png" width="12" height="12" y="0" x="2"/>
</g>
<ellipse width="6" height="6" rx="3" ry="3" cx="-3" cy="11" stroke-width="1px" fill="#7096ff"
style="cursor: default;" visibility="visible" stroke="#385b80"/>
@ -240,8 +240,8 @@
fill="#525c61" style="cursor: move;" y="9" x="32" visibility="visible">ascTimeTable
</text>
<g preserveAspectRatio="none" focusable="true" width="26" height="12" transform="translate(3, 3) scale(1)">
<image href="../images/add.png" width="12" height="12" y="0" x="2"/>
<image href="../images/world_link.png" width="12" height="12" y="0" x="14"/>
<image href="../icons/legacy/add.png" width="12" height="12" y="0" x="2"/>
<image href="../icons/legacy/world_link.png" width="12" height="12" y="0" x="14"/>
</g>
</g>
<g preserveAspectRatio="none" focusable="true" width="100" height="100" transform="translate(342, 145) scale(1)"
@ -256,7 +256,7 @@
fill="#525c61" style="cursor: move;" y="9" x="20" visibility="visible">lantiv
</text>
<g preserveAspectRatio="none" focusable="true" width="14" height="12" transform="translate(3, 3) scale(1)">
<image href="../images/world_link.png" width="12" height="12" y="0" x="2"/>
<image href="../icons/legacy/world_link.png" width="12" height="12" y="0" x="2"/>
</g>
</g>
<g preserveAspectRatio="none" focusable="true" width="100" height="100" transform="translate(218, 139) scale(1)"
@ -269,7 +269,7 @@
fill="#ffffff" style="cursor: move;" y="12" x="22" visibility="visible">Competencia
</text>
<g preserveAspectRatio="none" focusable="true" width="14" height="12" transform="translate(4, 4) scale(1)">
<image href="../images/chart_curve.png" width="12" height="12" y="0" x="2"/>
<image href="../icons/legacy/chart_curve.png" width="12" height="12" y="0" x="2"/>
</g>
<ellipse width="6" height="6" rx="3" ry="3" cx="108" cy="11" stroke-width="1px" fill="#d94e4e"
style="cursor: default;" visibility="visible" stroke="#806238"/>
@ -452,7 +452,7 @@
fill="#525c61" style="cursor: move;" y="12" x="22" visibility="visible">Features
</text>
<g preserveAspectRatio="none" focusable="true" width="14" height="12" transform="translate(4, 4) scale(1)">
<image href="../images/connect.png" width="12" height="12" y="0" x="2"/>
<image href="../icons/legacy/connect.png" width="12" height="12" y="0" x="2"/>
</g>
<ellipse width="6" height="6" rx="3" ry="3" cx="82" cy="11" stroke-width="1px" fill="#d9ff70"
style="cursor: default;" visibility="visible" stroke="#6c8038"/>

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -148,7 +148,7 @@
fill="#525c61" style="cursor: move;" y="12" x="22" visibility="visible">web
</text>
<g preserveAspectRatio="none" focusable="true" width="14" height="12" transform="translate(4, 4) scale(1)">
<image href="../images/lightbulb.png" width="12" height="12" y="0" x="2"/>
<image href="../icons/legacy/lightbulb.png" width="12" height="12" y="0" x="2"/>
</g>
<ellipse width="6" height="6" rx="3" ry="3" cx="-3" cy="11" stroke-width="1px" fill="#a6ffc2"
style="cursor: default;" visibility="visible" stroke="#33a36f"/>
@ -223,7 +223,7 @@
fill="#ffffff" style="cursor: move;" y="12" x="22" visibility="visible">Plan de Negocio
</text>
<g preserveAspectRatio="none" focusable="true" width="14" height="12" transform="translate(4, 4) scale(1)">
<image href="../images/money.png" width="12" height="12" y="0" x="2"/>
<image href="../icons/legacy/money.png" width="12" height="12" y="0" x="2"/>
</g>
<ellipse width="6" height="6" rx="3" ry="3" cx="-3" cy="11" stroke-width="1px" fill="#7096ff"
style="cursor: default;" visibility="visible" stroke="#385b80"/>
@ -240,8 +240,8 @@
fill="#525c61" style="cursor: move;" y="9" x="32" visibility="visible">ascTimeTable
</text>
<g preserveAspectRatio="none" focusable="true" width="26" height="12" transform="translate(3, 3) scale(1)">
<image href="../images/add.png" width="12" height="12" y="0" x="2"/>
<image href="../images/world_link.png" width="12" height="12" y="0" x="14"/>
<image href="../icons/legacy/add.png" width="12" height="12" y="0" x="2"/>
<image href="../icons/legacy/world_link.png" width="12" height="12" y="0" x="14"/>
</g>
</g>
<g preserveAspectRatio="none" focusable="true" width="100" height="100" transform="translate(369, 145) scale(1)"
@ -256,7 +256,7 @@
fill="#525c61" style="cursor: move;" y="9" x="20" visibility="visible">lantiv
</text>
<g preserveAspectRatio="none" focusable="true" width="14" height="12" transform="translate(3, 3) scale(1)">
<image href="../images/world_link.png" width="12" height="12" y="0" x="2"/>
<image href="../icons/legacy/world_link.png" width="12" height="12" y="0" x="2"/>
</g>
</g>
<g preserveAspectRatio="none" focusable="true" width="100" height="100" transform="translate(245, 139) scale(1)"
@ -269,7 +269,7 @@
fill="#ffffff" style="cursor: move;" y="12" x="22" visibility="visible">Competencia
</text>
<g preserveAspectRatio="none" focusable="true" width="14" height="12" transform="translate(4, 4) scale(1)">
<image href="../images/chart_curve.png" width="12" height="12" y="0" x="2"/>
<image href="../icons/legacy/chart_curve.png" width="12" height="12" y="0" x="2"/>
</g>
<ellipse width="6" height="6" rx="3" ry="3" cx="108" cy="11" stroke-width="1px" fill="#d94e4e"
style="cursor: default;" visibility="visible" stroke="#806238"/>
@ -452,7 +452,7 @@
fill="#525c61" style="cursor: move;" y="12" x="22" visibility="visible">Features
</text>
<g preserveAspectRatio="none" focusable="true" width="14" height="12" transform="translate(4, 4) scale(1)">
<image href="../images/connect.png" width="12" height="12" y="0" x="2"/>
<image href="../icons/legacy/connect.png" width="12" height="12" y="0" x="2"/>
</g>
<ellipse width="6" height="6" rx="3" ry="3" cx="82" cy="11" stroke-width="1px" fill="#d9ff70"
style="cursor: default;" visibility="visible" stroke="#6c8038"/>

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB