use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class SubGraph method setInstanceStatus.
/**
* For immediate-display when running process in designer
*/
public void setInstanceStatus(Long procInstId, Integer statusCode) {
if (instances == null)
return;
int n = instances.size();
for (int i = 0; i < n; i++) {
ProcessInstanceVO pi1 = instances.get(i);
if (pi1.getId().equals(procInstId)) {
pi1.setStatusCode(statusCode);
String newStatus = Integer.toString(statusCode);
if (status == null)
status = newStatus;
else if (i >= status.length())
status = status + newStatus;
else if (i == 0)
status = newStatus + status.substring(1);
else if (i == n - 1)
status = status.substring(0, i) + newStatus;
else
status = status.substring(0, i) + newStatus + status.substring(i + 1);
break;
}
}
}
use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class ProcessInstanceUpdater method updateTransitionInstance.
private void updateTransitionInstance(ProcessInstancePage procInstPage, Long procId, Long procInstId, String timestr, String id, String msg) {
ProcessInstanceVO procInst = procInstPage.getProcessInstance();
if (!isShowingThisInstance(procInst.getId()))
this.showInstance(procInstPage);
int k = id.indexOf('.');
String transId = id.substring(0, k);
String transInstId = id.substring(k + 1);
Link link;
if (!procInst.getId().equals(procInstId)) {
// embedded process
link = findLinkInSubgraph(procInstPage.getProcess(), new Long(transId));
procInst = this.findEmbeddedProcessInstance(procInstPage.getProcess(), procInstId);
} else {
link = procInstPage.getProcess().findLink(new Long(transId));
}
if (link != null) {
WorkTransitionInstanceVO transInst = null;
for (WorkTransitionInstanceVO ti : procInst.getTransitions()) {
if (ti.getTransitionInstanceID().toString().equals(transInstId)) {
transInst = ti;
break;
}
}
// Date time = df.parse(timestr);
if (transInst == null) {
transInst = new WorkTransitionInstanceVO();
procInst.getTransitions().add(transInst);
transInst.setTransitionID(new Long(transId));
transInst.setTransitionInstanceID(new Long(transInstId));
transInst.setProcessInstanceID(procInst.getId());
transInst.setStartDate(timestr);
transInst.setEndDate(timestr);
transInst.setStatusCode(WorkTransitionStatus.STATUS_COMPLETED);
link.addInstance(transInst);
}
} else {
System.out.println("Cannot find link with ID " + transId);
}
procInstPage.repaint();
}
use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class ProcessInstanceLoader method loadCompletionMap.
public Graph loadCompletionMap(ProcessVO procdef, ProcessInstanceVO processInstance, DesignerDataAccess dao) throws Exception {
ProcessInstanceVO fullInfo = dao.getProcessInstanceAll(processInstance.getId(), procdef);
processInstance.copyFrom(fullInfo);
Graph graph = new Graph(procdef, processInstance, page.getDataModel().getNodeMetaInfo(), page.frame.getIconFactory());
if (graph.subgraphs != null) {
if (procdef.isInRuleSet()) {
Map<String, String> pMap = new HashMap<String, String>();
pMap.put("owner", OwnerType.MAIN_PROCESS_INSTANCE);
pMap.put("ownerId", processInstance.getId().toString());
pMap.put("processId", procdef.getProcessId().toString());
List<ProcessInstanceVO> childProcessInstances = dao.getProcessInstanceList(pMap, 0, QueryRequest.ALL_ROWS, procdef, null).getItems();
for (ProcessInstanceVO childInst : childProcessInstances) {
ProcessInstanceVO fullChildInfo = dao.getProcessInstanceAll(childInst.getId(), procdef);
childInst.copyFrom(fullChildInfo);
Long subprocId = new Long(childInst.getComment());
for (SubGraph subgraph : graph.subgraphs) {
if (subgraph.getProcessVO().getProcessId().equals(subprocId)) {
List<ProcessInstanceVO> insts = subgraph.getInstances();
if (insts == null) {
insts = new ArrayList<ProcessInstanceVO>();
subgraph.setInstances(insts);
}
insts.add(childInst);
break;
}
}
}
} else {
for (SubGraph subgraph : graph.subgraphs) {
Map<String, String> pMap = new HashMap<String, String>();
pMap.put("owner", OwnerType.PROCESS_INSTANCE);
pMap.put("ownerId", processInstance.getId().toString());
pMap.put("processId", subgraph.getProcessVO().getProcessId().toString());
List<ProcessInstanceVO> childProcessInstances = dao.getProcessInstanceList(pMap, 0, QueryRequest.ALL_ROWS, procdef, null).getItems();
subgraph.setInstances(childProcessInstances);
for (ProcessInstanceVO childInst : childProcessInstances) {
ProcessInstanceVO fullChildInfo = dao.getProcessInstanceAll(childInst.getId(), procdef);
childInst.copyFrom(fullChildInfo);
}
}
}
}
StringBuffer errmsg_buffer = new StringBuffer();
graph.setStatus(errmsg_buffer);
if (errmsg_buffer.length() > 0) {
errmsg = "There are runtime information about activities and transitions\n" + " that are not found in process definition.\n" + "This may happen when the process definition has been modified.\n" + errmsg_buffer.toString();
}
return graph;
}
use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class ProcessStatusPane method paintComponent.
protected void paintComponent(Graphics g) {
if (g instanceof Graphics2D) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
}
super.paintComponent(g);
int nodeLegendY = 5;
g.setColor(new Color(0.8f, 0.8f, 0.5f));
g.drawRect(5, nodeLegendY, 175, nodeLegends.length * 25 + 25);
g.fillRect(5, nodeLegendY, 175, 20);
g.setColor(Color.BLACK);
g.drawString("Activity Status", 10, nodeLegendY + 15);
for (int i = 0; i < nodeLegends.length; i++) {
g.setColor(nodeColors[i]);
g.fillRect(10, nodeLegendY + 25 + i * 25, 20, 20);
g.setColor(Color.BLACK);
g.drawString(nodeLegends[i], 40, nodeLegendY + 40 + 25 * i);
}
int infoY = nodeLegends.length * 25 + 55;
if (page != null) {
ProcessInstanceVO procInst = page.getProcessInstance();
g.drawString("Instance ID: " + procInst.getId(), 10, infoY);
infoY += 20;
g.drawString("Process ID: " + procInst.getProcessId(), 10, infoY);
infoY += 20;
g.drawString("Master ID: " + procInst.getMasterRequestId(), 10, infoY);
infoY += 20;
g.drawString("Process Name: " + procInst.getProcessName(), 10, infoY);
infoY += 20;
g.drawString("Owner Type: " + procInst.getOwner(), 10, infoY);
infoY += 20;
g.drawString("Owner ID: " + procInst.getOwnerId(), 10, infoY);
infoY += 20;
g.drawString("Status: " + workStatuses.get(new Integer(procInst.getStatusCode())), 10, infoY);
infoY += 20;
g.drawString("Start: " + procInst.getStartDate(), 10, infoY);
infoY += 20;
g.drawString("Finish: " + procInst.getEndDate(), 10, infoY);
infoY += 20;
}
}
use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class RuntimeDataAccessRest method getProcessInstanceAll.
public ProcessInstanceVO getProcessInstanceAll(Long processInstanceId) throws DataAccessException {
try {
String pathWithArgs = "Processes/" + processInstanceId;
if (!getServer().isSchemaVersion61())
pathWithArgs = "ProcessInstance?format=json&instanceId=" + processInstanceId;
String response = invokeResourceService(pathWithArgs);
return new ProcessInstanceVO(new JSONObject(response));
} catch (IOException ex) {
throw new DataAccessOfflineException(ex.getMessage(), ex);
} catch (Exception ex) {
throw new DataAccessException(ex.getMessage(), ex);
}
}
Aggregations