|
@@ -2,16 +2,11 @@ package com.persagy.adm.diagram.entity;
|
|
|
|
|
|
import com.persagy.adm.diagram.core.ContentParser;
|
|
|
import com.persagy.adm.diagram.core.model.Diagram;
|
|
|
-import com.persagy.adm.diagram.core.model.DiagramNode;
|
|
|
import com.persagy.adm.diagram.core.model.legend.Legend;
|
|
|
import com.persagy.adm.diagram.core.model.template.DiagramTemplate;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
/**
|
|
|
* 运行时模型-实体 类型转换适配器
|
|
|
*
|
|
@@ -66,14 +61,7 @@ public class ModelAdapter {
|
|
|
}
|
|
|
|
|
|
public Diagram toDiagram(DiagramEntity diagramEntity) {
|
|
|
- //Diagram diagram = parser.parseContent(diagramEntity.getDiagramContent(), Diagram.class);
|
|
|
- Diagram diagram = new Diagram();
|
|
|
- Map map = parser.parseContent(diagramEntity.getDiagramContent(), Map.class);
|
|
|
- diagram.setLines(parser.parseContent(parser.toJson(map.get("lines")), List.class));
|
|
|
- DiagramNode[] nodes = parser.parseContent(parser.toJson(map.get("nodes")), DiagramNode[].class);
|
|
|
- List<DiagramNode> diagramNodes = Arrays.asList(nodes);
|
|
|
- diagram.setNodes(diagramNodes);
|
|
|
-
|
|
|
+ Diagram diagram = parser.parseContent(diagramEntity.getDiagramContent(), Diagram.class);
|
|
|
diagram.setId(diagramEntity.getId());
|
|
|
diagram.setName(diagramEntity.getName());
|
|
|
diagram.setRemark(diagramEntity.getRemark());
|