private String statusList(Map<String, String> parameters) throws Exception { WorkflowStatus[] list = studioController.getWorkflowStatuses(sessionUid, Long.parseLong(parameters.get("uid"))); WorkflowStatusDefinition[] results = new WorkflowStatusDefinition[list.length]; int ind = 0; for (WorkflowStatus it : list) { WorkflowStatusDefinition n = new WorkflowStatusDefinition(); n.setPosition(ind); n.setWorkflowStatus(it); WorkflowStatusManager[] mn = studioController.getWorkflowStatusManagers(sessionUid, it.getUid()); n.setWorkflowStatusManagers(mn); results[ind] = n; ind++; } XStream xml = new XStream(new DomDriver()); XStream xstream = new XStream( new JettisonMappedXmlDriver() { public HierarchicalStreamWriter createWriter(Writer writer) { return new JsonWriter(writer, "".toCharArray(), "", JsonWriter.DROP_ROOT_MODE); } }); xstream.aliasField( "securityEntityName", WorkflowStatusManager.class, "localSecurityEntityName"); xstream.aliasField( "securityEntitySource", WorkflowStatusManager.class, "localSecurityEntitySource"); xstream.aliasField( "securityEntityType", WorkflowStatusManager.class, "localSecurityEntityType"); xstream.aliasField("workflowStatusUid", WorkflowStatusManager.class, "localWorkflowStatusUid"); xstream.setMode(XStream.NO_REFERENCES); String jsonResp = xstream.toXML(results); return jsonResp; }
/** @deprecated */ private String createWorkflowStatus(Map<String, String> parameters) throws Exception { long workflowUid = Long.parseLong(parameters.get("workflowUid")); String workflowName = parameters.get("workflowName"); String workflowDescription = parameters.get("workflowDescription"); String statusName = parameters.get("statusName"); // Vector<WorkflowStatusDefinition> workflowStatus = new // Vector<WorkflowStatusDefinition>(); // XMLGenerators.getWorkflowXMLDescriptor(workflowUid, workflowStatus); String xmlStream = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; xmlStream += "<workflow uid=\"" + workflowUid + "\">\n"; for (WorkflowStatus ws : studioController.getWorkflowStatuses(sessionUid, workflowUid)) { xmlStream += "<status uid=\"" + ws.getUid() + "\" successor-uid=\"" + ws.getSuccessorUid() + "\">"; xmlStream += "<name>" + ws.getName() + "</name>\n"; for (WorkflowStatusManager wsm : studioController.getWorkflowStatusManagers(sessionUid, ws.getUid())) { xmlStream += "<manager type=\"" + 1 + "\" uid=\"" + wsm.getSecurityEntityName() + "\" source=\"" + wsm.getSecurityEntitySource() + "\" />"; } xmlStream += "</status>\n"; } xmlStream += "<status uid=\"-1\" successor-uid=\"-1\">"; xmlStream += "<name>" + statusName + "</name>"; xmlStream += "</status>\n"; xmlStream += "</workflow>\n"; studioController.updateWorkflow( sessionUid, workflowUid, workflowName, workflowDescription, xmlStream); return ""; }