use of com.centurylink.mdw.model.value.work.WorkTransitionVO in project mdw-designer by CenturyLinkCloud.
the class ProcessWorker method convert_to_designer.
// remember and then delete hidden links
public void convert_to_designer(ProcessVO processVO) {
if (processVO.isInRuleSet())
return;
WorkTransitionVO startTrans = null;
List<WorkTransitionVO> hiddenLinks = new ArrayList<WorkTransitionVO>();
List<WorkTransitionVO> invalidHiddenLinks = new ArrayList<WorkTransitionVO>();
for (WorkTransitionVO w : processVO.getTransitions()) {
if (w.getFromWorkId().equals(processVO.getProcessId())) {
hiddenLinks.add(w);
if (w.getEventType().equals(EventType.START))
startTrans = w;
} else if (w.isHidden()) {
// somehow in 4.5 invalid hidden transitions are being added
invalidHiddenLinks.add(w);
}
}
processVO.setAttribute(WorkAttributeConstant.START_TRANSITION_ID, startTrans == null ? null : startTrans.getWorkTransitionId().toString());
for (WorkTransitionVO w : hiddenLinks) {
processVO.getTransitions().remove(w);
}
for (WorkTransitionVO w : invalidHiddenLinks) {
processVO.getTransitions().remove(w);
}
List<ProcessVO> subProcesses = processVO.getSubProcesses();
if (subProcesses != null) {
for (ProcessVO subProcessVO : subProcesses) {
WorkTransitionVO entryTrans = null;
for (WorkTransitionVO w : hiddenLinks) {
if (!w.getEventType().equals(EventType.START) && w.getToWorkId().equals(subProcessVO.getProcessId())) {
entryTrans = w;
break;
}
}
startTrans = null;
for (WorkTransitionVO w : subProcessVO.getTransitions()) {
if (w.getEventType().equals(EventType.START)) {
startTrans = w;
break;
}
}
if (startTrans != null)
subProcessVO.getTransitions().remove(startTrans);
subProcessVO.setAttribute(WorkAttributeConstant.ENTRY_TRANSITION_ID, entryTrans == null ? null : entryTrans.getWorkTransitionId().toString());
subProcessVO.setAttribute(WorkAttributeConstant.START_TRANSITION_ID, startTrans == null ? null : startTrans.getWorkTransitionId().toString());
}
}
}
use of com.centurylink.mdw.model.value.work.WorkTransitionVO in project mdw-designer by CenturyLinkCloud.
the class ProcessWorker method createHiddenTransition.
private void createHiddenTransition(ProcessVO owner, Long to, Integer type, String compcode, String existingId, int logicalId, boolean isInRuleSet) {
Long transId = isInRuleSet ? logicalId : existingId == null ? new Long(0) : new Long(existingId);
WorkTransitionVO trans = new WorkTransitionVO();
trans.setEventType(type);
trans.setProcessId(owner.getProcessId());
trans.setWorkTransitionId(transId);
trans.setFromWorkId(isInRuleSet ? 0L : owner.getProcessId());
trans.setToWorkId(to);
trans.setCompletionCode(compcode);
trans.setAttribute(WorkAttributeConstant.LOGICAL_ID, "H" + logicalId);
owner.getTransitions().add(trans);
}
use of com.centurylink.mdw.model.value.work.WorkTransitionVO in project mdw-designer by CenturyLinkCloud.
the class DesignerDataAccess method getTaskInstances.
private List<TaskInstanceVO> getTaskInstances(ProcessVO process, ProcessInstanceVO processInstance, Long activityId, List<TaskInstanceVO> allTaskInstances) throws DataAccessException {
List<TaskInstanceVO> taskInstances = new ArrayList<>();
for (TaskInstanceVO taskInstance : allTaskInstances) {
String secondaryOwner = taskInstance.getSecondaryOwnerType();
if (OwnerType.DOCUMENT.equals(secondaryOwner) || "EXTERNAL_EVENT_INSTANCE".equals(secondaryOwner)) {
String formDataString = null;
if (OwnerType.DOCUMENT.equals(secondaryOwner))
formDataString = rtinfo.getDocument(taskInstance.getSecondaryOwnerId()).getContent();
else if ("EXTERNAL_EVENT_INSTANCE".equals(secondaryOwner))
formDataString = rtinfo.getExternalEventDetails(taskInstance.getSecondaryOwnerId());
FormDataDocument formDataDoc = new FormDataDocument();
try {
formDataDoc.load(formDataString);
for (ActivityInstanceVO activityInstance : processInstance.getActivityInstances(activityId)) {
if (activityInstance.getId().equals(formDataDoc.getActivityInstanceId()))
taskInstances.add(taskInstance);
}
} catch (MbengException ex) {
throw new DataAccessException(-1, ex.getMessage(), ex);
}
} else {
// task instance secondary owner is work transition instance
Long workTransInstId = taskInstance.getSecondaryOwnerId();
for (WorkTransitionInstanceVO transitionInstance : processInstance.getTransitions()) {
if (transitionInstance.getTransitionInstanceID().equals(workTransInstId)) {
Long transitionId = transitionInstance.getTransitionID();
WorkTransitionVO workTrans = process.getWorkTransition(transitionId);
if (workTrans == null && process.getSubProcesses() != null) {
for (ProcessVO subproc : process.getSubProcesses()) {
workTrans = subproc.getWorkTransition(transitionId);
if (workTrans != null)
break;
}
}
if (workTrans != null && workTrans.getToWorkId().equals(activityId))
taskInstances.add(taskInstance);
}
}
}
}
return taskInstances;
}
Aggregations