use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class DesignerDataAccess method deleteProcessInstances.
public void deleteProcessInstances(List<ProcessInstanceVO> processInstances) throws DataAccessException {
if (processInstances.isEmpty())
return;
List<Long> ids = new ArrayList<>();
for (ProcessInstanceVO instance : processInstances) ids.add(instance.getId());
rtinfo.deleteProcessInstances(ids);
auditLog(Action.Delete, Entity.ProcessInstance, 0L, ids.get(0) + " ...");
}
use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class ImageServletHelper method generateImageForProcessInstance.
/**
* Generate a process image from the designer server.
*/
public BufferedImage generateImageForProcessInstance(Long pProcInstId) throws ServletException {
try {
DesignerDataAccess dao = new DesignerDataAccess(new Server(), null, onServer);
ProcessInstanceVO pi = dao.getProcessInstanceBase(pProcInstId, null);
if (pi == null) {
throw new ServletException("Failed to locate the ProcessInstance for ProcessInstanceId:" + pProcInstId);
}
return generateImage(pi, dao);
} catch (Exception ex) {
log(ex);
throw new ServletException(ex);
}
}
use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class ImageServletHelper method loadCompletionMap.
private Graph loadCompletionMap(ProcessVO procdef, ProcessInstanceVO processInstance, DesignerDataAccess dao, NodeMetaInfo metainfo) throws Exception {
ProcessInstanceVO fullInfo = dao.getProcessInstanceAll(processInstance.getId(), procdef);
processInstance.copyFrom(fullInfo);
IconFactory iconFactory = new IconFactory();
iconFactory.setDesignerDataAccess(dao);
Graph graph = new Graph(procdef, processInstance, metainfo, iconFactory);
if (graph.subgraphs != null) {
if (procdef.isInRuleSet()) {
Map<String, String> pMap = new HashMap<>();
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<>();
subgraph.setInstances(insts);
}
insts.add(childInst);
break;
}
}
}
} else {
for (SubGraph subgraph : graph.subgraphs) {
Map<String, String> pMap = new HashMap<>();
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);
}
}
}
}
graph.setStatus(new StringBuffer());
return graph;
}
use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class ImageServletHelper method generateImageForSecondaryOwner.
/**
* Generate a process image from the designer server.
*/
public BufferedImage generateImageForSecondaryOwner(String pSecOwner, Long pSecOwnerId) throws ServletException {
try {
DesignerDataAccess dao = new DesignerDataAccess(new Server(), null, onServer);
ProcessInstanceVO pi = dao.getProcessInstanceForSecondary(pSecOwner, pSecOwnerId);
if (pi == null) {
throw new ServletException("Failed to locate the ProcessInstance for Secondary Owner and OwnerId");
}
return generateImage(pi, dao);
} catch (Exception ex) {
log(ex);
throw new ServletException(ex);
}
}
use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class SubGraph method setStatus.
void setStatus(StringBuffer errmsg) {
for (Link link : this.links) link.setColor(Color.LIGHT_GRAY);
if (instances == null)
return;
for (ProcessInstanceVO instance : instances) {
String newStatus = Integer.toString(instance.getStatusCode());
if (status == null)
status = newStatus;
else
status = status + newStatus;
for (ActivityInstanceVO ai : instance.getActivities()) {
Node node = findNode(ai.getDefinitionId());
if (node != null) {
node.addInstance(ai, true);
} else {
if (!OwnerType.PROCESS.equals(ai.getStatusMessage())) {
// not a subgraph
errmsg.append(" activity ").append(ai.getDefinitionId()).append('\n');
}
}
}
String v = processVO.getAttribute(WorkAttributeConstant.START_TRANSITION_ID);
Long startTransitionId = (v == null) ? new Long(0) : new Long(v);
for (WorkTransitionInstanceVO ti : instance.getTransitions()) {
Link link = this.findLink(ti.getTransitionID());
if (link != null) {
link.addInstance(ti);
} else if (!ti.getTransitionID().equals(startTransitionId)) {
errmsg.append(" transition ").append(ti.getTransitionID()).append('\n');
}
}
}
}
Aggregations