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 delete(String deploymentId) {
    ProcessDefinition processDefinition =
        processEngine
            .getRepositoryService()
            .createProcessDefinitionQuery()
            .deploymentId(deploymentId)
            .uniqueResult();
    processEngine
        .getRepositoryService()
        .deleteDeploymentCascade(processDefinition.getDeploymentId());

    Session session = sessionFactory.getCurrentSession();
    session
        .createQuery("delete from TaskUsers tu where tu.id like :id")
        .setParameter("id", processDefinition.getId() + "%")
        .executeUpdate();
  }
Exemplo n.º 3
0
 public JbpmTemplate(ProcessEngine processEngine) {
   this.processEngine = processEngine;
   repositoryService = processEngine.getRepositoryService();
   executionService = processEngine.getExecutionService();
   taskService = processEngine.getTaskService();
   historyService = processEngine.getHistoryService();
   managementService = processEngine.getManagementService();
 }
Exemplo n.º 4
0
 public void setProcessEngine(ProcessEngine processEngine) {
   this.processEngine = processEngine;
   System.out.println(processEngine);
   repositoryService = processEngine.getRepositoryService();
   executionService = processEngine.getExecutionService();
   taskService = processEngine.getTaskService();
   historyService = processEngine.getHistoryService();
   managementService = processEngine.getManagementService();
 }
 public String deploy(InputStream input, String remark) {
   String deploymentId =
       processEngine
           .getRepositoryService()
           .createDeployment()
           .addResourcesFromZipInputStream(new ZipInputStream(input))
           .deploy();
   if (log.isDebugEnabled()) {
     log.debug("deploymentId:" + deploymentId + ",remark:" + remark);
   }
   return deploymentId;
 }
Exemplo n.º 6
0
 // removes any history and process data
 @Transactional
 public String removeAll() {
   try {
     // remove brute force including history and running instances
     processEngine.getRepositoryService().deleteDeploymentCascade(Long.toString(deploymentId));
     hibernateSession.flush();
     return "removedAll";
   } catch (final JbpmException ex) {
     final FacesMessages facesMessages = FacesMessages.instance();
     facesMessages.add(Severity.ERROR, "Error: " + ex.toString());
     ex.printStackTrace();
     return "invalid";
   }
 }
Exemplo n.º 7
0
 // removes just the process keeping the history data
 @Transactional
 public String remove() {
   try {
     // remove if there are no open executions, history information stays
     processEngine.getRepositoryService().deleteDeployment(Long.toString(deploymentId));
     hibernateSession.flush();
     return "removed";
   } catch (final JbpmException ex) {
     final FacesMessages facesMessages = FacesMessages.instance();
     facesMessages.add(Severity.ERROR, "Error: " + ex.toString());
     ex.printStackTrace();
     return "invalid";
   }
 }
 public List<ProcessDefinition> findProcessDefinitions() {
   return processEngine.getRepositoryService().createProcessDefinitionQuery().list();
 }