use of com.centurylink.mdw.model.value.task.TaskInstanceVO in project mdw-designer by CenturyLinkCloud.
the class TaskInstancesSection method createContextMenu.
private Menu createContextMenu(Shell shell) {
Menu menu = new Menu(shell, SWT.POP_UP);
StructuredSelection selection = (StructuredSelection) tableEditor.getTableViewer().getSelection();
if (selection.size() == 1 && selection.getFirstElement() instanceof TaskInstanceVO) {
final TaskInstanceVO taskInstanceVO = (TaskInstanceVO) selection.getFirstElement();
// view
MenuItem taskMgrItem = new MenuItem(menu, SWT.PUSH);
taskMgrItem.setText("View in Task Manager");
ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor("icons/taskmgr.gif");
taskMgrItem.setImage(imageDesc.createImage());
taskMgrItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
openTaskInstance(taskInstanceVO);
}
});
}
return menu;
}
use of com.centurylink.mdw.model.value.task.TaskInstanceVO 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;
}
use of com.centurylink.mdw.model.value.task.TaskInstanceVO in project mdw-designer by CenturyLinkCloud.
the class DesignerDataAccess method getTaskInstances.
/**
* Returns a map relating activityId to taskInstances for a processInstance.
* Requires a list of task activities which have instances as a parameter.
*/
public Map<Long, List<TaskInstanceVO>> getTaskInstances(ProcessVO process, ProcessInstanceVO processInstance, List<Long> taskActivityIds) throws DataAccessException {
Map<Long, List<TaskInstanceVO>> taskInstances = new HashMap<>();
List<TaskInstanceVO> allTaskInstances = getTaskInstancesForProcessInstance(processInstance.getId());
for (Long actId : taskActivityIds) {
List<TaskInstanceVO> actTaskInstances = getTaskInstances(process, processInstance, actId, allTaskInstances);
if (!actTaskInstances.isEmpty()) {
List<TaskInstanceVO> subTaskInstances = new ArrayList<>();
for (TaskInstanceVO taskInstance : allTaskInstances) {
String secondaryOwner = taskInstance.getSecondaryOwnerType();
if (OwnerType.TASK_INSTANCE.equals(secondaryOwner)) {
for (TaskInstanceVO masterInstance : actTaskInstances) {
if (masterInstance.getTaskInstanceId().equals(taskInstance.getSecondaryOwnerId()))
subTaskInstances.add(taskInstance);
}
}
}
actTaskInstances.addAll(subTaskInstances);
taskInstances.put(actId, actTaskInstances);
}
}
return taskInstances;
}
Aggregations