Search in sources :

Example 46 with ItemDefinition

use of org.eclipse.bpmn2.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 47 with ItemDefinition

use of org.eclipse.bpmn2.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 48 with ItemDefinition

use of org.eclipse.bpmn2.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 49 with ItemDefinition

use of org.eclipse.bpmn2.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)

Example 50 with ItemDefinition

use of org.eclipse.bpmn2.ItemDefinition in project drools by kiegroup.

the class DMNCompilerImpl method processItemDefinitions.

private void processItemDefinitions(DMNCompilerContext ctx, DMNFEELHelper feel, DMNModelImpl model, Definitions dmndefs) {
    Definitions.normalize(dmndefs);
    List<ItemDefinition> ordered = new ItemDefinitionDependenciesSorter(model.getNamespace()).sort(dmndefs.getItemDefinition());
    for (ItemDefinition id : ordered) {
        ItemDefNodeImpl idn = new ItemDefNodeImpl(id);
        DMNType type = buildTypeDef(ctx, feel, model, idn, id, true);
        idn.setType(type);
        model.addItemDefinition(idn);
    }
}
Also used : ItemDefinition(org.kie.dmn.model.v1_1.ItemDefinition) ItemDefNodeImpl(org.kie.dmn.core.ast.ItemDefNodeImpl) DMNType(org.kie.dmn.api.core.DMNType)

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)17 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)13 Process (org.eclipse.bpmn2.Process)13 SubProcess (org.eclipse.bpmn2.SubProcess)13 Entry (java.util.Map.Entry)11 FlowElement (org.eclipse.bpmn2.FlowElement)11 SimpleFeatureMapEntry (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry)11 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)11 Message (org.eclipse.bpmn2.Message)10 FlowElementsContainer (org.eclipse.bpmn2.FlowElementsContainer)9 Test (org.junit.Test)9 List (java.util.List)8 CallActivity (org.eclipse.bpmn2.CallActivity)7 DataInput (org.eclipse.bpmn2.DataInput)7 QName (javax.xml.namespace.QName)6 Activity (org.eclipse.bpmn2.Activity)6 DataOutput (org.eclipse.bpmn2.DataOutput)6