String appId = request.getParameter("appId");
String appVersion = request.getParameter("appVersion");
ApplicationContext ac = AppUtil.getApplicationContext();
AppService appService = (AppService) ac.getBean("appService");
WorkflowManager workflowManager = (WorkflowManager) ac.getBean("workflowManager");
AppDefinition appDef = appService.getAppDefinition(appId, appVersion);
if ("getActivities".equals(action)) {
try {
JSONArray jsonArray = new JSONArray();
PackageDefinition packageDefinition = appDef.getPackageDefinition();
Long packageVersion = (packageDefinition != null) ? packageDefinition.getVersion() : new Long(1);
Collection<WorkflowProcess> processList = workflowManager.getProcessList(appId, packageVersion.toString());
if (processList != null && !processList.isEmpty()) {
for (WorkflowProcess p : processList) {