org.activiti.engine.ActivitiIllegalArgumentException Java Examples

The following examples show how to use org.activiti.engine.ActivitiIllegalArgumentException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HistoricTaskInstanceQueryImpl.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@Override
public HistoricTaskInstanceQueryImpl processInstanceIdIn(List<String> processInstanceIds) {
  if (processInstanceIds == null) {
    throw new ActivitiIllegalArgumentException("Process instance id list is null");
  }
  if (processInstanceIds.isEmpty()) {
    throw new ActivitiIllegalArgumentException("Process instance id list is empty");
  }
  for (String processInstanceId : processInstanceIds) {
    if (processInstanceId == null) {
      throw new ActivitiIllegalArgumentException("None of the given process instance ids can be null");
    }
  }

  if (inOrStatement) {
    this.currentOrQueryObject.processInstanceIds = processInstanceIds;
  } else {
    this.processInstanceIds = processInstanceIds;
  }
  return this;
}
 
Example #2
Source File: GetExecutionVariableInstanceCmd.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public VariableInstance 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);
  }
  
  VariableInstance variableEntity = null;
  if (isLocal) {
    variableEntity = execution.getVariableInstanceLocal(variableName, false);
  } else {
    variableEntity = execution.getVariableInstance(variableName, false);
  }
  
  return variableEntity;
}
 
Example #3
Source File: DefaultJobManager.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@Override
public JobEntity moveDeadLetterJobToExecutableJob(DeadLetterJobEntity deadLetterJobEntity, int retries) {
  if (deadLetterJobEntity == null) {
    throw new ActivitiIllegalArgumentException("Null job provided");
  }
  
  JobEntity executableJob = createExecutableJobFromOtherJob(deadLetterJobEntity);
  executableJob.setRetries(retries);
  boolean insertSuccesful = processEngineConfiguration.getJobEntityManager().insertJobEntity(executableJob);
  if (insertSuccesful) {
    processEngineConfiguration.getDeadLetterJobEntityManager().delete(deadLetterJobEntity);
    triggerExecutorIfNeeded(executableJob);
    return executableJob;
  }
  return null;
}
 
Example #4
Source File: HistoricTaskInstanceQueryImpl.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@Override
public HistoricTaskInstanceQuery processCategoryNotIn(List<String> processCategoryNotInList) {
  if (processCategoryNotInList == null) {
    throw new ActivitiIllegalArgumentException("Process category list is null");
  }
  if (processCategoryNotInList.isEmpty()) {
    throw new ActivitiIllegalArgumentException("Process category list is empty");
  }
  for (String processCategory : processCategoryNotInList) {
    if (processCategory == null) {
      throw new ActivitiIllegalArgumentException("None of the given process categories can be null");
    }
  }

  if(inOrStatement) {
    currentOrQueryObject.processCategoryNotInList = processCategoryNotInList;
  } else {
    this.processCategoryNotInList = processCategoryNotInList;
  }
  return this;
}
 
Example #5
Source File: MoveTimerToExecutableJobCmd.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public JobEntity execute(CommandContext commandContext) {

    if (jobId == null) {
      throw new ActivitiIllegalArgumentException("jobId and job is null");
    }

    TimerJobEntity timerJob = commandContext.getTimerJobEntityManager().findById(jobId);

    if (timerJob == null) {
      throw new JobNotFoundException(jobId);
    }

    if (log.isDebugEnabled()) {
      log.debug("Executing timer job {}", timerJob.getId());
    }
    
    return commandContext.getJobManager().moveTimerJobToExecutableJob(timerJob);
  }
 
Example #6
Source File: TaskQueryTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public void testQueryByInvalidDescriptionLikeOr() {
  TaskQuery query = taskService.createTaskQuery()
      .or()
      .taskId("invalid")
      .taskDescriptionLike("invalid");
  assertNull(query.singleResult());
  assertEquals(0, query.list().size());
  assertEquals(0, query.count());
  
  try {
    taskService.createTaskQuery()
      .or()
      .taskId("invalid")
      .taskDescriptionLike(null).list();
    fail();
  } catch (ActivitiIllegalArgumentException e) {
    
  }
}
 
Example #7
Source File: SaveGroupCmd.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public Void execute(CommandContext commandContext) {
  if (group == null) {
    throw new ActivitiIllegalArgumentException("group is null");
  }

  if (commandContext.getGroupEntityManager().isNewGroup(group)) {
    if (group instanceof GroupEntity) {
      commandContext.getGroupEntityManager().insert((GroupEntity) group);
    } else {
      commandContext.getDbSqlSession().insert((Entity) group);
    }
  } else {
    if (group instanceof GroupEntity) {
      commandContext.getGroupEntityManager().update((GroupEntity) group);
    } else {
      commandContext.getDbSqlSession().update((Entity) group);
    }
    
  }
  return null;
}
 
