use of com.google.api.ads.admanager.axis.v202111.Activity in project ORCID-Source by ORCID.
the class Api2_0_rc2_LastModifiedDatesHelper method calculateLatest.
public static Date calculateLatest(ActivitiesContainer actContainerRc2) {
Date latestAct = null;
Collection<? extends Activity> activities = actContainerRc2.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();
}
}
actContainerRc2.setLastModifiedDate(new LastModifiedDate(latest));
latestAct = latest.toGregorianCalendar().getTime();
}
return latestAct;
}
use of com.google.api.ads.admanager.axis.v202111.Activity in project ORCID-Source by ORCID.
the class Api2_0_rc3_LastModifiedDatesHelper method calculateLastModified.
public static void calculateLastModified(ActivitiesContainer actContainerRc3) {
Collection<? extends Activity> activities = actContainerRc3.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();
}
}
actContainerRc3.setLastModifiedDate(new LastModifiedDate(latest));
}
}
use of com.google.api.ads.admanager.axis.v202111.Activity in project kie-wb-common by kiegroup.
the class Bpmn2JsonMarshaller method setCatchEventProperties.
private void setCatchEventProperties(CatchEvent event, Map<String, Object> properties, Definitions def) {
if (event.getOutputSet() != null) {
List<DataOutput> dataOutputs = event.getOutputSet().getDataOutputRefs();
StringBuffer doutbuff = new StringBuffer();
for (DataOutput dout : dataOutputs) {
doutbuff.append(dout.getName());
String dtype = getAnyAttributeValue(dout, "dtype");
if (dtype != null && !dtype.isEmpty()) {
doutbuff.append(":").append(dtype);
}
doutbuff.append(",");
}
if (doutbuff.length() > 0) {
doutbuff.setLength(doutbuff.length() - 1);
}
String dataoutput = doutbuff.toString();
properties.put(DATAOUTPUT, dataoutput);
List<DataOutputAssociation> outputAssociations = event.getDataOutputAssociation();
StringBuffer doutassociationbuff = new StringBuffer();
for (DataOutputAssociation doa : outputAssociations) {
String doaName = ((DataOutput) doa.getSourceRef().get(0)).getName();
if (doaName != null && doaName.length() > 0) {
doutassociationbuff.append("[dout]" + ((DataOutput) doa.getSourceRef().get(0)).getName());
doutassociationbuff.append("->");
doutassociationbuff.append(doa.getTargetRef().getId());
doutassociationbuff.append(",");
}
}
if (doutassociationbuff.length() > 0) {
doutassociationbuff.setLength(doutassociationbuff.length() - 1);
}
String assignments = doutassociationbuff.toString();
properties.put(DATAOUTPUTASSOCIATIONS, assignments);
setAssignmentsInfoProperty(null, null, dataoutput, null, assignments, properties);
}
// 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.v202111.Activity in project kie-wb-common by kiegroup.
the class Bpmn2JsonUnmarshaller method setThrowEventsInfoForLanes.
public void setThrowEventsInfoForLanes(Lane lane, Definitions def, List<RootElement> rootElements, List<Signal> toAddSignals, Set<Error> toAddErrors, Set<Escalation> toAddEscalations, Set<Message> toAddMessages, Set<ItemDefinition> toAddItemDefinitions) {
List<FlowNode> laneFlowNodes = lane.getFlowNodeRefs();
for (FlowNode fe : laneFlowNodes) {
if (fe instanceof ThrowEvent) {
if (((ThrowEvent) fe).getEventDefinitions().size() > 0) {
EventDefinition ed = ((ThrowEvent) fe).getEventDefinitions().get(0);
if (ed instanceof SignalEventDefinition) {
SignalEventDefinition sed = (SignalEventDefinition) ed;
if (sed.getSignalRef() != null && sed.getSignalRef().length() > 0) {
String signalRef = sed.getSignalRef();
boolean shouldAddSignal = true;
for (RootElement re : rootElements) {
if (re instanceof Signal) {
if (((Signal) re).getName().equals(signalRef)) {
shouldAddSignal = false;
break;
}
}
}
if (toAddSignals != null) {
for (Signal s : toAddSignals) {
if (s.getName().equals(signalRef)) {
shouldAddSignal = false;
break;
}
}
}
if (shouldAddSignal) {
Signal signal = Bpmn2Factory.eINSTANCE.createSignal();
signal.setName(signalRef);
toAddSignals.add(signal);
}
}
} else if (ed instanceof ErrorEventDefinition) {
String errorCode = null;
String errorId = null;
Iterator<FeatureMap.Entry> iter = ed.getAnyAttribute().iterator();
while (iter.hasNext()) {
FeatureMap.Entry entry = iter.next();
if (entry.getEStructuralFeature().getName().equals("erefname")) {
errorId = (String) entry.getValue();
errorCode = (String) entry.getValue();
}
}
Error err = this._errors.get(errorCode);
if (err == null) {
err = Bpmn2Factory.eINSTANCE.createError();
err.setId(errorId);
err.setErrorCode(errorCode);
this._errors.put(errorCode, err);
}
toAddErrors.add(err);
((ErrorEventDefinition) ed).setErrorRef(err);
} else if (ed instanceof EscalationEventDefinition) {
String escalationCode = null;
Iterator<FeatureMap.Entry> iter = ed.getAnyAttribute().iterator();
while (iter.hasNext()) {
FeatureMap.Entry entry = iter.next();
if (entry.getEStructuralFeature().getName().equals("esccode")) {
escalationCode = (String) entry.getValue();
break;
}
}
Escalation escalation = this._escalations.get(escalationCode);
if (escalation == null) {
escalation = Bpmn2Factory.eINSTANCE.createEscalation();
escalation.setEscalationCode(escalationCode);
this._escalations.put(escalationCode, escalation);
}
toAddEscalations.add(escalation);
((EscalationEventDefinition) ed).setEscalationRef(escalation);
} else if (ed instanceof MessageEventDefinition) {
((MessageEventDefinition) ed).setMessageRef(extractMessage(ed, toAddMessages, toAddItemDefinitions));
} else if (ed instanceof CompensateEventDefinition) {
Iterator<FeatureMap.Entry> iter = ed.getAnyAttribute().iterator();
while (iter.hasNext()) {
FeatureMap.Entry entry = iter.next();
if (entry.getEStructuralFeature().getName().equals("actrefname")) {
String activityNameRef = (String) entry.getValue();
// we have to iterate again through all flow
// elements
// in order to find our activity name
List<RootElement> re = def.getRootElements();
for (RootElement r : re) {
if (r instanceof Process) {
Process p = (Process) r;
List<FlowElement> fes = p.getFlowElements();
for (FlowElement f : fes) {
if (f instanceof Activity && ((Activity) f).getName().equals(activityNameRef)) {
((CompensateEventDefinition) ed).setActivityRef((Activity) f);
((Activity) f).setIsForCompensation(true);
}
}
}
}
}
}
}
}
} else if (fe instanceof FlowElementsContainer) {
setThrowEventsInfo((FlowElementsContainer) fe, def, rootElements, toAddSignals, toAddErrors, toAddEscalations, toAddMessages, toAddItemDefinitions);
}
}
}
use of com.google.api.ads.admanager.axis.v202111.Activity in project kie-wb-common by kiegroup.
the class Bpmn2JsonUnmarshaller method revisitCatchEVentsConvertToBoundaryExecute.
private void revisitCatchEVentsConvertToBoundaryExecute(Process process, FlowElementsContainer subContainer, List<CatchEvent> catchEventsToRemove, Map<BoundaryEvent, List<String>> boundaryEventsToAdd) {
FlowElementsContainer container = subContainer != null ? subContainer : process;
List<FlowElement> flowElements = container.getFlowElements();
for (FlowElement fe : flowElements) {
if (fe instanceof CatchEvent) {
// check if we have an outgoing connection to this catch event from an activity
for (Entry<Object, List<String>> entry : _outgoingFlows.entrySet()) {
for (String flowId : entry.getValue()) {
if (entry.getKey() instanceof Activity && flowId.equals(fe.getId())) {
CatchEvent ce = (CatchEvent) fe;
EventDefinition ed = null;
if (ce.getEventDefinitions() != null && ce.getEventDefinitions().size() > 0) {
ed = ce.getEventDefinitions().get(0);
}
BoundaryEvent be = Bpmn2Factory.eINSTANCE.createBoundaryEvent();
if (ed != null && ed instanceof ErrorEventDefinition) {
be.setCancelActivity(true);
} else {
Iterator<FeatureMap.Entry> iter = ce.getAnyAttribute().iterator();
while (iter.hasNext()) {
FeatureMap.Entry entry2 = iter.next();
if (entry2.getEStructuralFeature().getName().equals("boundaryca")) {
String boundaryceVal = (String) entry2.getValue();
be.setCancelActivity(Boolean.parseBoolean(boundaryceVal));
}
}
}
if (ce.getDataOutputs() != null) {
be.getDataOutputs().addAll(ce.getDataOutputs());
}
if (ce.getDataOutputAssociation() != null) {
be.getDataOutputAssociation().addAll(ce.getDataOutputAssociation());
}
if (ce.getOutputSet() != null) {
be.setOutputSet(ce.getOutputSet());
}
if (ce.getEventDefinitions() != null) {
be.getEventDefinitions().addAll(ce.getEventDefinitions());
}
if (ce.getEventDefinitionRefs() != null) {
be.getEventDefinitionRefs().addAll(ce.getEventDefinitionRefs());
}
if (ce.getProperties() != null) {
be.getProperties().addAll(ce.getProperties());
}
if (ce.getAnyAttribute() != null) {
be.getAnyAttribute().addAll(ce.getAnyAttribute());
}
if (ce.getOutgoing() != null) {
be.getOutgoing().addAll(ce.getOutgoing());
}
if (ce.getIncoming() != null) {
be.getIncoming().addAll(ce.getIncoming());
}
if (ce.getProperties() != null) {
be.getProperties().addAll(ce.getProperties());
}
be.getDocumentation().addAll(ce.getDocumentation());
be.setName(ce.getName());
String ceElementName = Utils.getMetaDataValue(ce.getExtensionValues(), "elementname");
if (ceElementName != null) {
Utils.setMetaDataExtensionValue(be, "elementname", ceElementName);
}
be.setId(ce.getId());
be.setAttachedToRef(((Activity) entry.getKey()));
((Activity) entry.getKey()).getBoundaryEventRefs().add(be);
catchEventsToRemove.add(ce);
boundaryEventsToAdd.put(be, _outgoingFlows.get(ce));
}
}
}
} else if (fe instanceof FlowElementsContainer) {
revisitCatchEVentsConvertToBoundaryExecute(process, (FlowElementsContainer) fe, catchEventsToRemove, boundaryEventsToAdd);
}
}
if (catchEventsToRemove.size() > 0) {
for (CatchEvent ce : catchEventsToRemove) {
boolean removed = container.getFlowElements().remove(ce);
_outgoingFlows.remove(ce);
}
}
if (boundaryEventsToAdd.size() > 0) {
Iterator<BoundaryEvent> boundaryToAddIterator = boundaryEventsToAdd.keySet().iterator();
while (boundaryToAddIterator.hasNext()) {
BoundaryEvent bToAdd = boundaryToAddIterator.next();
container.getFlowElements().add(bToAdd);
_outgoingFlows.put(bToAdd, boundaryEventsToAdd.get(bToAdd));
}
}
}
Aggregations