Search in sources :

Example 6 with DataObjectTypeValue

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

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

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

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

the class DataObjectTypeWidget method performSetValue.

private void performSetValue(DataObjectTypeValue value, boolean fireEvents) {
    value.setType(getRealType(value.getType()));
    if (value != null) {
        DataObjectTypeValue oldValue = current;
        current = value;
        if (fireEvents) {
            ValueChangeEvent.fireIfNotEqual(this, oldValue, current);
        } else {
            final String type = value.getType();
            dataType.setValue(type);
        }
    }
}
Also used : DataObjectTypeValue(org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectTypeValue)

Example 10 with DataObjectTypeValue

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

DataObjectTypeValue (org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectTypeValue)11 DataObjectType (org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectType)8 Test (org.junit.Test)7 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)7 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