Search in sources :

Example 36 with ItemDefinition

use of org.kie.workbench.common.dmn.api.definition.v1_1.ItemDefinition in project kie-wb-common by kiegroup.

the class CustomInput method typedefInput.

private ItemDefinition typedefInput(String name, String type) {
    ItemDefinition typeDef = bpmn2.createItemDefinition();
    typeDef.setId(Ids.dataInputItem(element.getId(), name));
    typeDef.setStructureRef(type);
    return typeDef;
}
Also used : ItemDefinition(org.eclipse.bpmn2.ItemDefinition)

Example 37 with ItemDefinition

use of org.kie.workbench.common.dmn.api.definition.v1_1.ItemDefinition in project kie-wb-common by kiegroup.

the class OutputAssignmentWriter method typedefOutput.

private ItemDefinition typedefOutput(VariableDeclaration decl) {
    ItemDefinition typeDef = bpmn2.createItemDefinition();
    typeDef.setId(Ids.dataOutputItem(parentId, decl.getIdentifier()));
    typeDef.setStructureRef(decl.getType());
    return typeDef;
}
Also used : ItemDefinition(org.eclipse.bpmn2.ItemDefinition)

Example 38 with ItemDefinition

use of org.kie.workbench.common.dmn.api.definition.v1_1.ItemDefinition in project kie-wb-common by kiegroup.

the class DefinitionsConverter method dmnFromWB.

public static org.kie.dmn.model.v1_1.Definitions dmnFromWB(final Definitions wb) {
    if (wb == null) {
        return null;
    }
    org.kie.dmn.model.v1_1.Definitions result = new org.kie.dmn.model.v1_1.Definitions();
    // TODO currently DMN wb UI does not offer feature to set these required DMN properties, setting some hardcoded defaults for now.
    String defaultId = (wb.getId() != null) ? wb.getId().getValue() : UUID.uuid();
    String defaulName = (wb.getName() != null) ? wb.getName().getValue() : UUID.uuid(8);
    String defaultNamespace = (wb.getNamespace() != null) ? wb.getNamespace() : "https://github.com/kiegroup/drools/kie-dmn";
    result.setId(defaultId);
    result.setName(defaulName);
    result.setNamespace(defaultNamespace);
    result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription()));
    result.getNsContext().putAll(wb.getNsContext());
    for (ItemDefinition itemDef : wb.getItemDefinition()) {
        org.kie.dmn.model.v1_1.ItemDefinition itemDefConvered = ItemDefinitionPropertyConverter.dmnFromWB(itemDef);
        result.getItemDefinition().add(itemDefConvered);
    }
    // Need manually setup custom namespace URI if the diagram was created from the UI.
    if (!result.getPrefixForNamespaceURI(DMNDiagram.DMNV11_DD).isPresent()) {
        result.getNsContext().put("dmndi", DMNDiagram.DMNV11_DD);
    }
    if (!result.getPrefixForNamespaceURI(DMNDiagram.DMNV11_DC).isPresent()) {
        result.getNsContext().put("dc", DMNDiagram.DMNV11_DC);
    }
    if (!result.getPrefixForNamespaceURI(DMNDiagram.DMNV11_DI).isPresent()) {
        result.getNsContext().put("di", DMNDiagram.DMNV11_DI);
    }
    return result;
}
Also used : Definitions(org.kie.workbench.common.dmn.api.definition.v1_1.Definitions) ItemDefinition(org.kie.workbench.common.dmn.api.definition.v1_1.ItemDefinition)

Example 39 with ItemDefinition

use of org.kie.workbench.common.dmn.api.definition.v1_1.ItemDefinition in project kie-wb-common by kiegroup.

the class ItemDefinitionPropertyConverter method wbFromDMN.

public static ItemDefinition wbFromDMN(final org.kie.dmn.model.v1_1.ItemDefinition dmn) {
    if (dmn == null) {
        return null;
    }
    Id id = new Id(dmn.getId());
    Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
    Name name = new Name(dmn.getName());
    ItemDefinition result = new ItemDefinition();
    result.setId(id);
    result.setName(name);
    result.setDescription(description);
    result.setTypeRef(typeRef);
    result.setTypeLanguage(dmn.getTypeLanguage());
    result.setIsCollection(dmn.isIsCollection());
    UnaryTests utConverted = UnaryTestsPropertyConverter.wbFromDMN(dmn.getAllowedValues());
    result.setAllowedValues(utConverted);
    for (org.kie.dmn.model.v1_1.ItemDefinition child : dmn.getItemComponent()) {
        ItemDefinition convertedChild = ItemDefinitionPropertyConverter.wbFromDMN(child);
        result.getItemComponent().add(convertedChild);
    }
    return result;
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) ItemDefinition(org.kie.workbench.common.dmn.api.definition.v1_1.ItemDefinition) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) UnaryTests(org.kie.workbench.common.dmn.api.definition.v1_1.UnaryTests) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) Name(org.kie.workbench.common.dmn.api.property.dmn.Name)

Example 40 with ItemDefinition

use of org.kie.workbench.common.dmn.api.definition.v1_1.ItemDefinition in project drools by kiegroup.

the class ItemDefinitionConverter method writeAttributes.

@Override
protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) {
    super.writeAttributes(writer, parent);
    ItemDefinition id = (ItemDefinition) parent;
    if (id.getTypeLanguage() != null)
        writer.addAttribute(TYPE_LANGUAGE, id.getTypeLanguage());
    writer.addAttribute(IS_COLLECTION, Boolean.valueOf(id.isIsCollection()).toString());
}
Also used : ItemDefinition(org.kie.dmn.model.v1_1.ItemDefinition)

Aggregations

ItemDefinition (org.kie.dmn.model.v1_1.ItemDefinition)22 ItemDefinition (org.eclipse.bpmn2.ItemDefinition)21 ArrayList (java.util.ArrayList)17 RootElement (org.eclipse.bpmn2.RootElement)13 Message (org.eclipse.bpmn2.Message)10 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)9 Process (org.eclipse.bpmn2.Process)9 SubProcess (org.eclipse.bpmn2.SubProcess)9 Test (org.junit.Test)9 List (java.util.List)7 Entry (java.util.Map.Entry)7 SimpleFeatureMapEntry (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry)7 QName (javax.xml.namespace.QName)6 FlowElement (org.eclipse.bpmn2.FlowElement)6 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)6 ServiceTask (org.eclipse.bpmn2.ServiceTask)5 DataInput (org.eclipse.bpmn2.DataInput)4 DataOutput (org.eclipse.bpmn2.DataOutput)4 FlowElementsContainer (org.eclipse.bpmn2.FlowElementsContainer)4 Interface (org.eclipse.bpmn2.Interface)4