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());
}
}
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);
}
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;
}
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();
}
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);
}
}
}
Aggregations