use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class ProcessInstanceUpdater method updateActivityInstance.
private void updateActivityInstance(ProcessInstancePage procInstPage, Long procId, Long procInstId, String timestr, String id, String msg) {
ProcessInstanceVO procInst = procInstPage.getProcessInstance();
if (!isShowingThisInstance(procInst.getId()))
showInstance(procInstPage);
int k = id.indexOf('.');
String actId = id.substring(0, k);
String actInstId = id.substring(k + 1);
Node node;
if (!procInst.getId().equals(procInstId)) {
// embedded process
node = this.findNodeInSubgraph(procInstPage.getProcess(), new Long(actId));
procInst = this.findEmbeddedProcessInstance(procInstPage.getProcess(), procInstId);
} else {
node = procInstPage.getProcess().findNode(new Long(actId));
}
if (node != null) {
ActivityInstanceVO actInst = null;
for (ActivityInstanceVO ai : procInst.getActivities()) {
if (ai.getId().toString().equals(actInstId)) {
actInst = ai;
break;
}
}
if (actInst == null) {
actInst = new ActivityInstanceVO();
procInst.getActivities().add(actInst);
actInst.setId(new Long(actInstId));
actInst.setDefinitionId(new Long(actId));
actInst.setOwnerId(procInst.getId());
actInst.setStartDate(timestr);
actInst.setStatusCode(WorkStatus.STATUS_IN_PROGRESS);
node.addInstance(actInst, false);
}
if (msg.startsWith(WorkStatus.LOGMSG_COMPLETE)) {
actInst.setEndDate(timestr);
actInst.setStatusCode(WorkStatus.STATUS_COMPLETED);
node.setInstanceStatus(actInst);
} else if (msg.startsWith(WorkStatus.LOGMSG_START)) {
// do nothing - already loaded by code above or by full load
} else if (msg.startsWith(WorkStatus.LOGMSG_FAILED)) {
actInst.setEndDate(timestr);
actInst.setStatusCode(WorkStatus.STATUS_FAILED);
node.setInstanceStatus(actInst);
} else if (msg.startsWith(WorkStatus.LOGMSG_SUSPEND)) {
actInst.setStatusCode(WorkStatus.STATUS_WAITING);
node.setInstanceStatus(actInst);
} else if (msg.startsWith(WorkStatus.LOGMSG_HOLD)) {
actInst.setStatusCode(WorkStatus.STATUS_HOLD);
node.setInstanceStatus(actInst);
} else {
// System.out.println("How to handle activity message '" + msg +"'?");
}
Rectangle aRect = new java.awt.Rectangle(node.x - 10, node.y - 10, node.w + 20, node.h + 30);
procInstPage.canvas.scrollRectToVisible(aRect);
} else {
System.out.println("Cannot find node with ID " + actId);
}
procInstPage.repaint();
}
use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class DesignerDataAccess method getProcessInstanceList.
public ProcessList getProcessInstanceList(Map<String, String> pMap, int pageIndex, int pageSize, ProcessVO procdef, String orderBy) throws DataAccessException {
if (procdef != null && procdef.isRemote()) {
RuntimeDataAccess runTimeInfo = remoteAccess.get(procdef.getRemoteServer()).getRuntimeDataAccess();
ProcessList ret = runTimeInfo.getProcessInstanceList(pMap, pageIndex, pageSize, orderBy);
for (ProcessInstanceVO one : ret.getProcesses()) {
one.setRemoteServer(procdef.getRemoteServer());
}
return ret;
} else {
return rtinfo.getProcessInstanceList(pMap, pageIndex, pageSize, orderBy);
}
}
use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class DesignerDataAccess method getChildProcessInstance.
/**
* Does not work for embedded subprocs in asset processes.
*/
public List<ProcessInstanceVO> getChildProcessInstance(Long processInstanceId, ProcessVO childProcess, ProcessVO parentProcess) throws DataAccessException {
Map<String, String> pMap = new HashMap<>();
if (childProcess.isRemote()) {
RuntimeDataAccess runTimeInfo = remoteAccess.get(childProcess.getRemoteServer()).getRuntimeDataAccess();
List<ProcessInstanceVO> ret;
String ownerType = OwnerType.PROCESS_INSTANCE;
if (parentProcess.isRemote()) {
if (!parentProcess.getRemoteServer().equals(childProcess.getRemoteServer()))
ownerType = parentProcess.getRemoteServer();
} else {
ownerType = currentServer.getApplicationName();
}
pMap.put("owner", ownerType);
pMap.put("ownerId", processInstanceId.toString());
pMap.put(PROCESSID, childProcess.getProcessId().toString());
ProcessList procList = runTimeInfo.getProcessInstanceList(pMap, 0, QueryRequest.ALL_ROWS, null);
ret = procList.getProcesses();
for (ProcessInstanceVO one : ret) {
one.setRemoteServer(childProcess.getRemoteServer());
}
return ret;
} else {
pMap.put("owner", OwnerType.PROCESS_INSTANCE);
pMap.put("ownerId", processInstanceId.toString());
pMap.put(PROCESSID, childProcess.getProcessId().toString());
return getProcessInstanceList(pMap, 0, QueryRequest.ALL_ROWS, childProcess, null).getProcesses();
}
}
use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class ProcessInstanceLoader method createOrUpdateModelRecursive.
private ProcessInstanceTreeModel createOrUpdateModelRecursive(ProcessInstanceVO procInst) throws Exception {
ProcessInstanceTreeModel model;
ProcessInstanceTreeNode node;
if (OwnerType.PROCESS_INSTANCE.equals(procInst.getOwner())) {
// parent is a process instance
model = page.getDataModel().findInstanceTreeAndNode(procInst.getOwnerId(), procInst.getRemoteServer(), procInst.getMasterRequestId());
if (model == null) {
ProcessInstanceVO parentInst = page.frame.dao.getProcessInstanceBase(procInst.getOwnerId(), procInst.getRemoteServer());
model = createOrUpdateModelRecursive(parentInst);
} else {
}
ProcessInstanceTreeNode parentNode = model.getCurrentProcess();
node = parentNode.addChild(model.new ProcessInstanceTreeNode(procInst));
model.setCurrentProcess(node);
} else {
// top level node
model = new ProcessInstanceTreeModel();
node = model.getRoot();
node.setEntry(procInst);
model.setCurrentProcess(node);
}
return model;
}
use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class RunTimeDesignerCanvas method mouseClicked.
public void mouseClicked(MouseEvent arg0) {
if (arg0.getButton() != 1)
return;
if (arg0.getClickCount() != 2)
return;
Graph process = page.getProcess();
int x = arg0.getX();
int y = arg0.getY();
if (process.zoom != 100) {
x = x * 100 / process.zoom;
y = y * 100 / process.zoom;
}
Object obj = process.objectAt(x, y, getGraphics());
if (obj == null)
return;
if (obj instanceof Link) {
Link link = (Link) obj;
try {
List<WorkTransitionInstanceVO> workTransitionList;
Long linkId = new Long(link.conn.getWorkTransitionId());
if (link.from.graph instanceof SubGraph) {
workTransitionList = new ArrayList<WorkTransitionInstanceVO>();
SubGraph subgraph = (SubGraph) link.from.graph;
if (subgraph.getInstances() != null) {
for (ProcessInstanceVO inst : subgraph.getInstances()) {
List<WorkTransitionInstanceVO> coll1 = inst.getTransitionInstances(linkId);
workTransitionList.addAll(coll1);
}
}
} else {
workTransitionList = page.getProcessInstance().getTransitionInstances(linkId);
}
WorkTransitionsDialog workTransDialog = new WorkTransitionsDialog(page.frame);
workTransDialog.setWorkTransitionList(workTransitionList);
workTransDialog.setVisible(true);
} catch (Exception ex) {
ex.printStackTrace();
page.frame.setNewServer();
}
}
}
Aggregations