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());
WorkflowProcess wp = new WorkflowProcess();
//find package name
String packageVersion = (version != null && !version.isEmpty()) ? version : pa.getCurrentPackageVersion(sessionHandle, ent.getPkgId());
WMEntity entity = pa.getPackageEntity(sessionHandle, ent.getPkgId(), packageVersion);
String packageName = entity.getName();
wp.setId(pm.name());
wp.setPackageId(MiscUtilities.getProcessMgrPkgId(pm.name()));
wp.setPackageName(packageName);
wp.setName(ent.getName());
wp.setVersion(pm.version());
wp.setDescription(pm.description());
wp.setCategory(pm.category());
String currentVersion = pa.getCurrentPackageVersion(sessionHandle, wp.getPackageId());
wp.setLatest(currentVersion == null || (currentVersion.equals(wp.getVersion())));
processMap.put(wp.getName(), wp);