use of org.kie.workbench.common.stunner.bpmn.definition.DataObject in project kie-wb-common by kiegroup.
the class ArtifactsConverter method toDataObjectAnnotation.
private PropertyWriter toDataObjectAnnotation(Node<View<DataObject>, ?> node) {
org.eclipse.bpmn2.DataObjectReference element = bpmn2.createDataObjectReference();
element.setId(node.getUUID());
DataObjectPropertyWriter writer = propertyWriterFactory.of(element);
DataObject definition = node.getContent().getDefinition();
writer.setName(StringUtils.replaceIllegalCharsAttribute(StringUtils.replaceIllegalCharsForDataObjects(definition.getName().getValue())));
writer.setType(definition.getType().getValue().getType());
writer.setMetaData(definition.getAdvancedData().getMetaDataAttributes());
writer.setAbsoluteBounds(node);
return writer;
}
use of org.kie.workbench.common.stunner.bpmn.definition.DataObject in project kie-wb-common by kiegroup.
the class ArtifactsConverter method toDataObject.
private BpmnNode toDataObject(org.eclipse.bpmn2.DataObjectReference element) {
DataObjectPropertyReader p = propertyReaderFactory.of(element);
Node<View<DataObject>, Edge> node = typedFactoryManager.newNode(element.getId(), DataObject.class);
DataObject definition = node.getContent().getDefinition();
definition.setName(new Name(revertIllegalCharsAttribute(p.getName())));
definition.setType(new DataObjectType(new DataObjectTypeValue(p.getType())));
node.getContent().setBounds(p.getBounds());
definition.setDimensionsSet(p.getRectangleDimensionsSet());
definition.setFontSet(p.getFontSet());
definition.setBackgroundSet(p.getBackgroundSet());
definition.setAdvancedData(new AdvancedData(p.getMetaDataAttributes()));
return BpmnNode.of(node, p);
}
use of org.kie.workbench.common.stunner.bpmn.definition.DataObject in project kie-wb-common by kiegroup.
the class AssignmentsEditorWidgetProcessVariablesTest method testViewAndContent.
@Test
public void testViewAndContent() {
Node<View<DataObject>, ?> dataObjectNode;
DataObject dataObject = new DataObject();
dataObject.getGeneral().getDocumentation().setValue("doc");
dataObject.setName(new Name("name"));
dataObject.setType(new DataObjectType(new DataObjectTypeValue("name")));
dataObjectNode = new NodeImpl<>(UUID.uuid());
dataObjectNode.setContent(dataObjectView);
when(dataObjectView.getDefinition()).thenReturn(dataObject);
boolean isBPMNDefinition = widget.isBPMNDefinition(dataObjectNode);
assertTrue(" Must be a BPMN Definition", isBPMNDefinition);
Node<View<Object>, ?> objectNode = new NodeImpl<>(UUID.uuid());
objectNode.setContent(otherView);
when(otherView.getDefinition()).thenReturn(new Object());
isBPMNDefinition = widget.isBPMNDefinition(objectNode);
assertFalse(" Must not be a BPMN Definition", isBPMNDefinition);
Node<Element, ?> objectNode2 = new NodeImpl<>(UUID.uuid());
Element someElement = mock(Element.class);
objectNode2.setContent(someElement);
when(otherView.getDefinition()).thenReturn(new Object());
isBPMNDefinition = widget.isBPMNDefinition(objectNode2);
assertFalse(" Must not be a BPMN Definition", isBPMNDefinition);
}
use of org.kie.workbench.common.stunner.bpmn.definition.DataObject in project kie-wb-common by kiegroup.
the class VariablesProvider method processNode.
private void processNode(Node<View<BPMNDefinition>, Edge> elm, Collection<Pair<Object, String>> result) {
if (elm.getContent().getDefinition() instanceof DataObject) {
DataObject dataObject = (DataObject) elm.getContent().getDefinition();
String name = dataObject.getName().getValue();
result.add(new Pair(name, name));
}
}
use of org.kie.workbench.common.stunner.bpmn.definition.DataObject in project kie-wb-common by kiegroup.
the class VariableProviderTest method mockModes.
@Override
protected List<Element> mockModes() {
List<Element> nodes = new ArrayList<>();
nodes.add(mockRootNode(PROCESS_VARIABLES, CASE_FILE_VARIABLES));
Node<View<DataObject>, ?> dataObjectNode;
DataObject dataObject = new DataObject();
dataObject.getGeneral().getDocumentation().setValue("doc");
dataObject.setName(new Name("name"));
dataObject.setType(new DataObjectType(new DataObjectTypeValue("name")));
dataObjectNode = new NodeImpl<>(UUID.uuid());
dataObjectNode.setContent(dataObjectView);
when(dataObjectView.getDefinition()).thenReturn(dataObject);
nodes.add(dataObjectNode);
return nodes;
}
Aggregations