Search in sources :

Example 36 with Activity

use of com.google.api.ads.admanager.axis.v202205.Activity in project kie-wb-common by kiegroup.

the class SubProcessConverterTest method JBPM_7525_eventSubProcessShouldStoreIsAsync.

@Test
public void JBPM_7525_eventSubProcessShouldStoreIsAsync() {
    ConverterFactory f = new ConverterFactory(new DefinitionsBuildingContext(new GraphImpl("x", new GraphNodeStoreImpl())), new PropertyWriterFactory());
    SubProcessConverter c = f.subProcessConverter();
    NodeImpl<View<? extends BPMNViewDefinition>> n = new NodeImpl<>("n");
    EventSubprocess subProcessNode = new EventSubprocess();
    subProcessNode.getExecutionSet().setIsAsync(new IsAsync(true));
    n.setContent(new ViewImpl<>(subProcessNode, Bounds.create()));
    Activity activity = c.convertSubProcess(n).value().getFlowElement();
    Boolean value = CustomElement.async.of(activity).get();
    assertThat(value).isEqualTo(true);
}
Also used : NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) DefinitionsBuildingContext(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.DefinitionsBuildingContext) Activity(org.eclipse.bpmn2.Activity) ConverterFactory(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.ConverterFactory) BPMNViewDefinition(org.kie.workbench.common.stunner.bpmn.definition.BPMNViewDefinition) View(org.kie.workbench.common.stunner.core.graph.content.view.View) PropertyWriterFactory(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriterFactory) GraphNodeStoreImpl(org.kie.workbench.common.stunner.core.graph.store.GraphNodeStoreImpl) EventSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess) GraphImpl(org.kie.workbench.common.stunner.core.graph.impl.GraphImpl) IsAsync(org.kie.workbench.common.stunner.bpmn.definition.property.task.IsAsync) Test(org.junit.Test)

Example 37 with Activity

use of com.google.api.ads.admanager.axis.v202205.Activity in project kie-wb-common by kiegroup.

the class IntermediateCompensationEventPostConverterTest method testProcessWhenOutEdgeExists.

@Test
@SuppressWarnings("unchecked")
public void testProcessWhenOutEdgeExists() {
    String uuid = "UUID";
    Edge edge = mock(Edge.class);
    Node targetNode = mock(Node.class);
    when(targetNode.getUUID()).thenReturn(uuid);
    List outEdges = new ArrayList<>();
    outEdges.add(edge);
    when(node.getOutEdges()).thenReturn(outEdges);
    Activity activity = mock(Activity.class);
    when(activity.getId()).thenReturn(uuid);
    when(edge.getTargetNode()).thenReturn(targetNode);
    List<FlowElement> flowElements = Collections.singletonList(activity);
    when(process.getFlowElements()).thenReturn(flowElements);
    converter.process(processWriter, nodeWriter, (Node) node);
    verify(activity).setIsForCompensation(true);
}
Also used : FlowElement(org.eclipse.bpmn2.FlowElement) Node(org.kie.workbench.common.stunner.core.graph.Node) ArrayList(java.util.ArrayList) Activity(org.eclipse.bpmn2.Activity) ArrayList(java.util.ArrayList) List(java.util.List) Edge(org.kie.workbench.common.stunner.core.graph.Edge) Test(org.junit.Test)

Example 38 with Activity

use of com.google.api.ads.admanager.axis.v202205.Activity in project kie-wb-common by kiegroup.

the class EventDefinitionReaderTest method testActivityRefOfWithValue.

@Test
public void testActivityRefOfWithValue() {
    Activity activity = mock(Activity.class);
    when(activity.getId()).thenReturn(SOME_VALUE);
    testActivityRefOf(activity, SOME_VALUE);
}
Also used : Activity(org.eclipse.bpmn2.Activity) Test(org.junit.Test)

Example 39 with Activity

use of com.google.api.ads.admanager.axis.v202205.Activity in project ORCID-Source by ORCID.

the class Api2_0_LastModifiedDatesHelper method calculateLastModified.

public static void calculateLastModified(ActivitiesContainer actContainerV2) {
    if (actContainerV2 != null) {
        Collection<? extends Activity> activities = actContainerV2.retrieveActivities();
        if (activities != null && !activities.isEmpty()) {
            Iterator<? extends Activity> activitiesIterator = activities.iterator();
            XMLGregorianCalendar latest = activitiesIterator.next().getLastModifiedDate().getValue();
            while (activitiesIterator.hasNext()) {
                Activity activity = activitiesIterator.next();
                if (latest.compare(activity.getLastModifiedDate().getValue()) == -1) {
                    latest = activity.getLastModifiedDate().getValue();
                }
            }
            actContainerV2.setLastModifiedDate(new LastModifiedDate(latest));
        }
    }
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) LastModifiedDate(org.orcid.jaxb.model.common_v2.LastModifiedDate) Activity(org.orcid.jaxb.model.record_v2.Activity) GroupableActivity(org.orcid.jaxb.model.record_v2.GroupableActivity)

