use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class ListView method createContextMenu.
private Menu createContextMenu(Shell shell) {
Menu menu = new Menu(shell, SWT.POP_UP);
final StructuredSelection selection = (StructuredSelection) getTableViewer().getSelection();
if (selection.size() == 1 && selection.getFirstElement() instanceof ProcessInstanceVO) {
final Object element = selection.getFirstElement();
MenuItem openItem = new MenuItem(menu, SWT.PUSH);
openItem.setText("Open");
openItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleOpen(element);
}
});
}
return menu;
}
use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class ProcessHierarchyView method createPartControl.
public void createPartControl(Composite parent) {
treeViewer = new TreeViewer(parent);
treeViewer.setLabelProvider(new ProcessHierarchyLabelProvider());
// action group
actionGroup = new ProcessHierarchyActionGroup(this);
actionGroup.fillActionBars(getViewSite().getActionBars());
treeViewer.addOpenListener(new IOpenListener() {
public void open(OpenEvent event) {
for (Object item : getSelection().toList()) {
if (item instanceof LinkedProcess)
actionGroup.getActionHandler().open(((LinkedProcess) item).getProcess());
if (item instanceof LinkedProcessInstance) {
ProcessInstanceVO procInst = ((LinkedProcessInstance) item).getProcessInstance();
WorkflowProcess pv = processVersion.getProject().getProcess(procInst.getProcessId());
if (pv != null) {
WorkflowProcess toOpen = new WorkflowProcess(pv);
toOpen.setProcessInstance(procInst);
actionGroup.getActionHandler().open(toOpen);
}
}
}
}
});
}
use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class ProcessSearchQuery method searchInstances.
private void searchInstances(final WorkflowProject project, Map<String, String> criteria) {
try {
List<ProcessInstanceVO> instances = project.getDesignerProxy().getProcessInstances(criteria);
for (ProcessInstanceVO instanceInfo : instances) {
Long processId = instanceInfo.getProcessId();
if (project.getProcess(processId) == null && instanceInfo.getOwner().equals(OwnerType.PROCESS_INSTANCE)) {
Map<String, String> newCrit = new HashMap<String, String>();
newCrit.put("id", instanceInfo.getOwnerId().toString());
instanceInfo = project.getDesignerProxy().getProcessInstances(newCrit).get(0);
processId = instanceInfo.getProcessId();
}
if (processId != null) {
WorkflowProcess processVersion = project.getProcess(processId);
if (// can
processVersion == null && project.isFilePersist()) // happen
// for
// non-vcs
// processes
// or
// Archived
// processes
{
ProcessVO processVO = new ProcessVO();
processVO.setProcessId(instanceInfo.getProcessId());
processVersion = new WorkflowProcess(project, processVO);
processVersion.setName(instanceInfo.getProcessName());
processVersion.setVersion(RuleSetVO.parseVersion(instanceInfo.getProcessVersion()));
processVO = project.getDataAccess().loadProcess(processVersion);
if (// otherwise retrieval will be
processVO != null)
// just-in-time
processVersion.setProcessVO(processVO);
}
if (processVersion != null) {
WorkflowProcess instance = new WorkflowProcess(processVersion);
instance.setProcessInstance(instanceInfo);
if (!getSearchResults().getMatchingElements().contains(instance))
getSearchResults().addMatchingElement(instance);
}
}
}
} catch (Exception ex) {
showError(ex, "Retrieve Process Instances", project);
}
}
use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class LogWatcher method isEmbeddedProcess.
private boolean isEmbeddedProcess(ProcessInstanceVO processInstance) {
if (processInstance.isNewEmbedded())
return true;
if (!processInstance.getOwner().equals(OwnerType.PROCESS_INSTANCE))
return false;
ProcessInstanceVO parentInstance = processInstances.get(processInstance.getOwnerId());
if (parentInstance == null)
// possible when the instance is a subprocess of an
return false;
// embedded
WorkflowProcess parentProcDef = process.getProject().getProcess(parentInstance.getProcessId());
if (parentProcDef.getProcessVO().getSubProcesses() != null) {
for (ProcessVO childproc : parentProcDef.getProcessVO().getSubProcesses()) {
if (childproc.getProcessId().equals(processInstance.getProcessId()))
return true;
}
}
return false;
}
use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class LogWatcher method handleLogMessage.
private synchronized void handleLogMessage(String message) {
Matcher matcher = pattern.matcher(message);
if (matcher.matches()) {
String time = matcher.group(1);
final Long procId = new Long(matcher.group(2));
final Long procInstId = new Long(matcher.group(3));
String subtype = matcher.group(4);
String id = matcher.group(5);
String msg = matcher.group(6);
try {
ProcessInstanceVO processInstanceInfo = processInstances.get(procInstId);
if (processInstanceInfo == null) {
processInstanceInfo = new DesignerDataAccess(dataAccess).getProcessInstanceBase(procInstId, null);
// only interested in one masterRequestId
if (processInstanceInfo.getMasterRequestId().equals(masterRequestId))
processInstances.put(procInstId, processInstanceInfo);
}
if (!processInstanceInfo.getMasterRequestId().equals(masterRequestId))
return;
// log the message
outputStream.println(message);
if (watchProcess) {
openInstance(processInstanceInfo);
synchronized (this) {
ProcessInstancePage processInstancePage = processInstancePages.get(processInstanceInfo.getId());
accumulated.offer(new ProcessInstanceUpdater(procId, procInstId, processInstancePage, subtype, time, id, msg));
}
}
if (msg.startsWith(WorkStatus.LOGMSG_PROC_COMPLETE) && procId.equals(process.getId()))
scheduleShutdown = true;
} catch (Exception ex) {
PluginMessages.log(ex);
shutdown();
}
}
}
Aggregations