Hi,
Currently I'm trying to extend my editor with a diagram page. My model is a graph consisting of nodes and edges. Both are managed in a ListProperty. I implemented everything like the architecture example, besides the root entity. The root entity manage both nodes and edges.
IDataProcessingUnit.class snippet (root entity, graph)
/* === Nodes === */
@Type(base = INode.class)
@XmlListBinding(path = "nodes", mappings = { @XmlListBinding.Mapping(element = "node", type = INode.class) })
@Label(standard = "Nodes")
ListProperty PROP_NODES = new ListProperty(TYPE, "nodes");
ModelElementList<INode> getNodes();
/* === Edges === */
@Type(base = IEdge.class)
@XmlListBinding(path = "edges", mappings = { @XmlListBinding.Mapping(element = "edge", type = IEdge.class) })
@Label(standard = "Edges")
ListProperty PROP_EDGES = new ListProperty(TYPE, "edges");
ModelElementList<IEdge> getEdges();
INode.class snippet
/* === Node ID === */
@XmlBinding(path = "@id")
@Label(standard = "id")
@Required
ValueProperty PROP_ID = new ValueProperty(TYPE, "id");
Value<String> getId();
void setId(String value);
/* === Edges === */
//I try to reference to the root path here!
@Type(base = IEdge.class)
@XmlListBinding(path = "/edges", mappings = { @XmlListBinding.Mapping(element = "edge", type = IEdge.class) })
@Label(standard = "Edges")
ListProperty PROP_EDGES = new ListProperty(TYPE, "edges");
ModelElementList<IEdge> getEdges();
IEdge.class snippet
/* === Edge ID === */
@Reference( target = INode.class )
@Service( impl = NodeReferenceService.class )
@XmlBinding(path = "@edgeId")
@Label(standard = "EdgeId")
@Required
ValueProperty PROP_EDGE_ID = new ValueProperty(TYPE, "edgeId");
Value<String> getEdgeId();
void setEdgeId(String value);
/* === Source ID === */
@XmlBinding(path = "@sourceId")
@Label(standard = "SourceId")
@Required
@PossibleValues( property = "/nodes/id" )
ValueProperty PROP_SOURCE_ID = new ValueProperty(TYPE, "sourceId");
Value<String> getSourceId();
void setSourceID(String value);
/* === Target ID === */
@XmlBinding(path = "@targetId")
@Label(standard = "TargetId")
@Required
@PossibleValues( property = "/nodes/id" )
ValueProperty PROP_TARGET_ID = new ValueProperty(TYPE, "targetId");
Value<String> getTargetId();
void setTargetID(String value);
If I create edges via the MasterDetailPage my xml-model looks right:
<?xml version="1.0" encoding="UTF-8"?>
<DataProcessingUnit name="myFirstDPU">
<nodes>
<node id="Node1" />
<node id="Node2" />
</nodes>
<edges>
<edge edgeId="e1" sourceId="Node1" targetId="Node2"/>
</edges>
</DataProcessingUnit>
However if I use the Graphiti editor, it looks like:
<?xml version="1.0" encoding="UTF-8"?>
<DataProcessingUnit name="myFirstDPU">
<nodes>
<node factoryId="fac1" id="Node1" type="processor" >
<edges>
<edge edgeId="Node2"></edge>
</edges>
</node>
<node factoryId="fac2" id="Node2" type="loader"/>
</nodes>
</DataProcessingUnit>
He only adds the edge in the Graphiti-Editor if I reference edgeIdas Endpoint2. If not, nothing is added.
Is it possible to reference a higher path in the xml-tree from a lower entity?
thx,
Muki