Search in sources :

Example 1 with CategoryValue

use of org.eclipse.bpmn2.CategoryValue in project kie-wb-common by kiegroup.

the class LanePropertyWriter method addChild.

@Override
public void addChild(BasePropertyWriter child) {
    if (child instanceof DataObjectPropertyWriter) {
        final DataObjectReference element = (DataObjectReference) child.getElement();
        FlowNode node = new FlowNodeImpl() {

            @Override
            public Auditing getAuditing() {
                return element.getAuditing();
            }

            @Override
            public Monitoring getMonitoring() {
                return element.getMonitoring();
            }

            @Override
            public List<CategoryValue> getCategoryValueRef() {
                return element.getCategoryValueRef();
            }

            @Override
            public String getName() {
                return element.getName();
            }

            @Override
            public String toString() {
                return element.toString();
            }
        };
        lane.getFlowNodeRefs().add(node);
    } else {
        lane.getFlowNodeRefs().add((FlowNode) child.getElement());
    }
}
Also used : CategoryValue(org.eclipse.bpmn2.CategoryValue) FlowNodeImpl(org.eclipse.bpmn2.impl.FlowNodeImpl) DataObjectReference(org.eclipse.bpmn2.DataObjectReference) FlowNode(org.eclipse.bpmn2.FlowNode)

Example 2 with CategoryValue

use of org.eclipse.bpmn2.CategoryValue in project kie-wb-common by kiegroup.

the class Bpmn2JsonUnmarshaller method revisitGroups.

public void revisitGroups(Definitions def) {
    List<RootElement> rootElements = def.getRootElements();
    Category defaultCat = Bpmn2Factory.eINSTANCE.createCategory();
    defaultCat.setName("default");
    for (RootElement root : rootElements) {
        if (root instanceof Process) {
            Process process = (Process) root;
            List<Artifact> processArtifacts = process.getArtifacts();
            if (processArtifacts != null) {
                for (Artifact ar : processArtifacts) {
                    if (ar instanceof Group) {
                        Group group = (Group) ar;
                        Iterator<FeatureMap.Entry> iter = group.getAnyAttribute().iterator();
                        while (iter.hasNext()) {
                            FeatureMap.Entry entry = iter.next();
                            if (entry.getEStructuralFeature().getName().equals("categoryval")) {
                                CategoryValue catval = Bpmn2Factory.eINSTANCE.createCategoryValue();
                                catval.setValue((String) entry.getValue());
                                defaultCat.getCategoryValue().add(catval);
                                group.setCategoryValueRef(catval);
                            }
                        }
                    }
                }
            }
        }
    }
    // only add category if it includes at least one categoryvalue
    if (defaultCat.getCategoryValue() != null && defaultCat.getCategoryValue().size() > 0) {
        rootElements.add(defaultCat);
    }
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) Group(org.eclipse.bpmn2.Group) Entry(java.util.Map.Entry) SimpleFeatureMapEntry(org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry) RootElement(org.eclipse.bpmn2.RootElement) Category(org.eclipse.bpmn2.Category) CategoryValue(org.eclipse.bpmn2.CategoryValue) AdHocSubProcess(org.eclipse.bpmn2.AdHocSubProcess) SubProcess(org.eclipse.bpmn2.SubProcess) Process(org.eclipse.bpmn2.Process) Artifact(org.eclipse.bpmn2.Artifact)

Aggregations

CategoryValue (org.eclipse.bpmn2.CategoryValue)2 Entry (java.util.Map.Entry)1 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)1 Artifact (org.eclipse.bpmn2.Artifact)1 Category (org.eclipse.bpmn2.Category)1 DataObjectReference (org.eclipse.bpmn2.DataObjectReference)1 FlowNode (org.eclipse.bpmn2.FlowNode)1 Group (org.eclipse.bpmn2.Group)1 Process (org.eclipse.bpmn2.Process)1 RootElement (org.eclipse.bpmn2.RootElement)1 SubProcess (org.eclipse.bpmn2.SubProcess)1 FlowNodeImpl (org.eclipse.bpmn2.impl.FlowNodeImpl)1 SimpleFeatureMapEntry (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry)1 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)1