use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class LogWatcher method startup.
public void startup(boolean watchProcess) {
this.watchProcess = watchProcess;
if (logListener != null)
// already started
return;
pattern = Pattern.compile(MESSAGE_REG_EX, Pattern.DOTALL);
processInstancePages = new HashMap<Long, ProcessInstancePage>();
processInstances = new HashMap<Long, ProcessInstanceVO>();
accumulated = new LinkedList<ProcessInstanceUpdater>();
scheduleShutdown = false;
MessageConsole console = MessageConsole.findConsole("Live View Log", icon, display);
console.setRunnableEntity(this);
console.setDefaultShowPref(true);
console.setStatus(MessageConsole.STATUS_RUNNING);
console.clearConsole();
outputStream = console.newMessageStream();
try {
dataAccess = new DesignerDataAccess(process.getProject().getDesignerProxy().getDesignerDataAccess());
logListener = new LogSubscriberSocket(dataAccess, serverSettings.getLogWatcherPort(), process.getProject().isOldNamespaces()) {
protected void handleMessage(String message) {
handleLogMessage(message);
}
};
logListener.start(true);
new Thread(new Runnable() {
public void run() {
processQueue();
}
}).start();
} catch (Exception ex) {
if (outputStream != null)
ex.printStackTrace(new PrintStream(outputStream));
if (logListener != null && !logListener.isClosed()) {
logListener.shutdown();
logListener = null;
}
PluginMessages.uiError(ex, "Monitor Logs", process.getProject());
}
}
use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class ImageServletHelper method generateImageForTaskInstance.
/**
* Generate a process image from the designer server.
*/
public BufferedImage generateImageForTaskInstance(Long pTaskInstId) throws ServletException {
try {
DesignerDataAccess dao = new DesignerDataAccess(new Server(), null, onServer);
ProcessInstanceVO pi = dao.getCauseForTaskInstance(pTaskInstId);
if (pi == null) {
throw new ServletException("Failed to locate the ProcessInstance for TaskInstanceId:" + pTaskInstId);
}
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 WorkflowImageHelper method generateImage.
/**
* Generate a process instance image.
*/
private BufferedImage generateImage(DesignerDataAccess dao) throws Exception {
NodeMetaInfo metainfo = new NodeMetaInfo();
metainfo.init(dao.getActivityImplementors(), DataAccess.currentSchemaVersion);
new ProcessWorker().convert_to_designer(process);
IconFactory iconFactory = new IconFactory();
iconFactory.setDesignerDataAccess(dao);
Graph graph = null;
Node selectedNode = null;
if (processInstance != null) {
processInstance.setProcessName(process.getProcessName());
graph = new Graph(process, processInstance, metainfo, iconFactory);
graph.setStatus(new StringBuffer());
if (embeddedInstances != null) {
for (ProcessInstanceVO embeddedInstance : embeddedInstances) {
if (embeddedInstance.getStatusCode() == null && embeddedInstance.getStatus() != null)
embeddedInstance.setStatusCode(WorkStatuses.getCode(embeddedInstance.getStatus()));
Long embeddedProcId = new Long(embeddedInstance.getComment());
SubGraph subgraph = graph.getSubGraph(embeddedProcId);
if (subgraph != null) {
List<ProcessInstanceVO> insts = subgraph.getInstances();
if (insts == null) {
insts = new ArrayList<ProcessInstanceVO>();
subgraph.setInstances(insts);
}
insts.add(embeddedInstance);
}
}
for (SubGraph subgraph : graph.subgraphs) subgraph.setStatus(new StringBuffer());
}
if (selectedActivityInstanceId != null) {
ActivityInstanceVO selectedInstance = processInstance.getActivity(selectedActivityInstanceId);
if (selectedInstance == null) {
for (SubGraph subgraph : graph.subgraphs) {
if (subgraph.getInstances() != null) {
for (ProcessInstanceVO subinst : subgraph.getInstances()) {
selectedInstance = subinst.getActivity(selectedActivityInstanceId);
if (selectedInstance != null)
break;
}
}
if (selectedInstance != null)
break;
}
}
if (selectedInstance != null)
selectedNode = graph.getNode("A" + selectedInstance.getDefinitionId());
}
} else {
graph = new Graph(process, metainfo, iconFactory);
if (selectedActivity != null)
selectedNode = graph.getNode(selectedActivity);
}
Dimension graphsize = graph.getGraphSize();
WorkflowImage canvas = new WorkflowImage(graph, dao);
if (selectedNode != null)
canvas.setSelectedObject(selectedNode);
int h_margin = 72, v_margin = 72;
BufferedImage image = new BufferedImage(graphsize.width + h_margin, graphsize.height + v_margin, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = image.createGraphics();
canvas.paintComponent(g2);
g2.dispose();
return image;
}
use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class ProcessInstanceSection method setSelection.
@Override
public void setSelection(WorkflowElement selection) {
process = (WorkflowProcess) selection;
ProcessInstanceVO instanceInfo = process.getProcessInstance();
idPropertyEditor.setElement(process);
idPropertyEditor.setValue(instanceInfo.getId());
masterRequestIdPropertyEditor.setElement(process);
masterRequestIdPropertyEditor.setValue(instanceInfo.getMasterRequestId());
statusPropertyEditor.setElement(process);
statusPropertyEditor.setValue(WorkStatuses.getWorkStatuses().get(instanceInfo.getStatusCode()));
ownerPropertyEditor.setElement(process);
ownerPropertyEditor.setValue(instanceInfo.getOwner());
ownerIdPropertyEditor.setElement(process);
ownerIdPropertyEditor.setValue(instanceInfo.getOwnerId());
startDatePropertyEditor.setElement(process);
if (instanceInfo.getStartDate() != null)
startDatePropertyEditor.setValue(instanceInfo.getStartDate());
endDatePropertyEditor.setElement(process);
if (instanceInfo.getEndDate() != null)
endDatePropertyEditor.setValue(instanceInfo.getEndDate());
processLabelPropertyEditor.setElement(process);
if (instanceInfo.getComment() != null)
processLabelPropertyEditor.setValue(instanceInfo.getComment());
}
use of com.centurylink.mdw.model.value.process.ProcessInstanceVO in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createOpenInstanceAction.
private IAction createOpenInstanceAction() {
IAction action = new Action() {
@Override
public void run() {
if (openInstanceApplies(getSelection())) {
WorkflowProject project = ((WorkflowElement) getSelection().getFirstElement()).getProject();
try {
Long procInstId = null;
if (getSelection().getFirstElement() instanceof AutomatedTestResults) {
AutomatedTestResults expectedResults = (AutomatedTestResults) getSelection().getFirstElement();
procInstId = expectedResults.getActualProcessInstanceId();
} else if (getSelection().getFirstElement() instanceof LegacyExpectedResults) {
LegacyExpectedResults expectedResult = (LegacyExpectedResults) getSelection().getFirstElement();
java.io.File resultsFile = expectedResult.getActualResultFile();
TestFile testFile = new TestFile(null, resultsFile.getPath());
testFile.load();
TestFileLine line1 = testFile.getLines().get(0);
procInstId = new Long(line1.getWord(3));
}
if (procInstId == null) {
MessageDialog.openWarning(view.getSite().getShell(), "No Results", "Unable to locate results file.");
return;
}
ProcessInstanceVO procInst = project.getDataAccess().getProcessInstance(procInstId);
Long processId = procInst.getProcessId();
ProcessVO procVO = project.getProcess(processId).getProcessVO();
if (procVO == null)
PluginMessages.uiError("Unable to locate process: " + processId, OPEN_PROCESS_INSTANCE, project);
WorkflowProcess instance = new WorkflowProcess(project, procVO);
instance.setProcessInstance(procInst);
actionHandler.open(instance);
} catch (Exception ex) {
PluginMessages.uiError(ex, OPEN_PROCESS_INSTANCE, project);
}
}
}
};
action.setText(OPEN_PROCESS_INSTANCE);
action.setId(MdwMenuManager.MDW_MENU_PREFIX + OPEN_PROCESS_INSTANCE);
ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor(ICON_PROCESS_GIF);
action.setImageDescriptor(imageDesc);
return action;
}
Aggregations