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);
}
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);
}
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);
}
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);
}
}
}
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;
}
Aggregations