Search in sources :

Example 86 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 87 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)87 ExecutionEntity (org.activiti.engine.impl.persistence.entity.ExecutionEntity)15 ActivitiException (org.activiti.engine.ActivitiException)14 ProcessDefinitionEntity (org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity)13 ScopeImpl (org.activiti.engine.impl.pvm.process.ScopeImpl)11 TransitionImpl (org.activiti.engine.impl.pvm.process.TransitionImpl)9 PvmTransition (org.activiti.engine.impl.pvm.PvmTransition)8 BoundaryEvent (org.activiti.bpmn.model.BoundaryEvent)7 ArrayList (java.util.ArrayList)6 ActivityExecution (org.activiti.engine.impl.pvm.delegate.ActivityExecution)6 ProcessDefinitionImpl (org.activiti.engine.impl.pvm.process.ProcessDefinitionImpl)6 List (java.util.List)5 EventDefinition (org.activiti.bpmn.model.EventDefinition)4 StartEvent (org.activiti.bpmn.model.StartEvent)4 IOSpecification (org.activiti.engine.impl.bpmn.data.IOSpecification)4 ActivityBehavior (org.activiti.engine.impl.pvm.delegate.ActivityBehavior)4 HashMap (java.util.HashMap)3 BpmnModel (org.activiti.bpmn.model.BpmnModel)3 IntermediateCatchEvent (org.activiti.bpmn.model.IntermediateCatchEvent)3 PvmProcessDefinition (org.activiti.engine.impl.pvm.PvmProcessDefinition)3