Example 40 with Activity

use of com.google.api.ads.admanager.axis.v202205.Activity in project kie-wb-common by kiegroup.

the class Bpmn2JsonUnmarshaller method setItemDefinitionsForActivitiesIoSpec.

public void setItemDefinitionsForActivitiesIoSpec(FlowElementsContainer container, Definitions def, List<ItemDefinition> toAddItemDefinitions) {
    List<FlowElement> flowElements = container.getFlowElements();
    for (FlowElement fe : flowElements) {
        if (fe instanceof Activity) {
            Activity ac = (Activity) fe;
            if (ac.getIoSpecification() != null) {
                if (ac.getIoSpecification().getDataInputs() != null) {
                    List<DataInput> dataInputs = ac.getIoSpecification().getDataInputs();
                    for (DataInput din : dataInputs) {
                        Iterator<FeatureMap.Entry> iter = din.getAnyAttribute().iterator();
                        while (iter.hasNext()) {
                            FeatureMap.Entry entry = iter.next();
                            if (entry.getEStructuralFeature().getName().equals("dtype")) {
                                String dinType = (String) entry.getValue();
                                if (dinType != null && dinType.length() > 0) {
                                    ItemDefinition itemdef = Bpmn2Factory.eINSTANCE.createItemDefinition();
                                    itemdef.setId("_" + din.getId() + "Item");
                                    itemdef.setStructureRef(dinType);
                                    toAddItemDefinitions.add(itemdef);
                                    din.setItemSubjectRef(itemdef);
                                }
                            }
                        }
                    }
                }
                if (ac.getIoSpecification().getDataOutputs() != null) {
                    List<DataOutput> dataOutputs = ac.getIoSpecification().getDataOutputs();
                    for (DataOutput dout : dataOutputs) {
                        Iterator<FeatureMap.Entry> iter = dout.getAnyAttribute().iterator();
                        while (iter.hasNext()) {
                            FeatureMap.Entry entry = iter.next();
                            if (entry.getEStructuralFeature().getName().equals("dtype")) {
                                String doutType = (String) entry.getValue();
                                if (doutType != null && doutType.length() > 0) {
                                    ItemDefinition itemdef = Bpmn2Factory.eINSTANCE.createItemDefinition();
                                    itemdef.setId("_" + dout.getId() + "Item");
                                    itemdef.setStructureRef(doutType);
                                    toAddItemDefinitions.add(itemdef);
                                    dout.setItemSubjectRef(itemdef);
                                }
                            }
                        }
                    }
                }
            }
        } else if (fe instanceof FlowElementsContainer) {
            setItemDefinitionsForActivitiesIoSpec((FlowElementsContainer) fe, def, toAddItemDefinitions);
        }
    }
}
Also used : DataOutput(org.eclipse.bpmn2.DataOutput) ItemDefinition(org.eclipse.bpmn2.ItemDefinition) Activity(org.eclipse.bpmn2.Activity) CallActivity(org.eclipse.bpmn2.CallActivity) FlowElementsContainer(org.eclipse.bpmn2.FlowElementsContainer) DataInput(org.eclipse.bpmn2.DataInput) FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) Entry(java.util.Map.Entry) SimpleFeatureMapEntry(org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry) FlowElement(org.eclipse.bpmn2.FlowElement)

Aggregations

Activity (org.eclipse.bpmn2.Activity)21 FlowElement (org.eclipse.bpmn2.FlowElement)12 ArrayList (java.util.ArrayList)9 CallActivity (org.eclipse.bpmn2.CallActivity)9 CompensateEventDefinition (org.eclipse.bpmn2.CompensateEventDefinition)9 SubProcess (org.eclipse.bpmn2.SubProcess)9 ErrorEventDefinition (org.eclipse.bpmn2.ErrorEventDefinition)8 EventDefinition (org.eclipse.bpmn2.EventDefinition)8 MessageEventDefinition (org.eclipse.bpmn2.MessageEventDefinition)8 RootElement (org.eclipse.bpmn2.RootElement)8 SignalEventDefinition (org.eclipse.bpmn2.SignalEventDefinition)8 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)8 Entry (java.util.Map.Entry)7 ConditionalEventDefinition (org.eclipse.bpmn2.ConditionalEventDefinition)7 EscalationEventDefinition (org.eclipse.bpmn2.EscalationEventDefinition)7 FlowElementsContainer (org.eclipse.bpmn2.FlowElementsContainer)7 TimerEventDefinition (org.eclipse.bpmn2.TimerEventDefinition)7 SimpleFeatureMapEntry (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry)7 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)6 Escalation (org.eclipse.bpmn2.Escalation)6