Search in sources :

Example 11 with Activity

use of com.google.api.ads.admanager.axis.v202202.Activity in project libSBOLj by SynBioDex.

the class Provenance_CodonOptimization method main.

public static void main(String[] args) throws Exception {
    NamespaceBinding myAppNs = NamespaceBinding("http://myapp.com/", "myapp");
    SBOLDocument document = new SBOLDocument();
    document.addNamespace(URI.create(myAppNs.getNamespaceURI()), myAppNs.getPrefix());
    document.setDefaultURIprefix(myAppNs.getNamespaceURI());
    ComponentDefinition optimizedCds = getCds(document, "codon_optimized", "Codon optimised CDS");
    ComponentDefinition sourceCds = getCds(document, "non_codon_optimized", "Non Codon optimised CDS");
    optimizedCds.addWasDerivedFrom(sourceCds.getIdentity());
    // Create the agent definition for the codon optimization software
    Agent agent = document.createAgent("codon_optimization_software");
    agent.setName("Codon Optimization Software");
    // Create the generic top level entity for the codon optimization activity
    Activity activity = document.createActivity("codon_optimization_activity");
    activity.setName("Codon Optimization Activity");
    // Create the qualifiedUsage annotation to describe the use of the non codon optimized CDS component
    activity.createUsage("usage", sourceCds.getIdentity()).addRole(URI.create("http://sbols.org/v2#source"));
    // Create the qualifiedAssociation annotation to describe the use of the software agent used in the activity
    activity.createAssociation("association", agent.getIdentity()).addRole(myAppNs.namespacedUri("codonoptimiser"));
    optimizedCds.addWasGeneratedBy(activity.getIdentity());
    SBOLWriter.write(document, System.out);
}
Also used : Agent(org.sbolstandard.core2.Agent) SBOLDocument(org.sbolstandard.core2.SBOLDocument) Activity(org.sbolstandard.core2.Activity) NamespaceBinding(org.sbolstandard.core.datatree.Datatree.NamespaceBinding) NamespaceBinding(org.sbolstandard.core.datatree.NamespaceBinding) ComponentDefinition(org.sbolstandard.core2.ComponentDefinition)

Example 12 with Activity

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

the class AbstractThrowEventCompensationEventPostConverter method linkActivityRef.

protected void linkActivityRef(Process process, ThrowEvent throwEvent, String activityRef) {
    if (!isEmpty(activityRef)) {
        final CompensateEventDefinition compensateEvent = (CompensateEventDefinition) throwEvent.getEventDefinitions().get(0);
        final Activity activity = findActivity(process, activityRef);
        if (activity != null) {
            compensateEvent.setActivityRef(activity);
        } else {
            LOG.warn("Referred activity: " + activityRef + " was not found for event: id: " + throwEvent.getId() + ", name: " + throwEvent.getName());
        }
    }
}
Also used : Activity(org.eclipse.bpmn2.Activity) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition)

Example 13 with Activity

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

the class AbstractCompensationEventPostConverter method findActivity.

protected Activity findActivity(FlowElementsContainer container, String uuid) {
    final List<FlowElementsContainer> subContainers = new ArrayList<>();
    for (FlowElement flowElement : container.getFlowElements()) {
        if (flowElement instanceof Activity) {
            if (flowElement.getId().equals(uuid)) {
                return (Activity) flowElement;
            } else if (flowElement instanceof SubProcess) {
                subContainers.add((SubProcess) flowElement);
            }
        }
    }
    Activity result;
    for (FlowElementsContainer subContainer : subContainers) {
        result = findActivity(subContainer, uuid);
        if (result != null) {
            return result;
        }
    }
    return null;
}
Also used : SubProcess(org.eclipse.bpmn2.SubProcess) FlowElement(org.eclipse.bpmn2.FlowElement) ArrayList(java.util.ArrayList) FlowElementsContainer(org.eclipse.bpmn2.FlowElementsContainer) Activity(org.eclipse.bpmn2.Activity)

Example 14 with Activity

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

