use of org.kie.api.runtime.manager.RuntimeEngine in project camel by apache.
the class JBPMEndpoint method createProducer.
public Producer createProducer() throws Exception {
RemoteRestRuntimeEngineBuilder engineBuilder = RemoteRuntimeEngineFactory.newRestBuilder();
if (configuration.getUserName() != null) {
engineBuilder.addUserName(configuration.getUserName());
}
if (configuration.getPassword() != null) {
engineBuilder.addPassword(configuration.getPassword());
}
if (configuration.getDeploymentId() != null) {
engineBuilder.addDeploymentId(configuration.getDeploymentId());
}
if (configuration.getConnectionURL() != null) {
engineBuilder.addUrl(configuration.getConnectionURL());
}
if (configuration.getProcessInstanceId() != null) {
engineBuilder.addProcessInstanceId(configuration.getProcessInstanceId());
}
if (configuration.getTimeout() != null) {
engineBuilder.addTimeout(configuration.getTimeout());
}
if (configuration.getExtraJaxbClasses() != null) {
engineBuilder.addExtraJaxbClasses(configuration.getExtraJaxbClasses());
}
RuntimeEngine runtimeEngine = engineBuilder.build();
return new JBPMProducer(this, runtimeEngine);
}
use of org.kie.api.runtime.manager.RuntimeEngine in project jbpm by kiegroup.
the class DefaultChecklistManager method selectOptionalTask.
public void selectOptionalTask(String taskName, long processInstanceId) {
RuntimeEngine runtime = getRuntime();
runtime.getKieSession().signalEvent(taskName, null, processInstanceId);
manager.disposeRuntimeEngine(runtime);
}
use of org.kie.api.runtime.manager.RuntimeEngine in project jbpm by kiegroup.
the class DefaultChecklistManager method addTask.
public ChecklistItem addTask(String userId, String[] actorIds, String[] groupIds, String name, String orderingId, long processInstanceId) {
RuntimeEngine runtime = getRuntime();
InternalTask task = (InternalTask) TaskModelProvider.getFactory().newTask();
;
setTaskName(task, name);
setTaskDescription(task, orderingId);
// task.setPriority(priority);
InternalTaskData taskData = (InternalTaskData) TaskModelProvider.getFactory().newTaskData();
taskData.setProcessInstanceId(processInstanceId);
// taskData.setProcessSessionId(sessionId);
taskData.setSkipable(false);
taskData.setDeploymentId("default-singleton");
User cuser = TaskModelProvider.getFactory().newUser();
((InternalOrganizationalEntity) cuser).setId(userId);
taskData.setCreatedBy(cuser);
task.setTaskData(taskData);
InternalPeopleAssignments peopleAssignments = (InternalPeopleAssignments) task.getPeopleAssignments();
if (peopleAssignments == null) {
peopleAssignments = (InternalPeopleAssignments) TaskModelProvider.getFactory().newPeopleAssignments();
peopleAssignments.setPotentialOwners(new ArrayList<OrganizationalEntity>());
peopleAssignments.setBusinessAdministrators(new ArrayList<OrganizationalEntity>());
peopleAssignments.setExcludedOwners(new ArrayList<OrganizationalEntity>());
peopleAssignments.setRecipients(new ArrayList<OrganizationalEntity>());
peopleAssignments.setTaskStakeholders(new ArrayList<OrganizationalEntity>());
task.setPeopleAssignments(peopleAssignments);
}
List<OrganizationalEntity> potentialOwners = new ArrayList<OrganizationalEntity>();
for (String actorId : actorIds) {
User user = TaskModelProvider.getFactory().newUser();
((InternalOrganizationalEntity) user).setId(actorId);
potentialOwners.add(user);
}
for (String groupId : groupIds) {
Group group = TaskModelProvider.getFactory().newGroup();
((InternalOrganizationalEntity) group).setId(groupId);
potentialOwners.add(group);
}
setTaskPotentialOwners(task, potentialOwners);
List<OrganizationalEntity> businessAdministrators = peopleAssignments.getBusinessAdministrators();
User administrator = TaskModelProvider.getFactory().newUser();
((InternalOrganizationalEntity) administrator).setId("Administrator");
businessAdministrators.add(administrator);
TaskService taskService = runtime.getTaskService();
long taskId = taskService.addTask(task, (Map<String, Object>) null);
manager.disposeRuntimeEngine(runtime);
return ChecklistItemFactory.createChecklistItem(taskService.getTaskById(taskId));
}
use of org.kie.api.runtime.manager.RuntimeEngine in project jbpm by kiegroup.
the class DefaultChecklistManager method updateTaskDescription.
public void updateTaskDescription(long taskId, String description) {
RuntimeEngine runtime = getRuntime();
List<I18NText> descriptions = new ArrayList<I18NText>();
I18NText text = TaskModelProvider.getFactory().newI18NText();
((InternalI18NText) text).setLanguage("en-UK");
((InternalI18NText) text).setText(description);
descriptions.add(text);
((InternalTaskService) runtime.getTaskService()).setDescriptions(taskId, descriptions);
manager.disposeRuntimeEngine(runtime);
}
use of org.kie.api.runtime.manager.RuntimeEngine in project jbpm by kiegroup.
the class DefaultChecklistManager method completeTask.
public void completeTask(String userId, long taskId) {
RuntimeEngine runtime = getRuntime();
runtime.getTaskService().start(taskId, userId);
runtime.getTaskService().complete(taskId, userId, null);
manager.disposeRuntimeEngine(runtime);
}
Aggregations