public List<Map<String, String>> findTaskNodes(String processDefinitionId) { List<Map<String, String>> list = new ArrayList<Map<String, String>>(); RepositoryService repositoryService = processEngine.getRepositoryService(); ProcessDefinition processDefinition = repositoryService .createProcessDefinitionQuery() .processDefinitionId(processDefinitionId) .uniqueResult(); InputStream input = repositoryService.getResourceAsStream( processDefinition.getDeploymentId(), processDefinition.getKey() + ".jpdl.xml"); try { Document doc = new SAXReader().read(input); for (Iterator i = doc.getRootElement().elementIterator("task"); i.hasNext(); ) { Element foo = (Element) i.next(); String act = foo.attributeValue("name"); Map<String, String> rec = new HashMap<String, String>(); TaskUsers taskUsers = (TaskUsers) sessionFactory .getCurrentSession() .get(TaskUsers.class, processDefinitionId + "_" + act); rec.put("name", act); if (taskUsers != null) { rec.put("type", taskUsers.getType()); rec.put("value", taskUsers.getEntityId()); rec.put("text", taskUsers.getEntityName()); } list.add(rec); } } catch (DocumentException e) { e.printStackTrace(); } return list; }
public void deployWithImage(ZipInputStream myFile) throws FileUploadException, IOException { repositoryService.createDeployment().addResourcesFromZipInputStream(myFile).deploy(); }