Search in sources :

Example 61 with ActivitiObjectNotFoundException

use of org.activiti.engine.ActivitiObjectNotFoundException in project Activiti by Activiti.

the class DeleteIdentityLinkForProcessInstanceCmd method execute.

public Void execute(CommandContext commandContext) {
    ExecutionEntity processInstance = commandContext.getExecutionEntityManager().findExecutionById(processInstanceId);
    if (processInstance == null) {
        throw new ActivitiObjectNotFoundException("Cannot find process instance with id " + processInstanceId, ExecutionEntity.class);
    }
    processInstance.deleteIdentityLink(userId, groupId, type);
    commandContext.getHistoryManager().createProcessInstanceIdentityLinkComment(processInstanceId, userId, groupId, type, false);
    return null;
}
Also used : ExecutionEntity(org.activiti.engine.impl.persistence.entity.ExecutionEntity) ActivitiObjectNotFoundException(org.activiti.engine.ActivitiObjectNotFoundException)

Example 62 with ActivitiObjectNotFoundException

use of org.activiti.engine.ActivitiObjectNotFoundException in project Activiti by Activiti.

the class DeploymentManager method findDeployedLatestProcessDefinitionByKeyAndTenantId.

public ProcessDefinitionEntity findDeployedLatestProcessDefinitionByKeyAndTenantId(String processDefinitionKey, String tenantId) {
    ProcessDefinitionEntity processDefinition = Context.getCommandContext().getProcessDefinitionEntityManager().findLatestProcessDefinitionByKeyAndTenantId(processDefinitionKey, tenantId);
    if (processDefinition == null) {
        throw new ActivitiObjectNotFoundException("no processes deployed with key '" + processDefinitionKey + "' for tenant identifier '" + tenantId + "'", ProcessDefinition.class);
    }
    processDefinition = resolveProcessDefinition(processDefinition);
    return processDefinition;
}
Also used : ProcessDefinitionEntity(org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity) ActivitiObjectNotFoundException(org.activiti.engine.ActivitiObjectNotFoundException)

Example 63 with ActivitiObjectNotFoundException

use of org.activiti.engine.ActivitiObjectNotFoundException in project Activiti by Activiti.

the class DeploymentManager method findDeployedLatestProcessDefinitionByKey.

public ProcessDefinitionEntity findDeployedLatestProcessDefinitionByKey(String processDefinitionKey) {
    ProcessDefinitionEntity processDefinition = Context.getCommandContext().getProcessDefinitionEntityManager().findLatestProcessDefinitionByKey(processDefinitionKey);
    if (processDefinition == null) {
        throw new ActivitiObjectNotFoundException("no processes deployed with key '" + processDefinitionKey + "'", ProcessDefinition.class);
    }
    processDefinition = resolveProcessDefinition(processDefinition);
    return processDefinition;
}
Also used : ProcessDefinitionEntity(org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity) ActivitiObjectNotFoundException(org.activiti.engine.ActivitiObjectNotFoundException)

Example 64 with ActivitiObjectNotFoundException

use of org.activiti.engine.ActivitiObjectNotFoundException in project Activiti by Activiti.

the class GetTaskVariableCmd method execute.

public Object execute(CommandContext commandContext) {
    if (taskId == null) {
        throw new ActivitiIllegalArgumentException("taskId is null");
    }
    if (variableName == null) {
        throw new ActivitiIllegalArgumentException("variableName is null");
    }
    TaskEntity task = commandContext.getTaskEntityManager().findTaskById(taskId);
    if (task == null) {
        throw new ActivitiObjectNotFoundException("task " + taskId + " doesn't exist", Task.class);
    }
    Object value;
    if (isLocal) {
        value = task.getVariableLocal(variableName, false);
    } else {
        value = task.getVariable(variableName, false);
    }
    return value;
}
Also used : TaskEntity(org.activiti.engine.impl.persistence.entity.TaskEntity) ActivitiIllegalArgumentException(org.activiti.engine.ActivitiIllegalArgumentException) ActivitiObjectNotFoundException(org.activiti.engine.ActivitiObjectNotFoundException)

Example 65 with ActivitiObjectNotFoundException

use of org.activiti.engine.ActivitiObjectNotFoundException in project Activiti by Activiti.

the class HasExecutionVariableCmd method execute.

public Boolean execute(CommandContext commandContext) {
    if (executionId == null) {
        throw new ActivitiIllegalArgumentException("executionId is null");
    }
    if (variableName == null) {
        throw new ActivitiIllegalArgumentException("variableName is null");
    }
    ExecutionEntity execution = commandContext.getExecutionEntityManager().findExecutionById(executionId);
    if (execution == null) {
        throw new ActivitiObjectNotFoundException("execution " + executionId + " doesn't exist", Execution.class);
    }
    boolean hasVariable = false;
    if (isLocal) {
        hasVariable = execution.hasVariableLocal(variableName);
    } else {
        hasVariable = execution.hasVariable(variableName);
    }
    return hasVariable;
}
Also used : ExecutionEntity(org.activiti.engine.impl.persistence.entity.ExecutionEntity) ActivitiIllegalArgumentException(org.activiti.engine.ActivitiIllegalArgumentException) ActivitiObjectNotFoundException(org.activiti.engine.ActivitiObjectNotFoundException)

Aggregations

ActivitiObjectNotFoundException (org.activiti.engine.ActivitiObjectNotFoundException)88 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)27 ActivitiException (org.activiti.engine.ActivitiException)26 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)26 ProcessDefinitionEntity (org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity)17 ExecutionEntity (org.activiti.engine.impl.persistence.entity.ExecutionEntity)15 Task (org.activiti.engine.task.Task)12 HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)8 User (org.activiti.engine.identity.User)8 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)8 RestVariable (org.activiti.rest.service.api.engine.variable.RestVariable)8 ByteArrayOutputStream (java.io.ByteArrayOutputStream)7 IOException (java.io.IOException)7 ObjectOutputStream (java.io.ObjectOutputStream)7 ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)7 HistoricTaskInstance (org.activiti.engine.history.HistoricTaskInstance)6 RestVariableScope (org.activiti.rest.service.api.engine.variable.RestVariable.RestVariableScope)6 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)6 Comment (org.activiti.engine.task.Comment)5 DeploymentEntity (org.activiti.engine.impl.persistence.entity.DeploymentEntity)4