Example #8
Source File: TaskQueryTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public void testQueryByInvalidNameOr() {
  TaskQuery query = taskService.createTaskQuery()
      .or()
      .taskId("invalid")
      .taskName("invalid");
  assertNull(query.singleResult());
  assertEquals(0, query.list().size());
  assertEquals(0, query.count());
  
  try {
    taskService.createTaskQuery()
      .or()
      .taskId("invalid")
      .taskName(null).singleResult();
    fail("expected exception");
  } catch (ActivitiIllegalArgumentException e) {
    // OK
  }
}
 
Example #9
Source File: DeploymentManager.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public ProcessDefinition findDeployedProcessDefinitionById(String processDefinitionId) {
  if (processDefinitionId == null) {
    throw new ActivitiIllegalArgumentException("Invalid process definition id : null");
  }

  // first try the cache
  ProcessDefinitionCacheEntry cacheEntry = processDefinitionCache.get(processDefinitionId);
  ProcessDefinition processDefinition = cacheEntry != null ? cacheEntry.getProcessDefinition() : null;

  if (processDefinition == null) {
    processDefinition = processDefinitionEntityManager.findById(processDefinitionId);
    if (processDefinition == null) {
      throw new ActivitiObjectNotFoundException("no deployed process definition found with id '" + processDefinitionId + "'", ProcessDefinition.class);
    }
    processDefinition = resolveProcessDefinition(processDefinition).getProcessDefinition();
  }
  return processDefinition;
}
 
Example #10
Source File: RequestUtil.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public static Date getDate(Map<String, String> requestParams, String name) {
  Date value = null;
  if (requestParams.get(name) != null) {

    String input = requestParams.get(name).trim();

    // this is zero time so we need to add that TZ indicator for
    if (input.endsWith("Z")) {
      input = input.substring(0, input.length() - 1) + "GMT-00:00";
    } else {
      int inset = 6;

      String s0 = input.substring(0, input.length() - inset);
      String s1 = input.substring(input.length() - inset, input.length());

      input = s0 + "GMT" + s1;
    }

    try {
      value = longDateFormat.parse(input);
    } catch (Exception e) {
      throw new ActivitiIllegalArgumentException("Failed to parse date " + input);
    }
  }
  return value;
}
 
Example #11
Source File: GroupQueryTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void testQueryByInvalidId() {
  GroupQuery query = identityService.createGroupQuery().groupId("invalid");
  verifyQueryResults(query, 0);
  
  try {
    identityService.createGroupQuery().groupId(null).list();
    fail();
  } catch (ActivitiIllegalArgumentException e) {}
}
 
Example #12
Source File: SkipExpressionUtil.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public static boolean shouldSkipFlowElement(CommandContext commandContext, DelegateExecution execution, String skipExpressionString) {
  Expression skipExpression = commandContext.getProcessEngineConfiguration().getExpressionManager().createExpression(skipExpressionString);
  Object value = skipExpression.getValue(execution);

  if (value instanceof Boolean) {
    return ((Boolean) value).booleanValue();

  } else {
    throw new ActivitiIllegalArgumentException("Skip expression does not resolve to a boolean: " + skipExpression.getExpressionText());
  }
}
 
Example #13
Source File: ProcessInstanceQueryTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void testQueryByProcessInstanceIdsNull() {
  try {
    runtimeService.createProcessInstanceQuery().processInstanceIds(null);
    fail("ActivitiException expected");
  } catch (ActivitiIllegalArgumentException re) {
    assertTextPresent("Set of process instance ids is null", re.getMessage());
  }
}
 
Example #14
Source File: TaskServiceTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void testAddCandidateGroupNullGroupId() {
  try {
    taskService.addCandidateGroup("taskId", null);
    fail("ActivitiException expected");
  } catch (ActivitiIllegalArgumentException ae) {
    assertTextPresent("identityId is null", ae.getMessage());
  }
}
 
Example #15
Source File: ExecutionQueryImpl.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public ExecutionQuery processInstanceBusinessKey(String businessKey) {
  if (businessKey == null) {
    throw new ActivitiIllegalArgumentException("Business key is null");
  }
  this.businessKey = businessKey;
  return this;
}
 
Example #16
Source File: JobQueryImpl.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public JobQuery jobTenantId(String tenantId) {
  if (tenantId == null) {
    throw new ActivitiIllegalArgumentException("job is null");
  }
  this.tenantId = tenantId;
  return this;
}
 
