use of com.centurylink.mdw.plugin.designer.properties.editor.AssetLocator in project mdw-designer by CenturyLinkCloud.
the class AssetDrivenActivityCustomSection method determineCustomAttr.
private CustomAttributeVO determineCustomAttr(Activity activity) {
PropertyEditorList propEditorList = new PropertyEditorList(activity);
for (PropertyEditor propertyEditor : propEditorList) {
if (propertyEditor instanceof WorkflowAssetEditor) {
WorkflowAssetEditor assetEditor = (WorkflowAssetEditor) propertyEditor;
propertyEditor.setValue(activity);
AssetLocator locator = new AssetLocator(assetEditor.getElement(), assetEditor.getLocatorType());
WorkflowAsset asset = (WorkflowAsset) locator.assetFromAttr(activity.getAttribute(assetEditor.getAttributeName()));
if (asset != null) {
// language definitively determined by selected asset
return activity.getProject().getDataAccess().getAssetCustomAttribute(asset.getLanguage());
} else {
// guess language based on presence of custom attributes
for (String language : assetEditor.getAssetTypes()) {
CustomAttributeVO customAttr = activity.getProject().getDataAccess().getAssetCustomAttribute(language);
if (customAttr != null && !StringHelper.isEmpty(customAttr.getDefinition()))
return customAttr;
}
}
}
}
return null;
}
use of com.centurylink.mdw.plugin.designer.properties.editor.AssetLocator in project mdw-designer by CenturyLinkCloud.
the class DesignerProxy method getSubProcessInstances.
public List<ProcessInstanceVO> getSubProcessInstances(ProcessInstanceVO parentEmbeddedProcessInstance, Activity activity) {
try {
Long parentProcessInstanceId = parentEmbeddedProcessInstance.getId();
ProcessVO subProcessVO = new ProcessVO();
String subProcName = activity.getAttribute(WorkAttributeConstant.PROCESS_NAME);
String subProcVer = activity.getAttribute(WorkAttributeConstant.PROCESS_VERSION);
WorkflowProcess subProc = new AssetLocator(activity, AssetLocator.Type.PROCESS).getProcessVersion(new AssetVersionSpec(subProcName, subProcVer));
subProcessVO.setProcessId(subProc == null ? 0L : subProc.getId());
subProcessVO.setProcessName(subProcName);
return dataAccess.getDesignerDataAccess().getChildProcessInstance(parentProcessInstanceId, subProcessVO, new ProcessVO());
} catch (Exception ex) {
PluginMessages.uiError(ex, "Load SubProcess Instances", project);
return Collections.emptyList();
}
}
use of com.centurylink.mdw.plugin.designer.properties.editor.AssetLocator in project mdw-designer by CenturyLinkCloud.
the class DesignerProxy method getSubProcessInstances.
public List<ProcessInstanceVO> getSubProcessInstances(WorkflowProcess parentProcess, Activity activity) {
try {
Long parentProcessInstanceId = parentProcess.getProcessInstance().getId();
if (activity.isHeterogeneousSubProcInvoke()) {
List<ProcessInstanceVO> insts = new ArrayList<>();
String procMapStr = activity.getAttribute(WorkAttributeConstant.PROCESS_MAP);
if (procMapStr != null && !procMapStr.isEmpty()) {
List<String[]> procMap = StringHelper.parseTable(procMapStr, ',', ';', 3);
for (String[] row : procMap) {
ProcessVO subProcessVO = new ProcessVO();
AssetVersionSpec spec = new AssetVersionSpec(row[1], row[2] == null ? "0" : row[2]);
AssetLocator locator = new AssetLocator(activity, AssetLocator.Type.PROCESS);
WorkflowProcess found = locator.getProcessVersion(spec);
if (found != null) {
subProcessVO.setProcessId(found.getId());
subProcessVO.setProcessName(found.getName());
insts.addAll(dataAccess.getDesignerDataAccess().getChildProcessInstance(parentProcessInstanceId, subProcessVO, parentProcess.getProcessVO()));
} else {
PluginMessages.log(new Exception("SubProcess not found: " + row[1] + " v" + row[2]));
}
}
}
return insts;
} else if (activity.isManualTask()) {
List<ProcessInstanceVO> insts = new ArrayList<>();
String procMapStr = activity.getAttribute(TaskAttributeConstant.SERVICE_PROCESSES);
if (procMapStr != null && !procMapStr.isEmpty()) {
Map<String, String> pMap = new HashMap<>();
pMap.put("owner", OwnerType.TASK_INSTANCE);
StringBuilder sb = new StringBuilder();
sb.append("(");
if (activity.getTaskInstances() != null) {
for (TaskInstanceVO taskInst : activity.getTaskInstances()) {
if (sb.length() > 1)
sb.append(",");
sb.append(taskInst.getTaskInstanceId().toString());
}
}
sb.append(")");
pMap.put("ownerIdList", sb.toString());
insts = dataAccess.getDesignerDataAccess().getProcessInstanceList(pMap, 0, QueryRequest.ALL_ROWS, parentProcess.getProcessVO(), null).getItems();
}
return insts;
} else {
ProcessVO subProcessVO = new ProcessVO();
String subProcName = activity.getAttribute(WorkAttributeConstant.PROCESS_NAME);
String subProcVer = activity.getAttribute(WorkAttributeConstant.PROCESS_VERSION);
AssetVersionSpec spec = new AssetVersionSpec(subProcName, subProcVer == null ? "0" : subProcVer);
AssetLocator locator = new AssetLocator(activity, AssetLocator.Type.PROCESS);
WorkflowProcess subProc = locator.getProcessVersion(spec);
subProcessVO.setProcessId((subProc == null || subProc.getId() == null) ? 0L : subProc.getId());
subProcessVO.setProcessName(activity.getAttribute(WorkAttributeConstant.PROCESS_NAME));
// handle alias subprocs
String subprocAliasProcessId = activity.getAttribute(WorkAttributeConstant.ALIAS_PROCESS_ID);
if (subprocAliasProcessId != null)
subProcessVO = this.getProcessVO(new Long(subprocAliasProcessId));
return dataAccess.getDesignerDataAccess().getChildProcessInstance(parentProcessInstanceId, subProcessVO, parentProcess.getProcessVO());
}
} catch (Exception ex) {
PluginMessages.uiError(ex, "Load SubProcess Instances (P=" + parentProcess.getId() + ",A=" + activity.getId() + ")", project);
return Collections.emptyList();
}
}
Aggregations