* @param packageId Optional, to show only processes with the specified package ID
* @param version Optional, to show only for the specified version
* @return
*/
public Collection<WorkflowProcess> getProcessList(String packageId, String version) {
SharkConnection sc = null;
Collection<WorkflowProcess> processList = new ArrayList<WorkflowProcess>();
Map<String, WorkflowProcess> processMap = new TreeMap<String, WorkflowProcess>();
try {
sc = connect();
WfProcessMgrIterator pmi = sc.get_iterator_processmgr();
//filter by package Id
if (packageId != null && packageId.trim().length() > 0) {
String sql = " /*sql PackageId='" + packageId + "'";
if (version != null && version.trim().length() > 0) {
sql += " AND ProcessDefinitionVersion='" + version + "'";
}
sql += " sql*/";
pmi.set_query_expression(sql);
}
WfProcessMgr[] processMgrs = pmi.get_next_n_sequence(0);
Shark shark = Shark.getInstance();
WMSessionHandle sessionHandle = sc.getSessionHandle();
AdminMisc admin = shark.getAdminMisc();
PackageAdministration pa = getSharkPackageAdmin(sessionHandle);
for (int i = 0; i < processMgrs.length; i++) {
WfProcessMgr pm = processMgrs[i];
WMEntity ent = admin.getProcessDefinitionInfoByUniqueProcessDefinitionName(sessionHandle, processMgrs[i].name());