Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
org.activiti.engine.impl.TaskServiceImpl Maven / Gradle / Ivy
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.engine.impl;
import org.activiti.engine.ActivitiIllegalArgumentException;
import org.activiti.engine.TaskService;
import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.activiti.engine.impl.cmd.*;
import org.activiti.engine.impl.persistence.entity.VariableInstance;
import org.activiti.engine.runtime.DataObject;
import org.activiti.engine.task.*;
import java.io.InputStream;
import java.util.*;
/**
*/
public class TaskServiceImpl extends ServiceImpl implements TaskService {
public TaskServiceImpl() {
}
public TaskServiceImpl(ProcessEngineConfigurationImpl processEngineConfiguration) {
super(processEngineConfiguration);
}
public Task newTask() {
return newTask(null);
}
public Task newTask(String taskId) {
return commandExecutor.execute(new NewTaskCmd(taskId));
}
public Task saveTask(Task task) {
return commandExecutor.execute(new SaveTaskCmd(task));
}
public void deleteTask(String taskId) {
commandExecutor.execute(new DeleteTaskCmd(taskId, null, false));
}
public void deleteTasks(Collection taskIds) {
commandExecutor.execute(new DeleteTaskCmd(taskIds, null, false));
}
public void deleteTask(String taskId, boolean cascade) {
commandExecutor.execute(new DeleteTaskCmd(taskId, null, cascade));
}
public void deleteTasks(Collection taskIds, boolean cascade) {
commandExecutor.execute(new DeleteTaskCmd(taskIds, null, cascade));
}
@Override
public void deleteTask(String taskId, String deleteReason) {
commandExecutor.execute(new DeleteTaskCmd(taskId, deleteReason, false));
}
@Override
public void deleteTask(String taskId, String deleteReason, boolean cancel) {
commandExecutor.execute(new DeleteTaskCmd(taskId, deleteReason, false, cancel));
}
@Override
public void deleteTasks(Collection taskIds, String deleteReason) {
commandExecutor.execute(new DeleteTaskCmd(taskIds, deleteReason, false, false));
}
@Override
public void deleteTasks(Collection taskIds, String deleteReason, boolean cancel) {
commandExecutor.execute(new DeleteTaskCmd(taskIds, deleteReason, false, cancel));
}
public void setAssignee(String taskId, String userId) {
commandExecutor.execute(new AddIdentityLinkCmd(taskId, userId, AddIdentityLinkCmd.IDENTITY_USER, IdentityLinkType.ASSIGNEE));
}
public void setOwner(String taskId, String userId) {
commandExecutor.execute(new AddIdentityLinkCmd(taskId, userId, AddIdentityLinkCmd.IDENTITY_USER, IdentityLinkType.OWNER));
}
public void addCandidateUser(String taskId, String userId) {
commandExecutor.execute(new AddIdentityLinkCmd(taskId, userId, AddIdentityLinkCmd.IDENTITY_USER, IdentityLinkType.CANDIDATE));
}
public void addCandidateGroup(String taskId, String groupId) {
commandExecutor.execute(new AddIdentityLinkCmd(taskId, groupId, AddIdentityLinkCmd.IDENTITY_GROUP, IdentityLinkType.CANDIDATE));
}
public void addUserIdentityLink(String taskId, String userId, String identityLinkType) {
commandExecutor.execute(new AddIdentityLinkCmd(taskId, userId, AddIdentityLinkCmd.IDENTITY_USER, identityLinkType));
}
public void addGroupIdentityLink(String taskId, String groupId, String identityLinkType) {
commandExecutor.execute(new AddIdentityLinkCmd(taskId, groupId, AddIdentityLinkCmd.IDENTITY_GROUP, identityLinkType));
}
public void deleteCandidateGroup(String taskId, String groupId) {
commandExecutor.execute(new DeleteIdentityLinkCmd(taskId, null, groupId, IdentityLinkType.CANDIDATE));
}
public void deleteCandidateUser(String taskId, String userId) {
commandExecutor.execute(new DeleteIdentityLinkCmd(taskId, userId, null, IdentityLinkType.CANDIDATE));
}
public void deleteGroupIdentityLink(String taskId, String groupId, String identityLinkType) {
commandExecutor.execute(new DeleteIdentityLinkCmd(taskId, null, groupId, identityLinkType));
}
public void deleteUserIdentityLink(String taskId, String userId, String identityLinkType) {
commandExecutor.execute(new DeleteIdentityLinkCmd(taskId, userId, null, identityLinkType));
}
public List getIdentityLinksForTask(String taskId) {
return commandExecutor.execute(new GetIdentityLinksForTaskCmd(taskId));
}
public void claim(String taskId, String userId) {
commandExecutor.execute(new ClaimTaskCmd(taskId, userId));
}
public void unclaim(String taskId) {
commandExecutor.execute(new ClaimTaskCmd(taskId, null));
}
public void complete(String taskId) {
commandExecutor.execute(new CompleteTaskCmd(taskId, null));
}
public void complete(String taskId, Map variables) {
commandExecutor.execute(new CompleteTaskCmd(taskId, variables));
}
@Override
public void complete(String taskId, Map variables, Map transientVariables) {
commandExecutor.execute(new CompleteTaskCmd(taskId, variables, transientVariables));
}
public void complete(String taskId, Map variables, boolean localScope) {
commandExecutor.execute(new CompleteTaskCmd(taskId, variables, localScope));
}
public void delegateTask(String taskId, String userId) {
commandExecutor.execute(new DelegateTaskCmd(taskId, userId));
}
public void resolveTask(String taskId) {
commandExecutor.execute(new ResolveTaskCmd(taskId, null));
}
public void resolveTask(String taskId, Map variables) {
commandExecutor.execute(new ResolveTaskCmd(taskId, variables));
}
@Override
public void resolveTask(String taskId, Map variables, Map transientVariables) {
commandExecutor.execute(new ResolveTaskCmd(taskId, variables, transientVariables));
}
public void setPriority(String taskId, int priority) {
commandExecutor.execute(new SetTaskPriorityCmd(taskId, priority));
}
public void setDueDate(String taskId, Date dueDate) {
commandExecutor.execute(new SetTaskDueDateCmd(taskId, dueDate));
}
public TaskQuery createTaskQuery() {
return new TaskQueryImpl(commandExecutor, processEngineConfiguration.getDatabaseType());
}
public NativeTaskQuery createNativeTaskQuery() {
return new NativeTaskQueryImpl(commandExecutor);
}
public Map getVariables(String taskId) {
return commandExecutor.execute(new GetTaskVariablesCmd(taskId, null, false));
}
public Map getVariablesLocal(String taskId) {
return commandExecutor.execute(new GetTaskVariablesCmd(taskId, null, true));
}
public Map getVariables(String taskId, Collection variableNames) {
return commandExecutor.execute(new GetTaskVariablesCmd(taskId, variableNames, false));
}
public Map getVariablesLocal(String taskId, Collection variableNames) {
return commandExecutor.execute(new GetTaskVariablesCmd(taskId, variableNames, true));
}
public Object getVariable(String taskId, String variableName) {
return commandExecutor.execute(new GetTaskVariableCmd(taskId, variableName, false));
}
@Override
public T getVariable(String taskId, String variableName, Class variableClass) {
return variableClass.cast(getVariable(taskId, variableName));
}
public boolean hasVariable(String taskId, String variableName) {
return commandExecutor.execute(new HasTaskVariableCmd(taskId, variableName, false));
}
public Object getVariableLocal(String taskId, String variableName) {
return commandExecutor.execute(new GetTaskVariableCmd(taskId, variableName, true));
}
@Override
public T getVariableLocal(String taskId, String variableName, Class variableClass) {
return variableClass.cast(getVariableLocal(taskId, variableName));
}
public List getVariableInstancesLocalByTaskIds(Set taskIds) {
return commandExecutor.execute(new GetTasksLocalVariablesCmd(taskIds));
}
public boolean hasVariableLocal(String taskId, String variableName) {
return commandExecutor.execute(new HasTaskVariableCmd(taskId, variableName, true));
}
public void setVariable(String taskId, String variableName, Object value) {
if (variableName == null) {
throw new ActivitiIllegalArgumentException("variableName is null");
}
Map variables = new HashMap();
variables.put(variableName, value);
commandExecutor.execute(new SetTaskVariablesCmd(taskId, variables, false));
}
public void setVariableLocal(String taskId, String variableName, Object value) {
if (variableName == null) {
throw new ActivitiIllegalArgumentException("variableName is null");
}
Map variables = new HashMap();
variables.put(variableName, value);
commandExecutor.execute(new SetTaskVariablesCmd(taskId, variables, true));
}
public void setVariables(String taskId, Map variables) {
commandExecutor.execute(new SetTaskVariablesCmd(taskId, variables, false));
}
public void setVariablesLocal(String taskId, Map variables) {
commandExecutor.execute(new SetTaskVariablesCmd(taskId, variables, true));
}
public void removeVariable(String taskId, String variableName) {
Collection variableNames = new ArrayList();
variableNames.add(variableName);
commandExecutor.execute(new RemoveTaskVariablesCmd(taskId, variableNames, false));
}
public void removeVariableLocal(String taskId, String variableName) {
Collection variableNames = new ArrayList(1);
variableNames.add(variableName);
commandExecutor.execute(new RemoveTaskVariablesCmd(taskId, variableNames, true));
}
public void removeVariables(String taskId, Collection variableNames) {
commandExecutor.execute(new RemoveTaskVariablesCmd(taskId, variableNames, false));
}
public void removeVariablesLocal(String taskId, Collection variableNames) {
commandExecutor.execute(new RemoveTaskVariablesCmd(taskId, variableNames, true));
}
public Comment addComment(String taskId, String processInstance, String message) {
return commandExecutor.execute(new AddCommentCmd(taskId, processInstance, message));
}
public Comment addComment(String taskId, String processInstance, String type, String message) {
return commandExecutor.execute(new AddCommentCmd(taskId, processInstance, type, message));
}
@Override
public Comment getComment(String commentId) {
return commandExecutor.execute(new GetCommentCmd(commentId));
}
@Override
public Event getEvent(String eventId) {
return commandExecutor.execute(new GetTaskEventCmd(eventId));
}
public List getTaskComments(String taskId) {
return commandExecutor.execute(new GetTaskCommentsCmd(taskId));
}
public List getTaskComments(String taskId, String type) {
return commandExecutor.execute(new GetTaskCommentsByTypeCmd(taskId, type));
}
public List getCommentsByType(String type) {
return commandExecutor.execute(new GetTypeCommentsCmd(type));
}
public List getTaskEvents(String taskId) {
return commandExecutor.execute(new GetTaskEventsCmd(taskId));
}
public List getProcessInstanceComments(String processInstanceId) {
return commandExecutor.execute(new GetProcessInstanceCommentsCmd(processInstanceId));
}
public List getProcessInstanceComments(String processInstanceId, String type) {
return commandExecutor.execute(new GetProcessInstanceCommentsCmd(processInstanceId, type));
}
public Attachment createAttachment(String attachmentType, String taskId, String processInstanceId, String attachmentName, String attachmentDescription, InputStream content) {
return commandExecutor.execute(new CreateAttachmentCmd(attachmentType, taskId, processInstanceId, attachmentName, attachmentDescription, content, null));
}
public Attachment createAttachment(String attachmentType, String taskId, String processInstanceId, String attachmentName, String attachmentDescription, String url) {
return commandExecutor.execute(new CreateAttachmentCmd(attachmentType, taskId, processInstanceId, attachmentName, attachmentDescription, null, url));
}
public InputStream getAttachmentContent(String attachmentId) {
return commandExecutor.execute(new GetAttachmentContentCmd(attachmentId));
}
public void deleteAttachment(String attachmentId) {
commandExecutor.execute(new DeleteAttachmentCmd(attachmentId));
}
public void deleteComments(String taskId, String processInstanceId) {
commandExecutor.execute(new DeleteCommentCmd(taskId, processInstanceId, null));
}
@Override
public void deleteComment(String commentId) {
commandExecutor.execute(new DeleteCommentCmd(null, null, commentId));
}
public Attachment getAttachment(String attachmentId) {
return commandExecutor.execute(new GetAttachmentCmd(attachmentId));
}
@SuppressWarnings("unchecked")
public List getTaskAttachments(String taskId) {
return (List) commandExecutor.execute(new GetTaskAttachmentsCmd(taskId));
}
@SuppressWarnings("unchecked")
public List getProcessInstanceAttachments(String processInstanceId) {
return (List) commandExecutor.execute(new GetProcessInstanceAttachmentsCmd(processInstanceId));
}
public void saveAttachment(Attachment attachment) {
commandExecutor.execute(new SaveAttachmentCmd(attachment));
}
public List getSubTasks(String parentTaskId) {
return commandExecutor.execute(new GetSubTasksCmd(parentTaskId));
}
@Override
public VariableInstance getVariableInstance(String taskId, String variableName) {
return commandExecutor.execute(new GetTaskVariableInstanceCmd(taskId, variableName, false));
}
@Override
public VariableInstance getVariableInstanceLocal(String taskId, String variableName) {
return commandExecutor.execute(new GetTaskVariableInstanceCmd(taskId, variableName, true));
}
@Override
public Map getVariableInstances(String taskId) {
return commandExecutor.execute(new GetTaskVariableInstancesCmd(taskId, null, false));
}
@Override
public Map getVariableInstances(String taskId, Collection variableNames) {
return commandExecutor.execute(new GetTaskVariableInstancesCmd(taskId, variableNames, false));
}
@Override
public Map getVariableInstancesLocal(String taskId) {
return commandExecutor.execute(new GetTaskVariableInstancesCmd(taskId, null, true));
}
@Override
public Map getVariableInstancesLocal(String taskId, Collection variableNames) {
return commandExecutor.execute(new GetTaskVariableInstancesCmd(taskId, variableNames, true));
}
@Override
public Map getDataObjects(String taskId) {
return commandExecutor.execute(new GetTaskDataObjectsCmd(taskId, null));
}
@Override
public Map getDataObjects(String taskId, String locale, boolean withLocalizationFallback) {
return commandExecutor.execute(new GetTaskDataObjectsCmd(taskId, null, locale, withLocalizationFallback));
}
@Override
public Map getDataObjects(String taskId, Collection dataObjectNames) {
return commandExecutor.execute(new GetTaskDataObjectsCmd(taskId, dataObjectNames));
}
@Override
public Map getDataObjects(String taskId, Collection dataObjectNames, String locale, boolean withLocalizationFallback) {
return commandExecutor.execute(new GetTaskDataObjectsCmd(taskId, dataObjectNames, locale, withLocalizationFallback));
}
@Override
public DataObject getDataObject(String taskId, String dataObject) {
return commandExecutor.execute(new GetTaskDataObjectCmd(taskId, dataObject));
}
@Override
public DataObject getDataObject(String taskId, String dataObjectName, String locale, boolean withLocalizationFallback) {
return commandExecutor.execute(new GetTaskDataObjectCmd(taskId, dataObjectName, locale, withLocalizationFallback));
}
}