use of org.eclipse.bpmn2.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 org.eclipse.bpmn2.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 org.eclipse.bpmn2.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 org.eclipse.bpmn2.Activity in project kie-wb-common by kiegroup.
the class Bpmn2JsonMarshaller method marshallDataOutputSet.
private String marshallDataOutputSet(Activity activity, Map<String, Object> properties, List<String> disallowedNames) {
if (activity.getIoSpecification() != null) {
List<OutputSet> outputSetList = activity.getIoSpecification().getOutputSets();
StringBuilder dataOutBuffer = new StringBuilder();
for (OutputSet outset : outputSetList) {
List<DataOutput> dataOutputList = outset.getDataOutputRefs();
marshallItemAwareElements(activity, dataOutputList, dataOutBuffer, disallowedNames);
}
if (dataOutBuffer.length() > 0) {
dataOutBuffer.setLength(dataOutBuffer.length() - 1);
}
String dataoutputset = dataOutBuffer.toString();
properties.put(DATAOUTPUTSET, dataoutputset);
return dataoutputset;
} else {
return null;
}
}
use of org.eclipse.bpmn2.Activity in project kie-wb-common by kiegroup.
the class Bpmn2JsonMarshaller method marshallItemAwareElements.
private void marshallItemAwareElements(Activity activity, List<? extends ItemAwareElement> elements, StringBuilder buffer, List<String> disallowedNames) {
for (ItemAwareElement element : elements) {
String name = null;
if (element instanceof DataInput) {
name = ((DataInput) element).getName();
}
if (element instanceof DataOutput) {
name = ((DataOutput) element).getName();
}
if (name != null && !name.isEmpty() && !disallowedNames.contains(name)) {
buffer.append(name);
if (element.getItemSubjectRef() != null && element.getItemSubjectRef().getStructureRef() != null && !element.getItemSubjectRef().getStructureRef().isEmpty()) {
buffer.append(":").append(element.getItemSubjectRef().getStructureRef());
} else if (activity.eContainer() instanceof SubProcess) {
// BZ1247105: for Outputs on Tasks inside sub-processes
String dtype = getAnyAttributeValue(element, "dtype");
if (dtype != null && !dtype.isEmpty()) {
buffer.append(":").append(dtype);
}
}
buffer.append(",");
}
}
}
Aggregations