Package org.jbpm.pvm.internal.model

Examples of org.jbpm.pvm.internal.model.ProcessDefinitionImpl


    def.setName(processDefinition.getName());
    def.setVersion(processDefinition.getVersion());
    def.setKey( processDefinition.getKey() );

    // TODO: why is that not part of the API and requires cast?
    ProcessDefinitionImpl cast = (ProcessDefinitionImpl)processDefinition;

    //def.setDescription(processDefinition.getDescription());
    def.setPackageName(cast.getPackageName());
    def.setDeploymentId(String.valueOf(cast.getDeploymentId()));   
    return def;

  }
View Full Code Here


* @author Tom Baeyens
*/
public class LifeCycleParser extends Parser {

  public Object parseDocumentElement(Element element, Parse parse) {
    ProcessDefinitionImpl lifeCycleProcess = new LifeCycle();
    lifeCycleProcess.setName("TaskLifeCycle");
   
    List<Element> stateElements = XmlUtil.elements(element, "state");
    for (Element stateElement: stateElements) {
      parseState(stateElement, lifeCycleProcess, parse);
    }
    for (Element stateElement: stateElements) {
      parseTransitions(stateElement, lifeCycleProcess, parse);
    }
   
    String initialStateName = null;
    if (element.hasAttribute("initial")) {
      initialStateName = element.getAttribute("initial");
      ActivityImpl initial = (ActivityImpl) lifeCycleProcess.getActivity(initialStateName);
      if (initial!=null) {
        lifeCycleProcess.setInitial(initial);
      } else {
        parse.addProblem("initial "+initialStateName+" doesn't exist", element);
      }
    }
   
View Full Code Here

    List<ProcessDefinition> processDefinitions = new ArrayList<ProcessDefinition>();
    for (Map<String, Object> properties: propertyMaps) {
      String deploymentId = properties.get("deploymentDbid").toString();
      String objectName = (String)properties.get("objectName");
      RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
      ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) repositorySession.getObject(deploymentId, objectName);
      processDefinitions.add(processDefinition);
    }
   
    return processDefinitions;
  }
View Full Code Here

  public static ProcessDefinitionBuilder startProcess() {
    return startProcess(null);
  }

  public static ProcessDefinitionBuilder startProcess(String processDefinitionName) {
    return startProcess(processDefinitionName, new ProcessDefinitionImpl());
  }
View Full Code Here

  // special getters and setters //////////////////////////////////////////////

  public TaskDefinitionImpl getTaskDefinition() {
    if ((taskDefinition == null) && (taskDefinitionName != null) && (execution != null)) {
      ProcessDefinitionImpl processDefinition = execution.getProcessDefinition();
      taskDefinition = processDefinition.getTaskDefinition(taskDefinitionName);
    }

    return taskDefinition;
  }
View Full Code Here

    this.activityName = activityName;
  }

  public String execute(Environment environment) {
    RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
    ProcessDefinitionImpl processDefinition = repositorySession.findProcessDefinitionById(processDefinitionId);
   
    ActivityImpl activity = processDefinition.getActivity(activityName);
   
    ActivityBehaviour behaviour = activity.getBehaviour();
    if (behaviour instanceof FormBehaviour) {
      return ((FormBehaviour)behaviour).getFormResourceName();
    }
View Full Code Here

  public List<String> execute(Environment environment) {
    List<String> activityNames = new ArrayList<String>();
   
    RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
    ProcessDefinitionImpl processDefinition = repositorySession.findProcessDefinitionById(processDefinitionId);
   
    for (ActivityImpl activity: (List<ActivityImpl>) processDefinition.getActivities()) {
      if (activity.getIncomingTransitions().isEmpty()) {
        activityNames.add(activity.getName());
      }
    }
    
View Full Code Here

    this.activityName = activityName;
  }

  public ActivityCoordinates execute(Environment environment) throws Exception {
    RepositorySession repositorySession = environment.get(RepositorySession.class);
    ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) repositorySession.findProcessDefinitionById(processDefinitionId);
    if (processDefinition==null) {
      throw new JbpmException("process definition "+processDefinitionId+" doesn't exist");
    }
    ActivityImpl activity = processDefinition.findActivity(activityName);
    if (activity==null) {
      throw new JbpmException("activity '"+activityName+"' doesn't exist in process definition "+processDefinitionId);
    }
    return activity.getCoordinates();
  }
View Full Code Here

  private static final long serialVersionUID = 1L;
  private static LifeCycleParser lifeCycleParser = new LifeCycleParser();
  private static Map<String, ProcessDefinitionImpl> lifeCycleProcesses = new HashMap<String, ProcessDefinitionImpl>();

  public static String initialise(TaskImpl task) {
    ProcessDefinitionImpl lifeCycle = getLifeCycle(task);
    Map<String, Object> lifeCycleVariables = new HashMap<String, Object>();
    lifeCycleVariables.put("task", task);
    ExecutionImpl lifeCycleExecution = (ExecutionImpl) lifeCycle.createProcessInstance();
    lifeCycleExecution.setVariables(lifeCycleVariables);
    lifeCycleExecution.start();
    return lifeCycleExecution.getActivity().getName();
  }
View Full Code Here

    }
    String resource = task.getLifeCycleResource();
    if (resource==null) {
      throw new JbpmException("task "+task.getClass().getName()+" did'nt return a lifecycle");
    }
    ProcessDefinitionImpl lifeCycleProcess;
    synchronized (lifeCycleProcesses) {
      lifeCycleProcess = lifeCycleProcesses.get(resource);
      if (lifeCycleProcess==null) {
        lifeCycleProcess = (ProcessDefinitionImpl) lifeCycleParser
            .createParse()
View Full Code Here

TOP

Related Classes of org.jbpm.pvm.internal.model.ProcessDefinitionImpl

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.