Package org.jbpm.api

Examples of org.jbpm.api.RepositoryService


            }
            return null;
        }
        private byte[] fetchProcessResource(ProcessInstance pi, String resourceName) {
            ProcessEngine processEngine = getProcessEngine(ProcessToolContext.Util.getThreadProcessToolContext());
            RepositoryService service = processEngine.getRepositoryService();

            ExecutionService executionService = processEngine.getExecutionService();
            org.jbpm.api.ProcessInstance processInstanceById = executionService.findProcessInstanceById(pi.getInternalId());
            String processDefinitionId;
            if (processInstanceById == null) { //look in history service
                HistoryProcessInstanceQuery historyProcessInstanceQuery = processEngine.getHistoryService()
                        .createHistoryProcessInstanceQuery().processInstanceId(pi.getInternalId());
                HistoryProcessInstance historyProcessInstance = historyProcessInstanceQuery.uniqueResult();
                processDefinitionId = historyProcessInstance.getProcessDefinitionId();
            } else {
                processDefinitionId = processInstanceById.getProcessDefinitionId();
            }
            List<ProcessDefinition> latestList = service.createProcessDefinitionQuery()
                    .processDefinitionId(processDefinitionId).orderDesc("deployment.dbid").page(0, 1).list();
            if (!latestList.isEmpty()) {
                String oldDeploymentId = latestList.get(0).getDeploymentId();
                return getDeploymentResource(resourceName, oldDeploymentId);
            }
View Full Code Here


            }
            return null;
        }

        private byte[] getDeploymentResource(String resourceName, String oldDeploymentId) {
            RepositoryService service = getProcessEngine(ProcessToolContext.Util.getThreadProcessToolContext()).getRepositoryService();;
            try {
                InputStream oldStream = service.getResourceAsStream(oldDeploymentId, resourceName);
                try {
                    if (oldStream != null) {
                        ByteArrayOutputStream bos2 = new ByteArrayOutputStream();
                        int c;
                        while ((c = oldStream.read()) >= 0) {
View Full Code Here

            }
            return null;
        }

        public String deployProcessDefinition(String processName, InputStream definitionStream, InputStream processMapImageStream) {
            RepositoryService service = getProcessEngine(ProcessToolContext.Util.getThreadProcessToolContext())
                    .getRepositoryService();
            NewDeployment deployment = service.createDeployment();
            deployment.addResourceFromInputStream(processName + ".jpdl.xml", definitionStream);
            if (processMapImageStream != null)
                deployment.addResourceFromInputStream(processName + ".png", processMapImageStream);
            return deployment.deploy();
        }
View Full Code Here

      currentThread.setContextClassLoader(originalClassLoader);
    }
  }

  protected void deployFile(ProcessEngine processEngine, File processFile) {
    RepositoryService repositoryService = processEngine.getRepositoryService();
    NewDeployment deployment = repositoryService.createDeployment();
    deployment.setName(processFile.getName());
    deployment.setTimestamp(System.currentTimeMillis());
   
    if (processFile.getName().endsWith(".xml")) {
      log("deploying process file "+processFile.getName());
View Full Code Here

TOP

Related Classes of org.jbpm.api.RepositoryService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.