use of com.google.api.ads.admanager.axis.v202202.Activity in project kie-wb-common by kiegroup.
the class Bpmn2JsonMarshaller method setThrowEventProperties.
private void setThrowEventProperties(ThrowEvent event, Map<String, Object> properties, Definitions def) {
if (event.getInputSet() != null) {
List<DataInput> dataInputs = event.getInputSet().getDataInputRefs();
StringBuffer dinbuff = new StringBuffer();
for (DataInput din : dataInputs) {
dinbuff.append(din.getName());
String dtype = getAnyAttributeValue(din, "dtype");
if (dtype != null && !dtype.isEmpty()) {
dinbuff.append(":").append(dtype);
}
dinbuff.append(",");
}
if (dinbuff.length() > 0) {
dinbuff.setLength(dinbuff.length() - 1);
}
String datainput = dinbuff.toString();
properties.put(DATAINPUT, datainput);
StringBuilder associationBuff = new StringBuilder();
marshallDataInputAssociations(associationBuff, event.getDataInputAssociation());
String assignmentString = associationBuff.toString();
if (assignmentString.endsWith(",")) {
assignmentString = assignmentString.substring(0, assignmentString.length() - 1);
}
properties.put(DATAINPUTASSOCIATIONS, assignmentString);
setAssignmentsInfoProperty(datainput, null, null, null, assignmentString, properties);
}
// signal scope
String signalScope = Utils.getMetaDataValue(event.getExtensionValues(), "customScope");
if (signalScope != null) {
properties.put(SIGNALSCOPE, signalScope);
}
// event definitions
List<EventDefinition> eventdefs = event.getEventDefinitions();
for (EventDefinition ed : eventdefs) {
if (ed instanceof TimerEventDefinition) {
setTimerEventProperties((TimerEventDefinition) ed, properties);
} else if (ed instanceof SignalEventDefinition) {
if (((SignalEventDefinition) ed).getSignalRef() != null) {
// find signal with the corresponding id
boolean foundSignalRef = false;
List<RootElement> rootElements = def.getRootElements();
for (RootElement re : rootElements) {
if (re instanceof Signal) {
if (re.getId().equals(((SignalEventDefinition) ed).getSignalRef())) {
properties.put(SIGNALREF, ((Signal) re).getName());
foundSignalRef = true;
}
}
}
if (!foundSignalRef) {
properties.put(SIGNALREF, "");
}
} else {
properties.put(SIGNALREF, "");
}
} else if (ed instanceof ErrorEventDefinition) {
if (((ErrorEventDefinition) ed).getErrorRef() != null && ((ErrorEventDefinition) ed).getErrorRef().getErrorCode() != null) {
properties.put(ERRORREF, ((ErrorEventDefinition) ed).getErrorRef().getErrorCode());
} else {
properties.put(ERRORREF, "");
}
} else if (ed instanceof ConditionalEventDefinition) {
FormalExpression conditionalExp = (FormalExpression) ((ConditionalEventDefinition) ed).getCondition();
if (conditionalExp != null) {
setConditionExpressionProperties(conditionalExp, properties, "drools");
}
} else if (ed instanceof EscalationEventDefinition) {
if (((EscalationEventDefinition) ed).getEscalationRef() != null) {
Escalation esc = ((EscalationEventDefinition) ed).getEscalationRef();
if (esc.getEscalationCode() != null && esc.getEscalationCode().length() > 0) {
properties.put(ESCALATIONCODE, esc.getEscalationCode());
} else {
properties.put(ESCALATIONCODE, "");
}
}
} else if (ed instanceof MessageEventDefinition) {
if (((MessageEventDefinition) ed).getMessageRef() != null) {
Message msg = ((MessageEventDefinition) ed).getMessageRef();
properties.put(MESSAGEREF, msg.getName());
}
} else if (ed instanceof CompensateEventDefinition) {
if (((CompensateEventDefinition) ed).getActivityRef() != null) {
Activity act = ((CompensateEventDefinition) ed).getActivityRef();
properties.put(ACTIVITYREF, act.getName());
}
}
}
}
use of com.google.api.ads.admanager.axis.v202202.Activity in project ORCID-Source by ORCID.
the class Api2_0_rc4_LastModifiedDatesHelper method calculateLastModified.
public static void calculateLastModified(ActivitiesContainer actContainerRc4) {
if (actContainerRc4 != null) {
Collection<? extends Activity> activities = actContainerRc4.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();
}
}
actContainerRc4.setLastModifiedDate(new LastModifiedDate(latest));
}
}
}
use of com.google.api.ads.admanager.axis.v202202.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.v202202.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);
}
use of com.google.api.ads.admanager.axis.v202202.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);
}
Aggregations