use of com.centurylink.mdw.model.value.variable.VariableVO in project mdw-designer by CenturyLinkCloud.
the class ProcessLaunchMainTab method refreshVariables.
private void refreshVariables(WorkflowProcess processVersion) {
if (responseVarNameCombo != null) {
String responseVar = responseVarNameCombo.getText();
responseVarNameCombo.removeAll();
responseVarNameCombo.add("");
for (VariableVO outputVar : processVersion.getOutputVariables()) responseVarNameCombo.add(outputVar.getVariableName());
responseVarNameCombo.setText(responseVar);
}
}
use of com.centurylink.mdw.model.value.variable.VariableVO in project mdw-designer by CenturyLinkCloud.
the class DesignerProxy method launchProcess.
public MDWStatusMessage launchProcess(WorkflowProcess processVersion, String masterRequestId, String owner, Long ownerId, List<VariableValue> variableValues, Long activityId) throws DataAccessException, XmlException, JSONException, IOException {
Map<VariableVO, String> variables = new HashMap<>();
for (VariableValue variableValue : variableValues) {
variables.put(variableValue.getVariableVO(), variableValue.getValue());
}
MDWStatusMessageDocument statusMessageDoc = restfulServer.launchProcess(processVersion.getId(), masterRequestId, owner, ownerId, variables, activityId, project.isOldNamespaces());
if (statusMessageDoc.getMDWStatusMessage().getStatusCode() != 0)
throw new RemoteException("Error launching process: " + statusMessageDoc.getMDWStatusMessage().getStatusMessage());
// audit log in separate dao since launch is multi-threaded
UserActionVO userAction = new UserActionVO(project.getUser().getUsername(), Action.Run, processVersion.getActionEntity(), processVersion.getId(), processVersion.getLabel());
userAction.setSource("Eclipse/RCP Designer");
try {
new DesignerDataAccess(dataAccess.getDesignerDataAccess()).auditLog(userAction);
} catch (Exception ex) {
throw new DataAccessException(-1, ex.getMessage(), ex);
}
return statusMessageDoc.getMDWStatusMessage();
}
use of com.centurylink.mdw.model.value.variable.VariableVO in project mdw-designer by CenturyLinkCloud.
the class DesignerProxy method launchSynchronousProcess.
public String launchSynchronousProcess(WorkflowProcess processVersion, String masterRequestId, String owner, Long ownerId, List<VariableValue> variableValues, String responseVarName) throws DataAccessException, XmlException, JSONException, IOException {
Map<VariableVO, String> variables = new HashMap<>();
for (VariableValue variableValue : variableValues) {
variables.put(variableValue.getVariableVO(), variableValue.getValue());
}
boolean oldFormat = !processVersion.getProject().checkRequiredVersion(5, 5);
String ret = restfulServer.launchSynchronousProcess(processVersion.getId(), masterRequestId, owner, ownerId, variables, responseVarName, oldFormat);
dataAccess.auditLog(Action.Run, processVersion);
return ret;
}
use of com.centurylink.mdw.model.value.variable.VariableVO in project mdw-designer by CenturyLinkCloud.
the class DesignerProxy method upgradeAssets.
/**
* Replace obsolete implementors, and other assets (see help doc
* upgradeAssetsDuringImport.html).
*/
public void upgradeAssets(WorkflowPackage packageVersion) throws DataAccessException, IOException {
boolean packageUpdated = false;
PackageVO packageVO = packageVersion.getPackageVO();
List<ProcessVO> processVOs = packageVO.getProcesses();
// update activity implementors
List<ProcessVO> newProcs = new ArrayList<>();
for (ProcessVO processVO : processVOs) {
boolean processUpdated = false;
ProcessVO newProc = dataAccess.getDesignerDataAccess().getProcess(processVO.getProcessId(), processVO);
List<ActivityVO> activities = newProc.getActivities();
if (activities != null) {
for (ActivityVO activityVO : activities) {
if (new ActivityUpgrader(activityVO).doUpgrade())
processUpdated = true;
}
if (newProc.getSubProcesses() != null) {
for (ProcessVO subproc : newProc.getSubProcesses()) {
if (subproc.getActivities() != null) {
for (ActivityVO subprocActivity : subproc.getActivities()) {
if (new ActivityUpgrader(subprocActivity).doUpgrade())
processUpdated = true;
}
}
}
}
}
// update variable types
List<VariableVO> variables = newProc.getVariables();
if (variables != null) {
for (VariableVO variableVO : variables) {
String variableType = variableVO.getVariableType();
String updatedVariableType = Compatibility.getVariableType(variableType);
if (!updatedVariableType.equals(variableType)) {
variableVO.setVariableType(updatedVariableType);
processUpdated = true;
}
}
}
if (processUpdated) {
int processVersion = newProc.getVersion();
processVersion++;
newProc.setVersion(processVersion);
packageUpdated = true;
}
newProcs.add(newProc);
}
// Set old activity implementors in the package to hidden
List<ActivityImplementorVO> activityImplementorVOs = packageVO.getImplementors();
for (ActivityImplementorVO activityImplementorVO : activityImplementorVOs) {
String activityImplClassName = activityImplementorVO.getImplementorClassName();
if (Compatibility.isOldImplementor(activityImplClassName)) {
activityImplementorVO.setHidden(true);
packageUpdated = true;
}
}
if (packageUpdated) {
// update with new assets for saving
packageVO.setProcesses(newProcs);
List<RuleSetVO> newRuleSets = new ArrayList<>();
for (RuleSetVO ruleSet : packageVO.getRuleSets()) newRuleSets.add(getDesignerDataAccess().getRuleSet(ruleSet.getId()));
packageVO.setRuleSets(newRuleSets);
int version = packageVersion.getVersion();
version++;
packageVersion.setVersion(version);
// avoid forcing version
packageVersion.setExported(false);
// increment on save
packageVersion.syncProcesses();
getDesignerDataAccess().savePackage(packageVO, ProcessPersister.PersistType.IMPORT);
}
}
use of com.centurylink.mdw.model.value.variable.VariableVO in project mdw-designer by CenturyLinkCloud.
the class Importer method importProcess.
public WorkflowProcess importProcess(final WorkflowPackage targetPackage, final WorkflowProcess targetProcess, final String xml) throws DataAccessException, RemoteException, XmlException, ValidationException {
CodeTimer timer = new CodeTimer("importProcess()");
ProcessVO importedProcessVO = null;
int schemaVersion = dataAccess.getSchemaVersion();
ProcessImporter importer = DataAccess.getProcessImporter(schemaVersion);
importedProcessVO = importer.importProcess(xml);
if (targetProcess != null && !importedProcessVO.getName().equals(targetProcess.getName()))
throw new ValidationException("Process in XML (" + importedProcessVO.getName() + ") is not " + targetProcess.getName());
for (WorkflowProcess existing : targetPackage.getProject().getAllProcesses()) {
if (existing.getName().equals(importedProcessVO.getName())) {
if (existing.getVersion() == importedProcessVO.getVersion())
throw new ValidationException(existing.getLabel() + " already exists in " + targetPackage.getProject().getLabel() + ".");
if (existing.getVersion() > importedProcessVO.getVersion())
throw new ValidationException(existing.getLabel() + " already exists in " + targetPackage.getProject().getLabel() + " with a version greater than the imported process (v" + importedProcessVO.getVersionString() + ").");
}
}
// designer fix for backward compatibility
ProcessWorker worker = new ProcessWorker();
worker.convert_to_designer(importedProcessVO);
worker.convert_from_designer(importedProcessVO, syncNodeMetaInfo(dataAccess.getDesignerDataModel().getNodeMetaInfo(), importedProcessVO));
if (!importedProcessVO.isInRuleSet()) {
// fix pseudo variables
for (VariableVO varVO : importedProcessVO.getVariables()) varVO.setVariableId(null);
}
importedProcessVO.setPackageName(targetPackage.getName());
WorkflowProcess alreadyInPackage = null;
if (targetPackage.getProject().getProcess(importedProcessVO.getName()) == null)
dataAccess.getDesignerDataAccess().createProcess(importedProcessVO);
else {
alreadyInPackage = targetPackage.getProcess(importedProcessVO.getName());
dataAccess.getDesignerDataAccess().updateProcess(importedProcessVO, importedProcessVO.getVersion(), false);
}
ProcessVO reloaded = dataAccess.getDesignerDataAccess().getProcessDefinition(importedProcessVO.getProcessName(), importedProcessVO.getVersion());
importedProcessVO.setProcessId(reloaded.getProcessId());
if (targetPackage.getProject().getDataAccess().getSupportedSchemaVersion() < DataAccess.schemaVersion52)
updateSubProcessIdAttributes(importedProcessVO);
WorkflowProcess importedProcess = new WorkflowProcess(targetPackage.getProject(), importedProcessVO);
dataAccess.getProcesses(false).add(importedProcess.getProcessVO());
if (alreadyInPackage != null)
targetPackage.removeProcess(alreadyInPackage);
targetPackage.addProcess(importedProcess);
importedProcess.setPackage(targetPackage);
dataAccess.auditLog(Action.Import, importedProcess);
timer.stopAndLog();
return importedProcess;
}
Aggregations