Example #17
Source File: TaskQueryTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void testQueryByNullCandidateUserOr() {
  try {
    taskService.createTaskQuery()
      .or()
      .taskId("invalid")
      .taskCandidateUser(null).list();
    fail();
  } catch(ActivitiIllegalArgumentException e) {}
}
 
Example #18
Source File: RuntimeServiceImpl.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void setVariableLocal(String executionId, String variableName, Object value) {
  if (variableName == null) {
    throw new ActivitiIllegalArgumentException("variableName is null");
  }
  Map<String, Object> variables = new HashMap<String, Object>();
  variables.put(variableName, value);
  commandExecutor.execute(new SetExecutionVariablesCmd(executionId, variables, true));
}
 
Example #19
Source File: DeploymentQueryImpl.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public DeploymentQueryImpl deploymentNameLike(String nameLike) {
  if (nameLike == null) {
    throw new ActivitiIllegalArgumentException("deploymentNameLike is null");
  }
  this.nameLike = nameLike;
  return this;
}
 
Example #20
Source File: TimerJobQueryImpl.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public TimerJobQueryImpl duedateLowerThan(Date date) {
  if (date == null) {
    throw new ActivitiIllegalArgumentException("Provided date is null");
  }
  this.duedateLowerThan = date;
  return this;
}
 
Example #21
Source File: RepositoryServiceTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void testFindDeploymentResourceNamesNullDeploymentId() {
  try {
    repositoryService.getDeploymentResourceNames(null);
    fail("ActivitiException expected");
  } catch (ActivitiIllegalArgumentException ae) {
    assertTextPresent("deploymentId is null", ae.getMessage());
  }
}
 
Example #22
Source File: TaskServiceTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void testAddCandidateGroupNullTaskId() {
  try {
    taskService.addCandidateGroup(null, "groupId");
    fail("ActivitiException expected");
  } catch (ActivitiIllegalArgumentException ae) {
    assertTextPresent("taskId is null", ae.getMessage());
  }
}
 
Example #23
Source File: GroupQueryImpl.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public GroupQuery groupMember(String userId) {
  if (userId == null) {
    throw new ActivitiIllegalArgumentException("Provided userId is null");
  }
  this.userId = userId;
  return this;
}
 
Example #24
Source File: JobQueryTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void testInvalidOnlyTimersUsage() {
  try {
    managementService.createJobQuery().timers().messages().list();
    fail();
  } catch (ActivitiIllegalArgumentException e) {
    assertTextPresent("Cannot combine onlyTimers() with onlyMessages() in the same query", e.getMessage());
  }
}
 
Example #25
Source File: ProcessDefinitionQueryTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void testQueryByInvalidDeploymentId() {
  ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().deploymentId("invalid");
  verifyQueryResults(query, 0);
  
  try {
    repositoryService.createProcessDefinitionQuery().deploymentId(null);
    fail();
  } catch (ActivitiIllegalArgumentException e) {}
}
 
Example #26
Source File: RuntimeServiceTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void testFindActiveActivityIdsNullExecututionId() {
  try {
    runtimeService.getActiveActivityIds(null);      
    fail("ActivitiException expected");
  } catch (ActivitiIllegalArgumentException ae) {
    assertTextPresent("executionId is null", ae.getMessage());
  }
}
 
Example #27
Source File: TaskServiceTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void testRemoveVariableNullTaskId() {
  try {
    taskService.removeVariable(null, "variable");
    fail("ActivitiException expected");
  } catch (ActivitiIllegalArgumentException ae) {
    assertTextPresent("taskId is null", ae.getMessage());
  }
}
 
Example #28
Source File: RestVariable.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public static RestVariableScope getScopeFromString(String scope) {
  if (scope != null) {
    for (RestVariableScope s : RestVariableScope.values()) {
      if (s.name().equalsIgnoreCase(scope)) {
        return s;
      }
    }
    throw new ActivitiIllegalArgumentException("Invalid variable scope: '" + scope + "'");
  } else {
    return null;
  }
}
 
Example #29
Source File: ModelQueryImpl.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public ModelQueryImpl modelCategoryNotEquals(String categoryNotEquals) {
  if (categoryNotEquals == null) {
    throw new ActivitiIllegalArgumentException("categoryNotEquals is null");
  }
  this.categoryNotEquals = categoryNotEquals;
  return this;
}
 
Example #30
Source File: DateFormType.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public Object convertFormValueToModelValue(String propertyValue) {
  if (StringUtils.isEmpty(propertyValue)) {
    return null;
  }
  try {
    return dateFormat.parseObject(propertyValue);
  } catch (ParseException e) {
    throw new ActivitiIllegalArgumentException("invalid date value " + propertyValue);
  }
}