Package org.jbpm.api

Examples of org.jbpm.api.RepositoryService


    try
    {
      List<ProcessDefinitionRef> results = new ArrayList<ProcessDefinitionRef>();

      RepositoryService repositoryService = this.processEngine.getRepositoryService();

      // active processes
      List<ProcessDefinition> activePds = repositoryService.createProcessDefinitionQuery()
          .notSuspended()
          .orderAsc(ProcessDefinitionQuery.PROPERTY_NAME)
          .list();
    
      for(ProcessDefinition processDefinition : activePds)
      {
        ProcessDefinitionRef ref = ModelAdaptor.adoptDefinition(processDefinition);
        results.add(ref);
      }

      // suspended  processes
      ProcessDefinitionQuery pdQuery2 = repositoryService.createProcessDefinitionQuery();
      pdQuery2.suspended();
      List<ProcessDefinition> suspendedPds = pdQuery2.list();

      for(ProcessDefinition p : suspendedPds)
      {
View Full Code Here


    Environment env = ((EnvironmentFactory)processEngine).openEnvironment();

    try
    {
      RepositoryService repositoryService = this.processEngine.getRepositoryService();
      ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
          .processDefinitionId(procDefId)
          .uniqueResult();
      return ModelAdaptor.adoptDefinition(processDefinition);

    }
View Full Code Here

    Environment env = ((EnvironmentFactory)processEngine).openEnvironment();

    try
    {

      RepositoryService repositoryService = this.processEngine.getRepositoryService();
      ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
          .processDefinitionId(procDefId)
          .uniqueResult();
      if (processDefinition!=null) {
        repositoryService.deleteDeploymentCascade(processDefinition.getDeploymentId());
      }
      return getProcessDefinitions();
    }
    finally
    {
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

    String name = null;

    Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
    try
    {
      RepositoryService repoService = processEngine.getRepositoryService();
      List<String> startActivityNames = repoService.getStartActivityNames(id);

      if(null==startActivityNames) // who knows? I'd expect anything from jbpm
        throw new RuntimeException("Unable to resolve start activity names for process: "+id);

      String defaultActitvity = startActivityNames.get(0);
      if(startActivityNames.size()>1)
      {
        System.out.println("WARN: More then 1 start activity found. Default to " + defaultActitvity + " to resolve the form name.");
      }

      name = repoService.getStartFormResourceName(id, defaultActitvity);      
    }
    finally{
      env.close();
    }
View Full Code Here

    DataHandler result = null;

    try
    {

      RepositoryService repoService = processEngine.getRepositoryService();

      // check if a template exists
      String startFormResourceName = getStartFormName(ref.getReferenceId());
      if(null==startFormResourceName)
        throw new IllegalArgumentException("Process " +ref.getReferenceId() + " doesn't provide a start form");

      ProcessDefinition procDef =
          repoService
              .createProcessDefinitionQuery()
              .processDefinitionId(ref.getReferenceId())
              .uniqueResult();

      InputStream template = repoService.getResourceAsStream(
          procDef.getDeploymentId(), startFormResourceName
      );

      // merge template with process variables
      if(template!=null)
View Full Code Here

    Environment env = ((EnvironmentFactory)processEngine).openEnvironment();

    try
    {
      RepositoryService repositoryService = this.processEngine.getRepositoryService();
      ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
          .processDefinitionId(processId)
          .uniqueResult();

      String imgRes = processDefinition.getImageResourceName();
      InputStream in = repositoryService.getResourceAsStream(
          processDefinition.getDeploymentId(), imgRes
      );

      if(null==in)
        throw new RuntimeException("Failed to retrieve image resource: " +imgRes);
View Full Code Here

      ExecutionImpl processInstance = (ExecutionImpl) query.uniqueResult();

      String currentActivity = processInstance.getProcessInstance().getActivityName();

      // get coordinates
      RepositoryService repoService = this.processEngine.getRepositoryService();
      ActivityCoordinates coords = repoService.getActivityCoordinates(
          processInstance.getProcessDefinitionId(), currentActivity
      );


      results.add(new ActiveNodeInfo(
View Full Code Here

    Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
    boolean hasImageResource = false;

    try
    {
      RepositoryService repositoryService = this.processEngine.getRepositoryService();
      ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
          .processDefinitionId(id)
          .uniqueResult();

      InputStream inputStream = null;
      if(processDefinition!=null)//TODO: JBPM-2383 Suspended definitions don't show up here
      {
        String imgRes = processDefinition.getImageResourceName();
        inputStream = repositoryService.getResourceAsStream(
            processDefinition.getDeploymentId(), imgRes
        );
      }

      if(inputStream!=null)
View Full Code Here

            
             return processResource;
        }

        private byte[] fetchLatestProcessResource(String definitionKey, String resourceName) {
            RepositoryService service = getProcessEngine(ProcessToolContext.Util.getThreadProcessToolContext())
                    .getRepositoryService();
            List<ProcessDefinition> latestList = service.createProcessDefinitionQuery()
                    .processDefinitionKey(definitionKey).orderDesc("deployment.dbid").page(0, 1).list();
            if (!latestList.isEmpty()) {
                String oldDeploymentId = latestList.get(0).getDeploymentId();
                return getDeploymentResource(resourceName, oldDeploymentId);
            }
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.