use of com.centurylink.mdw.model.value.process.ProcessVO in project mdw-designer by CenturyLinkCloud.
the class ProcessLaunchConfiguration method launch.
public void launch(ILaunchConfiguration launchConfig, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
String wfProjectName = launchConfig.getAttribute(WORKFLOW_PROJECT, "");
WorkflowProject workflowProject = WorkflowProjectManager.getInstance().getWorkflowProject(wfProjectName);
if (workflowProject == null) {
showError("Can't locate workflow project: '" + wfProjectName + "'.", PROCESS_LAUNCH, null);
return;
}
if (mode.equals(ILaunchManager.DEBUG_MODE) && !connectForDebug(workflowProject, launchConfig)) {
return;
}
setWriteToConsole(launchConfig.getAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true));
boolean viaExternalEvent = launchConfig.getAttribute(LAUNCH_VIA_EXTERNAL_EVENT, false);
if (viaExternalEvent) {
String request = launchConfig.getAttribute(EXTERNAL_EVENT_REQUEST, "");
fireExternalEvent(workflowProject, request, null);
return;
}
boolean notifyProcess = launchConfig.getAttribute(NOTIFY_PROCESS, false);
if (notifyProcess) {
String eventName = launchConfig.getAttribute(NOTIFY_PROCESS_EVENT, "");
String message = launchConfig.getAttribute(NOTIFY_PROCESS_REQUEST, "");
notifyProcess(workflowProject, eventName, message, null);
return;
}
String processName = launchConfig.getAttribute(PROCESS_NAME, "");
String processVersion = launchConfig.getAttribute(PROCESS_VERSION, "");
WorkflowProcess process = workflowProject.getProcess(processName, processVersion);
if (process == null) {
// handle condition: obsolete version no longer in project list, but
// not yet in archive
ProcessVO procVO = workflowProject.getDesignerProxy().getProcessVO(processName, processVersion);
if (procVO == null) {
showError("Can't locate process '" + processName + " v" + processVersion + "' in " + wfProjectName + ".", PROCESS_LAUNCH, workflowProject);
return;
} else {
process = new WorkflowProcess(workflowProject, procVO);
}
}
String masterRequestId = launchConfig.getAttribute(MASTER_REQUEST_ID, "");
if (masterRequestId.length() == 0) {
showError("Missing masterRequestId.", PROCESS_LAUNCH, workflowProject);
return;
}
String owner = launchConfig.getAttribute(OWNER, "");
String ownerId = launchConfig.getAttribute(OWNER_ID, "");
boolean synchronous = launchConfig.getAttribute(SYNCHRONOUS, false);
String responseVarName = launchConfig.getAttribute(RESPONSE_VAR_NAME, "");
Map<String, String> variableValues = launchConfig.getAttribute(VARIABLE_VALUES, new HashMap<String, String>());
boolean showLogs = launchConfig.getAttribute(SHOW_LOGS, false);
boolean liveView = launchConfig.getAttribute(LIVE_VIEW, false);
launchProcess(process, masterRequestId, owner, new Long(ownerId), synchronous, responseVarName, variableValues, null, showLogs, liveView);
}
use of com.centurylink.mdw.model.value.process.ProcessVO in project mdw-designer by CenturyLinkCloud.
the class ProcessInstanceFilterDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
GridLayout layout = new GridLayout();
layout.marginHeight = 6;
composite.setLayout(layout);
composite.getShell().setText("Process Instance Filters");
TabFolder tabFolder = new TabFolder(composite, SWT.NONE);
createProcessTabItem(tabFolder);
if (process != null && process.getVariables() != null)
createVariablesTabItem(tabFolder);
tabFolder.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if ("Variables".equals(((TabItem) e.item).getText())) {
BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
public void run() {
// populate process variables
variableValues = new ArrayList<>();
String verString = versionCombo.getText().trim();
int version = 0;
if (verString.length() > 0)
version = RuleSetVO.parseVersion(verString);
try {
ProcessVO proc = process.getProject().getDesignerProxy().loadProcess(process.getName(), version);
for (VariableVO variableVO : proc.getVariables()) {
String varName = variableVO.getVariableName();
VariableTypeVO varType = process.getProject().getDataAccess().getVariableType(variableVO.getVariableType());
variableValues.add(new VariableValue(variableVO, varType, filter.getVariableValues().get(varName)));
}
} catch (Exception ex) {
PluginMessages.uiError(ex, "Get Process Variables", process.getProject());
}
}
});
tableContainer.setInput(variableValues);
}
}
});
return composite;
}
use of com.centurylink.mdw.model.value.process.ProcessVO in project mdw-designer by CenturyLinkCloud.
the class Activity method getUpstreamActivityNames.
public List<String> getUpstreamActivityNames() {
List<String> upstreamActivityNames = new ArrayList<String>();
ProcessVO processVO = process.getProcessVO();
for (ActivityVO activityVO : processVO.getUpstreamActivities(getId())) {
upstreamActivityNames.add(activityVO.getActivityName());
}
Collections.sort(upstreamActivityNames);
return upstreamActivityNames;
}
use of com.centurylink.mdw.model.value.process.ProcessVO in project mdw-designer by CenturyLinkCloud.
the class ProcessSearchQuery method run.
public IStatus run(IProgressMonitor monitor) throws OperationCanceledException {
if (getScopedProjects().isEmpty() && getSelectedPackage() != null)
getScopedProjects().add(getSelectedPackage().getProject());
if (getScopedProjects().isEmpty()) {
String msg = "No MDW projects in search scope.";
showError(msg, "MDW Search", null);
return new Status(IStatus.WARNING, MdwPlugin.getPluginId(), 0, msg, null);
}
for (WorkflowProject project : getScopedProjects()) {
if (getSearchType().equals(SearchType.ENTITY_BY_NAME)) {
for (WorkflowProcess process : project.getAllProcessVersions()) {
String name = isCaseSensitive() ? process.getName() : process.getName().toLowerCase();
if ((getPattern().equals("*") || name.indexOf(getPattern()) >= 0) && (getSelectedPackage() == null || (process.getPackage() != null && process.getPackage().equals(getSelectedPackage()))))
getSearchResults().addMatchingElement(process);
}
} else if (getSearchType().equals(SearchType.ENTITY_BY_ID)) {
WorkflowProcess process = project.getProcess(new Long(getPattern()));
if (process == null && project.isRemote() && project.isFilePersist()) {
// could be archived process for remote VCS
try {
ProcessVO procVO = project.getDesignerProxy().getDesignerDataAccess().getProcessDefinition(new Long(getPattern()));
process = new WorkflowProcess(project, procVO);
} catch (Exception ex) {
PluginMessages.log(ex);
}
}
if (process != null && (getSelectedPackage() == null || (process.getPackage() != null && process.getPackage().equals(getSelectedPackage()))))
getSearchResults().addMatchingElement(process);
} else if (getSearchType().equals(SearchType.CONTAINING_ENTITY)) {
try {
for (WorkflowProcess process : project.getDesignerProxy().getProcessesUsingActivityImpl(containedEntityId, containedEntityName)) {
String name = isCaseSensitive() ? process.getName() : process.getName().toLowerCase();
if (getPattern().equals("*") || name.indexOf(getPattern()) >= 0)
getSearchResults().addMatchingElement(process);
}
} catch (DataAccessException ex) {
showError(ex, "Find Processes", project);
}
} else if (getSearchType().equals(SearchType.INVOKING_ENTITY)) {
try {
WorkflowProcess invoked = project.getProcess(getInvokedEntityId());
for (WorkflowProcess process : project.getDesignerProxy().findCallingProcesses(invoked)) {
String name = isCaseSensitive() ? process.getName() : process.getName().toLowerCase();
if (getPattern().equals("*") || name.indexOf(getPattern()) >= 0)
getSearchResults().addMatchingElement(process);
}
} catch (Exception ex) {
showError(ex, "Calling Processes", project);
}
} else if (getSearchType().equals(SearchType.INSTANCE_BY_ENTITY_ID)) {
Map<String, String> criteria = new HashMap<String, String>();
criteria.put("processId", getPattern());
searchInstances(project, criteria);
} else if (getSearchType().equals(SearchType.INSTANCE_BY_ID)) {
Map<String, String> criteria = new HashMap<String, String>();
criteria.put("id", getPattern());
searchInstances(project, criteria);
} else if (getSearchType().equals(SearchType.INSTANCE_BY_MRI)) {
Map<String, String> criteria = new HashMap<String, String>();
if (isCaseSensitive())
criteria.put("masterRequestId", getPattern());
else
criteria.put("masterRequestIdIgnoreCase", getPattern());
searchInstances(project, criteria);
} else {
showError("Unsupported search type: " + getSearchType(), "MDW Search", null);
}
}
if (getSearchResults().getMatchingElements().size() == 0)
return new Status(IStatus.WARNING, MdwPlugin.getPluginId(), 0, "No matching elements found", null);
else
return Status.OK_STATUS;
}
use of com.centurylink.mdw.model.value.process.ProcessVO 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);
}
}
Aggregations