use of org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.ImportsValue in project kie-wb-common by kiegroup.
the class DiagramSetTest method testHashCode.
@Test
public void testHashCode() {
DiagramSet a = new DiagramSet();
DiagramSet b = new DiagramSet();
assertEquals(a.hashCode(), b.hashCode());
DefaultImport defaultImport = new DefaultImport("className");
WSDLImport wsdlImport = new WSDLImport("location", "namespace");
ImportsValue importsValue = new ImportsValue();
importsValue.addImport(defaultImport);
importsValue.addImport(wsdlImport);
DiagramSet c = new DiagramSet();
c.setImports(new Imports(importsValue));
DiagramSet d = new DiagramSet();
assertNotEquals(c.hashCode(), d.hashCode());
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.ImportsValue in project kie-wb-common by kiegroup.
the class DefinitionsConverterTest method toDefinitions.
@Test
public void toDefinitions() {
final String LOCATION = "Location";
final String NAMESPACE = "Namespace";
ImportsValue importsValue = new ImportsValue();
importsValue.addImport(new WSDLImport(LOCATION, NAMESPACE));
BPMNDiagramImpl diag = new BPMNDiagramImpl();
diag.setDiagramSet(new DiagramSet(new Name(), new Documentation(), new Id(), new Package(), new ProcessType(), new Version(), new AdHoc(false), new ProcessInstanceDescription(), new Imports(importsValue), new Executable(true), new SLADueDate()));
GraphNodeStoreImpl nodeStore = new GraphNodeStoreImpl();
NodeImpl x = new NodeImpl("x");
x.setContent(new ViewImpl<>(diag, Bounds.create()));
nodeStore.add(x);
ConverterFactory f = new ConverterFactory(new DefinitionsBuildingContext(new GraphImpl("x", nodeStore)), new PropertyWriterFactory());
DefinitionsConverter definitionsConverter = new DefinitionsConverter(f, new PropertyWriterFactory());
Definitions definitions = definitionsConverter.toDefinitions();
assertImportsValue(LOCATION, NAMESPACE, definitions);
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.ImportsValue in project kie-wb-common by kiegroup.
the class ImportsFieldEditorWidget method setValue.
@Override
public void setValue(final ImportsValue value, final boolean fireEvents) {
ImportsValue oldValue = copyImportsValue(importsValue);
importsValue = value;
setImportsCount(value);
if (fireEvents) {
ValueChangeEvent.fireIfNotEqual(this, oldValue, importsValue);
}
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.ImportsValue in project kie-wb-common by kiegroup.
the class ImportsFieldEditorWidget method copyImportsValue.
protected ImportsValue copyImportsValue(ImportsValue importsValue) {
ImportsValue copy = new ImportsValue();
if (importsValue != null) {
for (DefaultImport defaultImport : importsValue.getDefaultImports()) {
DefaultImport importCopy = new DefaultImport();
importCopy.setClassName(defaultImport.getClassName());
copy.addImport(importCopy);
}
for (WSDLImport wsdlImport : importsValue.getWSDLImports()) {
WSDLImport importCopy = new WSDLImport();
importCopy.setLocation(wsdlImport.getLocation());
importCopy.setNamespace(wsdlImport.getNamespace());
copy.addImport(importCopy);
}
}
return copy;
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.ImportsValue in project kie-wb-common by kiegroup.
the class ImportsFieldEditorWidgetTest method copyImportsValue.
@Test
public void copyImportsValue() {
ImportsValue result1 = tested.copyImportsValue(null);
assertNotNull(result1);
ImportsValue importsValue = createImportsValue(5, 5);
ImportsValue result2 = tested.copyImportsValue(importsValue);
assertEquals(importsValue.getDefaultImports().size(), result2.getDefaultImports().size());
assertEquals(importsValue.getWSDLImports().size(), result2.getWSDLImports().size());
importsValue.setDefaultImports(new ArrayList<>());
importsValue.setWSDLImports(new ArrayList<>());
assertNotEquals(importsValue.getDefaultImports().size(), result2.getDefaultImports().size());
assertNotEquals(importsValue.getWSDLImports().size(), result2.getWSDLImports().size());
}
Aggregations