Search in sources :

Example 46 with Activity

use of com.google.api.ads.admanager.axis.v202205.Activity in project googleads-java-lib by googleads.

the class UpdateActivities method runExample.

/**
 * Runs the example.
 *
 * @param adManagerServices the services factory.
 * @param session the session.
 * @param activityId the ID of the activity to update.
 * @throws ApiException if the API request failed with one or more service errors.
 * @throws RemoteException if the API request failed due to other errors.
 */
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session, long activityId) throws RemoteException {
    // Get the ActivityService.
    ActivityServiceInterface activityService = adManagerServices.get(session, ActivityServiceInterface.class);
    // Create a statement to only select a single activity by ID.
    StatementBuilder statementBuilder = new StatementBuilder().where("id = :id").orderBy("id ASC").limit(1).withBindVariableValue("id", activityId);
    // Get the activity.
    ActivityPage page = activityService.getActivitiesByStatement(statementBuilder.toStatement());
    // Get the activity.
    Activity activity = Iterables.getOnlyElement(Arrays.asList(page.getResults()));
    // Update the expected URL.
    activity.setExpectedURL("http://google.com");
    // Update the activity on the server.
    Activity[] activities = activityService.updateActivities(new Activity[] { activity });
    for (Activity updatedActivity : activities) {
        System.out.printf("Activity with ID %d and name '%s' was updated.%n", updatedActivity.getId(), updatedActivity.getName());
    }
}
Also used : ActivityPage(com.google.api.ads.admanager.axis.v202108.ActivityPage) StatementBuilder(com.google.api.ads.admanager.axis.utils.v202108.StatementBuilder) ActivityServiceInterface(com.google.api.ads.admanager.axis.v202108.ActivityServiceInterface) Activity(com.google.api.ads.admanager.axis.v202108.Activity)

Example 47 with Activity

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

the class Provenance_SpecifyBuildOperations method specifyCutOperation.

/**
 * specifies to perform a cut operation in order to linearize a vector using a restriction enzyme
 *
 * @throws Exception
 */
public static void specifyCutOperation() throws Exception {
    // instantiate a document
    SBOLDocument document = new SBOLDocument();
    document.setDefaultURIprefix(BUILD_PREFIX);
    ComponentDefinition vector = document.createComponentDefinition("vector", VECTOR_PLASMID);
    vector.setName("vector");
    ComponentDefinition enzyme = document.createComponentDefinition("restriction_enzyme", RESTRICTION_ENZYME);
    enzyme.setName("restriction_enzyme");
    // Create the generic top level entity for the cut operation
    Activity activity = document.createActivity("cut_" + vector.getName() + "_with_" + enzyme.getName());
    activity.setName("cut(" + vector.getName() + ", " + enzyme.getName() + ")");
    // Create the qualifiedUsage annotation to describe the inputs of the cut operation
    activity.createUsage("vector", vector.getIdentity()).addRole(VECTOR_PLASMID);
    activity.createUsage("enzyme", enzyme.getIdentity()).addRole(RESTRICTION_ENZYME);
    // the result of the cut operation
    ComponentDefinition linearized_vector = document.createComponentDefinition("linearized_vector", LINEAR_DOUBLE_STRANDED_DNA);
    linearized_vector.setName("linearized_vector");
    linearized_vector.addWasGeneratedBy(activity.getIdentity());
    // serialize the document to a file
    SBOLWriter.write(document, System.out);
}
Also used : SBOLDocument(org.sbolstandard.core2.SBOLDocument) Activity(org.sbolstandard.core2.Activity) ComponentDefinition(org.sbolstandard.core2.ComponentDefinition)

Example 48 with Activity

use of com.google.api.ads.admanager.axis.v202205.Activity in project droolsjbpm-integration by kiegroup.

the class MainElementHandler method handle.

public boolean handle(FlowElement element, PathContextManager manager) {
    PathContext context = manager.getContextFromStack();
    if (!(element instanceof SubProcess)) {
        manager.addToPath(element, context);
    }
    List<SequenceFlow> outgoing = getOutgoing(element);
    if (outgoing != null && !outgoing.isEmpty()) {
        boolean handled = false;
        if (element instanceof Gateway) {
            Gateway gateway = ((Gateway) element);
            if (gateway.getGatewayDirection() == GatewayDirection.DIVERGING) {
                handled = HandlerRegistry.getHandler(element).handle(element, manager);
            } else {
                if (gateway instanceof ParallelGateway) {
                    handled = HandlerRegistry.getHandler(element).handle(element, manager);
                } else {
                    handled = HandlerRegistry.getHandler().handle(element, manager);
                }
            }
        } else if (element instanceof Activity) {
            handled = HandlerRegistry.getHandler(element).handle(element, manager);
        } else if (element instanceof IntermediateThrowEvent) {
            handled = HandlerRegistry.getHandler(element).handle(element, manager);
        } else {
            handled = HandlerRegistry.getHandler().handle(element, manager);
        }
        if (!handled && BPMN2Utils.isAdHoc(element)) {
            manager.clearCurrentContext();
        }
    } else {
        ElementHandler handelr = HandlerRegistry.getHandler(element);
        if (handelr != null) {
            boolean handled = handelr.handle(element, manager);
            if (!handled) {
                manager.finalizePath();
            }
        } else {
            manager.finalizePath();
        }
    }
    return true;
}
Also used : SubProcess(org.eclipse.bpmn2.SubProcess) PathContext(org.jbpm.simulation.PathContext) SequenceFlow(org.eclipse.bpmn2.SequenceFlow) Gateway(org.eclipse.bpmn2.Gateway) ParallelGateway(org.eclipse.bpmn2.ParallelGateway) ParallelGateway(org.eclipse.bpmn2.ParallelGateway) Activity(org.eclipse.bpmn2.Activity) IntermediateThrowEvent(org.eclipse.bpmn2.IntermediateThrowEvent)

