Search in sources :

Example 66 with ActivityImpl

use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.

the class ProcessDefinitionBuilder method buildProcessDefinition.

public PvmProcessDefinition buildProcessDefinition() {
    for (Object[] unresolvedTransition : unresolvedTransitions) {
        TransitionImpl transition = (TransitionImpl) unresolvedTransition[0];
        String destinationActivityName = (String) unresolvedTransition[1];
        ActivityImpl destination = processDefinition.findActivity(destinationActivityName);
        if (destination == null) {
            throw new ActivitiException("destination '" + destinationActivityName + "' not found.  (referenced from transition in '" + transition.getSource().getId() + "')");
        }
        transition.setDestination(destination);
    }
    return processDefinition;
}
Also used : TransitionImpl(org.activiti.engine.impl.pvm.process.TransitionImpl) ActivitiException(org.activiti.engine.ActivitiException) ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl)

Example 67 with ActivityImpl

use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.

the class ProcessDefinitionBuilder method startTransition.

public ProcessDefinitionBuilder startTransition(String destinationActivityId, String transitionId) {
    if (destinationActivityId == null) {
        throw new PvmException("destinationActivityId is null");
    }
    ActivityImpl activity = getActivity();
    transition = activity.createOutgoingTransition(transitionId);
    unresolvedTransitions.add(new Object[] { transition, destinationActivityId });
    processElement = transition;
    return this;
}
Also used : ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl)

Example 68 with ActivityImpl

use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.

the class CustomUserTaskBpmnParseHandler method executeParse.

protected void executeParse(BpmnParse bpmnParse, UserTask userTask) {
    // Do the regular stuff
    super.executeParse(bpmnParse, userTask);
    // Make user tasks always async
    ActivityImpl activity = findActivity(bpmnParse, userTask.getId());
    activity.setAsync(true);
}
Also used : ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl)

Example 69 with ActivityImpl

use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.

the class SecureJavascriptTaskParseHandler method createSecureJavascriptTaskBehavior.

private void createSecureJavascriptTaskBehavior(BpmnParse bpmnParse, ScriptTask scriptTask, String language) {
    if (StringUtils.isEmpty(scriptTask.getScript())) {
        logger.warn("No script provided for scriptTask " + scriptTask.getId());
    }
    ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, scriptTask, BpmnXMLConstants.ELEMENT_TASK_SCRIPT);
    activity.setAsync(scriptTask.isAsynchronous());
    activity.setExclusive(!scriptTask.isNotExclusive());
    activity.setActivityBehavior(new SecureJavascriptTaskActivityBehavior(scriptTask.getId(), scriptTask.getScript(), language, scriptTask.getResultVariable(), scriptTask.isAutoStoreVariables()));
}
Also used : ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl)

Example 70 with ActivityImpl

use of org.activiti.engine.impl.pvm.process.ActivityImpl in project carbon-business-process by wso2.

the class ProcessStatisticsService method getTasks.

/**
 * Return all the tasks/activities in a process
 * @param pId process instance id
 * @return all the tasks/activities in a process
 */
@GET
@Path("/task-instances/{pId}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public ResponseHolder getTasks(@PathParam("pId") String pId) {
    ResponseHolder response = new ResponseHolder();
    List<Object> list = new ArrayList();
    RepositoryService repositoryService = BPMNOSGIService.getRepositoryService();
    ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(pId);
    if (processDefinition != null) {
        for (ActivityImpl activity : processDefinition.getActivities()) {
            TaskInfo taskInfo = new TaskInfo();
            String taskDefKey = activity.getId();
            String type = (String) activity.getProperty("type");
            String taskName = (String) activity.getProperty("name");
            taskInfo.setTaskDefinitionKey(taskDefKey);
            taskInfo.setType(type);
            taskInfo.setName(taskName);
            list.add(taskInfo);
        }
    }
    response.setData(list);
    return response;
}
Also used : TaskInfo(org.wso2.carbon.bpmn.rest.model.stats.TaskInfo) ResponseHolder(org.wso2.carbon.bpmn.rest.model.stats.ResponseHolder) ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl) ArrayList(java.util.ArrayList) ProcessDefinitionEntity(org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity) RepositoryService(org.activiti.engine.RepositoryService) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

ActivityImpl (org.activiti.engine.impl.pvm.process.ActivityImpl)70 ExecutionEntity (org.activiti.engine.impl.persistence.entity.ExecutionEntity)12 ActivitiException (org.activiti.engine.ActivitiException)9 TransitionImpl (org.activiti.engine.impl.pvm.process.TransitionImpl)9 ProcessDefinitionEntity (org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity)8 PvmTransition (org.activiti.engine.impl.pvm.PvmTransition)7 ActivityExecution (org.activiti.engine.impl.pvm.delegate.ActivityExecution)6 ProcessDefinitionImpl (org.activiti.engine.impl.pvm.process.ProcessDefinitionImpl)6 ScopeImpl (org.activiti.engine.impl.pvm.process.ScopeImpl)6 ArrayList (java.util.ArrayList)5 IOSpecification (org.activiti.engine.impl.bpmn.data.IOSpecification)4 ActivityBehavior (org.activiti.engine.impl.pvm.delegate.ActivityBehavior)4 HashMap (java.util.HashMap)3 PvmProcessDefinition (org.activiti.engine.impl.pvm.PvmProcessDefinition)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 List (java.util.List)2 DataAssociation (org.activiti.bpmn.model.DataAssociation)2 EventDefinition (org.activiti.bpmn.model.EventDefinition)2