Search in sources :

Example 1 with ImportsValue

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());
}
Also used : DefaultImport(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.DefaultImport) ImportsValue(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.ImportsValue) Imports(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.Imports) WSDLImport(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.WSDLImport) Test(org.junit.Test)

Example 2 with ImportsValue

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);
}
Also used : Imports(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.Imports) PropertyWriterFactory(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriterFactory) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name) SLADueDate(org.kie.workbench.common.stunner.bpmn.definition.property.general.SLADueDate) ProcessType(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.ProcessType) Version(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.Version) ImportsValue(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.ImportsValue) GraphImpl(org.kie.workbench.common.stunner.core.graph.impl.GraphImpl) BPMNDiagramImpl(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl) Executable(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.Executable) NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) Documentation(org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation) Definitions(org.eclipse.bpmn2.Definitions) ProcessInstanceDescription(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.ProcessInstanceDescription) GraphNodeStoreImpl(org.kie.workbench.common.stunner.core.graph.store.GraphNodeStoreImpl) DiagramSet(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.DiagramSet) Id(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.Id) Package(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.Package) AdHoc(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.AdHoc) WSDLImport(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.WSDLImport) Test(org.junit.Test)

Example 3 with 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 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);
    }
}
Also used : ImportsValue(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.ImportsValue)

Example 4 with 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;
}
Also used : DefaultImport(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.DefaultImport) ImportsValue(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.ImportsValue) WSDLImport(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.WSDLImport)

Example 5 with ImportsValue

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());
}
Also used : ImportsValue(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.ImportsValue) Test(org.junit.Test)

Aggregations

ImportsValue (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.ImportsValue)15 Test (org.junit.Test)10 DefaultImport (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.DefaultImport)8 WSDLImport (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.WSDLImport)7 Imports (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.Imports)6 DiagramSet (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.DiagramSet)3 BPMNDiagramImpl (org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl)2 AdHoc (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.AdHoc)2 Executable (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.Executable)2 Id (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.Id)2 Package (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.Package)2 ProcessInstanceDescription (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.ProcessInstanceDescription)2 ProcessType (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.ProcessType)2 Version (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.Version)2 Documentation (org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation)2 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)2 SLADueDate (org.kie.workbench.common.stunner.bpmn.definition.property.general.SLADueDate)2 Definitions (org.eclipse.bpmn2.Definitions)1 Before (org.junit.Before)1 PropertyWriterFactory (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriterFactory)1