Example 49 with Activity

use of com.google.api.ads.admanager.axis.v202205.Activity in project droolsjbpm-integration by kiegroup.

the class BPMN2PathFinderImpl method findPaths.

public List<PathContext> findPaths() {
    Map<String, FlowElement> catchingEvents = new HashMap<String, FlowElement>();
    if (this.definitions != null) {
        List<RootElement> rootElements = definitions.getRootElements();
        for (RootElement root : rootElements) {
            if (root instanceof Process) {
                Process process = (Process) root;
                readFlowElements(process, catchingEvents);
            }
        }
    } else {
        readFlowElements(container, catchingEvents);
    }
    manager.setCatchingEvents(catchingEvents);
    ElementHandler handler = HandlerRegistry.getMainHandler();
    // show what was found
    for (FlowElement fe : triggerElements) {
        if (fe instanceof StartEvent || fe instanceof Activity || fe instanceof IntermediateCatchEvent) {
            handler.handle(fe, manager);
        }
    }
    manager.complete();
    return manager.getCompletePaths();
}
Also used : RootElement(org.eclipse.bpmn2.RootElement) HashMap(java.util.HashMap) FlowElement(org.eclipse.bpmn2.FlowElement) IntermediateCatchEvent(org.eclipse.bpmn2.IntermediateCatchEvent) StartEvent(org.eclipse.bpmn2.StartEvent) Activity(org.eclipse.bpmn2.Activity) SubProcess(org.eclipse.bpmn2.SubProcess) Process(org.eclipse.bpmn2.Process) ElementHandler(org.jbpm.simulation.handler.ElementHandler)

Example 50 with Activity

use of com.google.api.ads.admanager.axis.v202205.Activity in project droolsjbpm-integration by kiegroup.

the class BPMN2PathFinderImpl method readFlowElements.

protected void readFlowElements(FlowElementsContainer container, Map<String, FlowElement> catchingEvents) {
    // find flow elements and traverse it find path
    List<FlowElement> flowElements = container.getFlowElements();
    for (FlowElement fElement : flowElements) {
        if (fElement instanceof StartEvent) {
            triggerElements.add(0, fElement);
            List<EventDefinition> eventDefinitions = ((StartEvent) fElement).getEventDefinitions();
            processEventDefinitions(fElement, eventDefinitions, catchingEvents);
        } else if ((fElement instanceof Activity) && BPMN2Utils.isContainerAdHoc(container)) {
            Activity act = (Activity) fElement;
            if (act.getIncoming() == null || act.getIncoming().isEmpty()) {
                triggerElements.add(0, fElement);
            }
        } else if (fElement instanceof IntermediateCatchEvent) {
            IntermediateCatchEvent act = (IntermediateCatchEvent) fElement;
            if (act.getIncoming() == null || act.getIncoming().isEmpty()) {
                triggerElements.add(0, fElement);
            }
            List<EventDefinition> eventDefinitions = ((IntermediateCatchEvent) fElement).getEventDefinitions();
            processEventDefinitions(fElement, eventDefinitions, catchingEvents);
        } else if (fElement instanceof BoundaryEvent) {
            List<EventDefinition> eventDefinitions = ((BoundaryEvent) fElement).getEventDefinitions();
            processEventDefinitions(fElement, eventDefinitions, catchingEvents);
        } else if (fElement instanceof EventSubprocess || ((fElement instanceof SubProcess) && ((SubProcess) fElement).isTriggeredByEvent())) {
            readFlowElements((FlowElementsContainer) fElement, catchingEvents);
        }
    }
}
Also used : SubProcess(org.eclipse.bpmn2.SubProcess) BoundaryEvent(org.eclipse.bpmn2.BoundaryEvent) EventSubprocess(org.eclipse.bpmn2.EventSubprocess) FlowElement(org.eclipse.bpmn2.FlowElement) IntermediateCatchEvent(org.eclipse.bpmn2.IntermediateCatchEvent) StartEvent(org.eclipse.bpmn2.StartEvent) Activity(org.eclipse.bpmn2.Activity) ArrayList(java.util.ArrayList) List(java.util.List) EventDefinition(org.eclipse.bpmn2.EventDefinition) ErrorEventDefinition(org.eclipse.bpmn2.ErrorEventDefinition) SignalEventDefinition(org.eclipse.bpmn2.SignalEventDefinition) MessageEventDefinition(org.eclipse.bpmn2.MessageEventDefinition) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition) LinkEventDefinition(org.eclipse.bpmn2.LinkEventDefinition)

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