Search in sources :

Example 1 with DataObjectType

use of org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectType in project kie-wb-common by kiegroup.

the class DataObjectTest method setType.

@Test
public void setType() {
    DataObjectType type = new DataObjectType(new DataObjectTypeValue(this.getClass().getSimpleName()));
    dataObject.setType(type);
    assertEquals(type, dataObject.getType());
}
Also used : 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 2 with DataObjectType

use of org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectType in project kie-wb-common by kiegroup.

the class ArtifactsConverterTest method toDataObjectElement.

@Test
public void toDataObjectElement() {
    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);
    when(propertyWriterFactory.of(any(org.eclipse.bpmn2.DataObjectReference.class))).thenReturn(dataObjectWriter);
    artifactsConverter = new ArtifactsConverter(propertyWriterFactory);
    PropertyWriter propertyWriter = artifactsConverter.toElement(((NodeImpl) dataObjectNode));
    verify(dataObjectWriter).setName(NAME);
    verify(dataObjectWriter).setType(NAME);
    verify(dataObjectWriter).setAbsoluteBounds(dataObjectNode);
    assertEquals(dataObjectWriter, propertyWriter);
}
Also used : DataObject(org.kie.workbench.common.stunner.bpmn.definition.DataObject) NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) DataObjectTypeValue(org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectTypeValue) DataObjectType(org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectType) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name) TextAnnotationPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.TextAnnotationPropertyWriter) PropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriter) DataObjectPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.DataObjectPropertyWriter) Test(org.junit.Test)

Example 3 with DataObjectType

use of org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectType in project kie-wb-common by kiegroup.

the class AssignmentsEditorWidgetProcessVariablesTest method testGetProcessVariableFromDataObjects.

@Test
public void testGetProcessVariableFromDataObjects() {
    DataObject dataObject = new DataObject();
    dataObject.getGeneral().getDocumentation().setValue("doc");
    dataObject.setName(new Name("name"));
    dataObject.setType(new DataObjectType(new DataObjectTypeValue("com.myType.dataObject")));
    final String uuid = UUID.uuid();
    when(dataObjectNode.getUUID()).thenReturn("uuid");
    when(dataObjectNode.getContent()).thenReturn(dataObjectView);
    when(dataObjectView.getDefinition()).thenReturn(dataObject);
    graphNodes.clear();
    graphNodes.add(dataObjectNode);
    graphNodes.add(parentNode);
    when(parentNodeView.getDefinition()).thenReturn(dataObjectNode);
    when(dataObjectNode.getUUID()).thenReturn("rootId");
    createWidget();
    assertEquals(dataObject.getName().getValue() + ":" + dataObject.getType().getValue().getType(), widget.getProcessVariables());
}
Also used : 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) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name) Test(org.junit.Test)

Example 4 with DataObjectType

use of org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectType in project kie-wb-common by kiegroup.

the class DataObjectTest method testNotEquals.

@Test
public void testNotEquals() {
    DataObject dataObject1 = new DataObject();
    DataObject dataObject2 = new DataObject();
    dataObject1.setName(new Name("dataObject1"));
    dataObject2.setName(new Name("dataObject2"));
    // Test Name
    assertNotEquals(dataObject1, dataObject2);
    // Reset
    dataObject2.setName(new Name("dataObject1"));
    assertEquals(dataObject1, dataObject2);
    // Test Type
    DataObjectType dataObjectType = new DataObjectType();
    dataObjectType.setValue(new DataObjectTypeValue("someType"));
    dataObject2.setType(dataObjectType);
    assertNotEquals(dataObject1, dataObject2);
    // Reset
    dataObject2.setType(new DataObjectType());
    assertEquals(dataObject1, dataObject2);
    // Test General Set
    BPMNGeneralSet generalSet = new BPMNGeneralSet();
    generalSet.setName(new Name("someName"));
    dataObject2.setGeneral(generalSet);
    assertNotEquals(dataObject1, dataObject2);
    // Reset
    dataObject2.setGeneral(new BPMNGeneralSet());
    assertEquals(dataObject1, dataObject2);
    // Test Background Set
    BackgroundSet backgroundSet = new BackgroundSet();
    backgroundSet.setBgColor(new BgColor("Black"));
    dataObject2.setBackgroundSet(backgroundSet);
    assertNotEquals(dataObject1, dataObject2);
    // Reset
    dataObject2.setBackgroundSet(new BackgroundSet());
    assertEquals(dataObject1, dataObject2);
    // Test Font Set
    FontSet fontSet = new FontSet();
    fontSet.setFontSize(new FontSize(11.0));
    dataObject2.setFontSet(fontSet);
    assertNotEquals(dataObject1, dataObject2);
    // Reset
    dataObject2.setFontSet(new FontSet());
    assertEquals(dataObject1, dataObject2);
    // Test Dimension Set
    RectangleDimensionsSet rectangleDimensionsSet = new RectangleDimensionsSet(100.0, 100.0);
    dataObject2.setDimensionsSet(rectangleDimensionsSet);
    assertNotEquals(dataObject1, dataObject2);
    // Reset
    dataObject2.setDimensionsSet(new RectangleDimensionsSet());
    assertEquals(dataObject1, dataObject2);
}
Also used : FontSet(org.kie.workbench.common.stunner.bpmn.definition.property.font.FontSet) BackgroundSet(org.kie.workbench.common.stunner.bpmn.definition.property.background.BackgroundSet) FontSize(org.kie.workbench.common.stunner.bpmn.definition.property.font.FontSize) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) RectangleDimensionsSet(org.kie.workbench.common.stunner.bpmn.definition.property.dimensions.RectangleDimensionsSet) DataObjectTypeValue(org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectTypeValue) BgColor(org.kie.workbench.common.stunner.bpmn.definition.property.background.BgColor) DataObjectType(org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectType) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name) Test(org.junit.Test)

Example 5 with DataObjectType

use of org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectType 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)

Aggregations

DataObjectType (org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectType)8 DataObjectTypeValue (org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectTypeValue)8 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)7 Test (org.junit.Test)6 DataObject (org.kie.workbench.common.stunner.bpmn.definition.DataObject)6 View (org.kie.workbench.common.stunner.core.graph.content.view.View)4 Element (org.kie.workbench.common.stunner.core.graph.Element)3 NodeImpl (org.kie.workbench.common.stunner.core.graph.impl.NodeImpl)3 ArrayList (java.util.ArrayList)1 DataObjectPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.DataObjectPropertyWriter)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 BackgroundSet (org.kie.workbench.common.stunner.bpmn.definition.property.background.BackgroundSet)1 BgColor (org.kie.workbench.common.stunner.bpmn.definition.property.background.BgColor)1 RectangleDimensionsSet (org.kie.workbench.common.stunner.bpmn.definition.property.dimensions.RectangleDimensionsSet)1 FontSet (org.kie.workbench.common.stunner.bpmn.definition.property.font.FontSet)1 FontSize (org.kie.workbench.common.stunner.bpmn.definition.property.font.FontSize)1 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)1 AdvancedData (org.kie.workbench.common.stunner.bpmn.definition.property.variables.AdvancedData)1