the class BoundaryEventPropertyReaderTest method testComputeBoundsWhenNoDockerInfo.

private void testComputeBoundsWhenNoDockerInfo(float eventX, float eventY, float expectedX, float expectedY) {
    FeatureMap featureMap = mock(FeatureMap.class);
    List<FeatureMap.Entry> entries = new ArrayList<>();
    when(featureMap.stream()).thenReturn(entries.stream());
    when(boundaryEvent.getAnyAttribute()).thenReturn(featureMap);
    String activityId = "activityId";
    Activity sourceActivity = mock(Activity.class);
    BPMNShape sourceActivityShape = mock(BPMNShape.class);
    org.eclipse.dd.dc.Bounds activityBounds = mockBounds(ACTIVITY_X, ACTIVITY_Y, ACTIVITY_WIDTH, ACTIVITY_HEIGHT);
    when(sourceActivity.getId()).thenReturn(activityId);
    when(sourceActivityShape.getBounds()).thenReturn(activityBounds);
    when(definitionResolver.getShape(activityId)).thenReturn(sourceActivityShape);
    when(boundaryEvent.getAttachedToRef()).thenReturn(sourceActivity);
    float eventWidth = 56;
    float eventHeight = 56;
    org.eclipse.dd.dc.Bounds eventBounds = mockBounds(eventX, eventY, eventWidth, eventHeight);
    Bounds result = propertyReader.computeBounds(eventBounds);
    assertEquals(expectedX, result.getX(), 0);
    assertEquals(expectedY, result.getY(), 0);
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) TestUtils.mockFeatureMapEntry(org.kie.workbench.common.stunner.bpmn.backend.converters.TestUtils.mockFeatureMapEntry) Bounds(org.kie.workbench.common.stunner.core.graph.content.Bounds) TestUtils.mockBounds(org.kie.workbench.common.stunner.bpmn.backend.converters.TestUtils.mockBounds) ArrayList(java.util.ArrayList) Activity(org.eclipse.bpmn2.Activity) BPMNShape(org.eclipse.bpmn2.di.BPMNShape)

Example 15 with Activity

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

the class BoundaryEventPropertyWriterTest method testSetParentActivity.

@Test
public void testSetParentActivity() {
    ActivityPropertyWriter parentActivityWriter = mock(ActivityPropertyWriter.class);
    Activity activity = mock(Activity.class);
    when(parentActivityWriter.getFlowElement()).thenReturn(activity);
    propertyWriter.setParentActivity(parentActivityWriter);
    verify(element).setAttachedToRef(activity);
}
Also used : Activity(org.eclipse.bpmn2.Activity) Test(org.junit.Test)

Aggregations

Activity (org.eclipse.bpmn2.Activity)16 CallActivity (org.eclipse.bpmn2.CallActivity)9 FlowElement (org.eclipse.bpmn2.FlowElement)9 CompensateEventDefinition (org.eclipse.bpmn2.CompensateEventDefinition)8 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)8 ArrayList (java.util.ArrayList)7 Entry (java.util.Map.Entry)7 ConditionalEventDefinition (org.eclipse.bpmn2.ConditionalEventDefinition)7 ErrorEventDefinition (org.eclipse.bpmn2.ErrorEventDefinition)7 EscalationEventDefinition (org.eclipse.bpmn2.EscalationEventDefinition)7 EventDefinition (org.eclipse.bpmn2.EventDefinition)7 FlowElementsContainer (org.eclipse.bpmn2.FlowElementsContainer)7 MessageEventDefinition (org.eclipse.bpmn2.MessageEventDefinition)7 RootElement (org.eclipse.bpmn2.RootElement)7 SignalEventDefinition (org.eclipse.bpmn2.SignalEventDefinition)7 TimerEventDefinition (org.eclipse.bpmn2.TimerEventDefinition)7 SimpleFeatureMapEntry (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry)7 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202202.StatementBuilder)6 Escalation (org.eclipse.bpmn2.Escalation)6 Signal (org.eclipse.bpmn2.Signal)6