use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class XMLEncoderDiagramMetadataMarshallerTest method testDecodeTest1.
@Test
public void testDecodeTest1() throws Exception {
InputStream is = loadStream(TEST1);
Metadata metadata = tested.unmarshall(is);
assertNotNull(metadata);
assertEquals("defSet1", metadata.getDefinitionSetId());
assertEquals("ss1", metadata.getShapeSetId());
assertEquals("thumbData1", metadata.getThumbData());
assertEquals("title1", metadata.getTitle());
assertEquals("root1", metadata.getCanvasRootUUID());
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class DiagramServiceImpl method obtainMetadata.
@SuppressWarnings("unchecked")
@Override
protected Metadata obtainMetadata(DefinitionSetService services, final org.uberfire.backend.vfs.Path diagramFilePath, final String defSetId, final String fileName) {
Metadata metadata = null;
final InputStream metaDataStream = loadMetadataForPath(diagramFilePath);
if (null != metaDataStream) {
try {
metadata = services.getDiagramMarshaller().getMetadataMarshaller().unmarshall(metaDataStream);
if (null == metadata.getRoot() || null == metadata.getRoot().toURI()) {
metadata.setRoot(getRoot());
}
} catch (java.io.IOException e) {
LOG.error("Cannot unmarshall metadata for diagram's path [" + diagramFilePath + "]", e);
}
}
return metadata;
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class SessionDiagramEditorScreen method newDiagram.
private void newDiagram(final String uuid, final String title, final String definitionSetId, final String shapeSetId, final Command callback) {
BusyPopup.showMessage("Loading");
final Metadata metadata = buildMetadata(definitionSetId, shapeSetId, title);
clientFactoryServices.newDiagram(uuid, definitionSetId, metadata, new ServiceCallback<Diagram>() {
@Override
public void onSuccess(final Diagram diagram) {
final Metadata metadata = diagram.getMetadata();
metadata.setShapeSetId(shapeSetId);
metadata.setTitle(title);
openDiagram(diagram, callback);
}
@Override
public void onError(final ClientRuntimeError error) {
showError(error);
callback.execute();
}
});
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerTest method testMarshallProcessVariables.
@Test
public void testMarshallProcessVariables() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_PROCESSVARIABLES);
JBPMBpmn2ResourceImpl resource = tested.marshallToBpmn2Resource(diagram);
String result = tested.marshall(diagram);
assertDiagram(result, 1, 7, 7);
Definitions definitions = (Definitions) resource.getContents().get(0);
assertNotNull(definitions);
List<RootElement> rootElements = definitions.getRootElements();
assertNotNull(rootElements);
assertNotNull(getItemDefinition(rootElements, "_employeeItem", "java.lang.String"));
assertNotNull(getItemDefinition(rootElements, "_reasonItem", "java.lang.String"));
assertNotNull(getItemDefinition(rootElements, "_performanceItem", "java.lang.String"));
Process process = getProcess(definitions);
assertNotNull(process);
List<Property> properties = process.getProperties();
assertNotNull(properties);
assertNotNull(getProcessProperty(properties, "employee", "_employeeItem"));
assertNotNull(getProcessProperty(properties, "reason", "_reasonItem"));
assertNotNull(getProcessProperty(properties, "performance", "_performanceItem"));
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerTest method testUnmarshallBusinessRuleTaskAssignments.
@Test
@SuppressWarnings("unchecked")
public void testUnmarshallBusinessRuleTaskAssignments() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_BUSINESSRULETASKASSIGNMENTS);
assertDiagram(diagram, 4);
assertEquals("BusinessRuleTaskAssignments", diagram.getMetadata().getTitle());
Node<? extends Definition, ?> businessRuleNode = diagram.getGraph().getNode("_45C2C340-D1D0-4D63-8419-EF38F9E73507");
BusinessRuleTask businessRuleTask = (BusinessRuleTask) businessRuleNode.getContent().getDefinition();
assertEquals(businessRuleTask.getTaskType().getValue(), TaskTypes.BUSINESS_RULE);
DataIOSet dataIOSet = businessRuleTask.getDataIOSet();
AssignmentsInfo assignmentsinfo = dataIOSet.getAssignmentsinfo();
assertEquals(assignmentsinfo.getValue(), "|input1:String,input2:String||output1:String,output2:String|[din]pv1->input1,[din]pv2->input2,[dout]output1->pv2,[dout]output2->pv2");
}
Aggregations