Search in sources :

Example 6 with DataObject

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;
}
Also used : DataObject(org.kie.workbench.common.stunner.bpmn.definition.DataObject) DataObjectPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.DataObjectPropertyWriter) Factories.bpmn2(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpmn2)

Example 7 with DataObject

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);
}
Also used : AdvancedData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.AdvancedData) DataObjectPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.DataObjectPropertyReader) DataObject(org.kie.workbench.common.stunner.bpmn.definition.DataObject) DataObjectTypeValue(org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectTypeValue) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Edge(org.kie.workbench.common.stunner.core.graph.Edge) DataObjectType(org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectType) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)

Example 8 with DataObject

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);
}
Also used : NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) Element(org.kie.workbench.common.stunner.core.graph.Element) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name) DataObject(org.kie.workbench.common.stunner.bpmn.definition.DataObject) DataObject(org.kie.workbench.common.stunner.bpmn.definition.DataObject) DataObjectTypeValue(org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectTypeValue) DataObjectType(org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectType) Test(org.junit.Test)

Example 9 with DataObject

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));
    }
}
Also used : DataObject(org.kie.workbench.common.stunner.bpmn.definition.DataObject) Pair(org.uberfire.commons.data.Pair)

Example 10 with DataObject

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;
}
Also used : DataObject(org.kie.workbench.common.stunner.bpmn.definition.DataObject) Element(org.kie.workbench.common.stunner.core.graph.Element) ArrayList(java.util.ArrayList) DataObjectTypeValue(org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectTypeValue) View(org.kie.workbench.common.stunner.core.graph.content.view.View) DataObjectType(org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectType) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)

Aggregations

DataObject (org.kie.workbench.common.stunner.bpmn.definition.DataObject)12 Test (org.junit.Test)6 DataObjectType (org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectType)6 DataObjectTypeValue (org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectTypeValue)6 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)6 View (org.kie.workbench.common.stunner.core.graph.content.view.View)5 Element (org.kie.workbench.common.stunner.core.graph.Element)4 NodeImpl (org.kie.workbench.common.stunner.core.graph.impl.NodeImpl)3 ArrayList (java.util.ArrayList)2 DataObjectPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.DataObjectPropertyWriter)2 HashMap (java.util.HashMap)1 Factories.bpmn2 (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpmn2)1 PropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriter)1 TextAnnotationPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.TextAnnotationPropertyWriter)1 DataObjectPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.DataObjectPropertyReader)1 AssignmentBaseTest (org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentBaseTest)1 AdHocSubprocess (org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess)1 BPMNDiagramImpl (org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl)1 BusinessRuleTask (org.kie.workbench.common.stunner.bpmn.definition.BusinessRuleTask)1 EmbeddedSubprocess (org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess)1