Package org.activiti.engine

Examples of org.activiti.engine.ActivitiIllegalArgumentException


  }
 
  @RequestMapping(value="/management/jobs/{jobId}", method = RequestMethod.POST)
  public void executeJobAction(@PathVariable String jobId, @RequestBody RestActionRequest actionRequest, HttpServletResponse response) {
    if (actionRequest == null || ! EXECUTE_ACTION.equals(actionRequest.getAction())) {
      throw new ActivitiIllegalArgumentException("Invalid action, only 'execute' is supported.");
    }
   
    try {
      managementService.executeJob(jobId);
    } catch(ActivitiObjectNotFoundException aonfe) {
View Full Code Here


   
    String orderAsc = allRequestParams.get("orderAscendingColumn");
    String orderDesc = allRequestParams.get("orderDescendingColumn");
   
    if (orderAsc != null && orderDesc != null) {
      throw new ActivitiIllegalArgumentException("Only one of 'orderAscendingColumn' or 'orderDescendingColumn' can be supplied.");
    }
   
    Integer start = null;
    if (allRequestParams.containsKey("start")) {
      start = Integer.valueOf(allRequestParams.get("start"));
View Full Code Here

  public String convertModelValueToFormValue(Object modelValue) {
    if (modelValue == null) {
      return null;
    }
    if (!(modelValue instanceof ProcessDefinition)) {
      throw new ActivitiIllegalArgumentException("This form type only support process definitions, but is " + modelValue.getClass());
    }
    return ((ProcessDefinition) modelValue).getId();
  }
View Full Code Here

  public String convertModelValueToFormValue(Object modelValue) {
    if (modelValue == null) {
      return null;
    }
    if (!(modelValue instanceof ProcessDefinition)) {
      throw new ActivitiIllegalArgumentException("This form type only support process definitions, but is " + modelValue.getClass());
    }
    return ((ProcessDefinition) modelValue).getId();
  }
View Full Code Here

            case REQUIRED:
                return TransactionTemplate.PROPAGATION_REQUIRED;
            case REQUIRES_NEW:
                return TransactionTemplate.PROPAGATION_REQUIRES_NEW;
            default:
                throw new ActivitiIllegalArgumentException("Unsupported transaction propagation: " + config.getTransactionPropagation());
        }
    }
View Full Code Here

      } else {
        runtimeService.signal(execution.getId());
      }
    } else if(ExecutionActionRequest.ACTION_SIGNAL_EVENT_RECEIVED.equals(actionRequest.getAction())) {
      if (actionRequest.getSignalName() == null) {
        throw new ActivitiIllegalArgumentException("Signal name is required");
      }
      if (actionRequest.getVariables() != null) {
        runtimeService.signalEventReceived(actionRequest.getSignalName(), execution.getId(), getVariablesToSet(actionRequest));
      } else {
        runtimeService.signalEventReceived(actionRequest.getSignalName(), execution.getId());
      }
    } else if (ExecutionActionRequest.ACTION_MESSAGE_EVENT_RECEIVED.equals(actionRequest.getAction())) {
      if (actionRequest.getMessageName() == null) {
        throw new ActivitiIllegalArgumentException("Message name is required");
      }
      if (actionRequest.getVariables() != null) {
        runtimeService.messageEventReceived(actionRequest.getMessageName(), execution.getId(), getVariablesToSet(actionRequest));
      } else {
        runtimeService.messageEventReceived(actionRequest.getMessageName(), execution.getId());
      }
    } else {
      throw new ActivitiIllegalArgumentException("Invalid action: '" + actionRequest.getAction() + "'.");
    }
   
    // Re-fetch the execution, could have changed due to action or even completed
    execution = runtimeService.createExecutionQuery().executionId(execution.getId()).singleResult();
    if (execution == null) {
View Full Code Here

      HttpServletRequest request, HttpServletResponse response) {
   
    ProcessInstance processInstance = getProcessInstanceFromRequest(processInstanceId);
   
    if (identityLink.getGroup() != null)  {
      throw new ActivitiIllegalArgumentException("Only user identity links are supported on a process instance.");
    }
   
    if (identityLink.getUser() == null)  {
      throw new ActivitiIllegalArgumentException("The user is required.");
    }
   
    if (identityLink.getType() == null) {
      throw new ActivitiIllegalArgumentException("The identity link type is required.");
    }

    runtimeService.addUserIdentityLink(processInstance.getId(), identityLink.getUser(), identityLink.getType());
   
    response.setStatus(HttpStatus.CREATED.value());
View Full Code Here

  }

  protected void addVariables(ExecutionQuery processInstanceQuery, List<QueryVariable> variables, boolean process) {
    for (QueryVariable variable : variables) {
      if (variable.getVariableOperation() == null) {
        throw new ActivitiIllegalArgumentException("Variable operation is missing for variable: " + variable.getName());
      }
      if (variable.getValue() == null) {
        throw new ActivitiIllegalArgumentException("Variable value is missing for variable: " + variable.getName());
      }

      boolean nameLess = variable.getName() == null;

      Object actualValue = restResponseFactory.getVariableValue(variable);

      // A value-only query is only possible using equals-operator
      if (nameLess && variable.getVariableOperation() != QueryVariableOperation.EQUALS) {
        throw new ActivitiIllegalArgumentException("Value-only query (without a variable-name) is only supported when using 'equals' operation.");
      }

      switch (variable.getVariableOperation()) {

      case EQUALS:
        if (nameLess) {
          if(process) {
            processInstanceQuery.processVariableValueEquals(actualValue);
          } else {
            processInstanceQuery.variableValueEquals(actualValue);
          }
        } else {
          if(process) {
            processInstanceQuery.processVariableValueEquals(variable.getName(), actualValue);
          } else {
            processInstanceQuery.variableValueEquals(variable.getName(), actualValue);
          }
        }
        break;

      case EQUALS_IGNORE_CASE:
        if (actualValue instanceof String) {
          if(process) {
            processInstanceQuery.processVariableValueEqualsIgnoreCase(variable.getName(), (String) actualValue);
          } else {
            processInstanceQuery.variableValueEqualsIgnoreCase(variable.getName(), (String) actualValue);
          }
        } else {
          throw new ActivitiIllegalArgumentException("Only string variable values are supported when ignoring casing, but was: "
                  + actualValue.getClass().getName());
        }
        break;

      case NOT_EQUALS:
        if(process) {
          processInstanceQuery.processVariableValueNotEquals(variable.getName(), actualValue);
        } else {
          processInstanceQuery.variableValueNotEquals(variable.getName(), actualValue);
        }
        break;

      case NOT_EQUALS_IGNORE_CASE:
        if (actualValue instanceof String) {
          if(process) {
            processInstanceQuery.processVariableValueNotEqualsIgnoreCase(variable.getName(), (String) actualValue);
          } else {
            processInstanceQuery.variableValueNotEqualsIgnoreCase(variable.getName(), (String) actualValue);
          }
        } else {
          throw new ActivitiIllegalArgumentException("Only string variable values are supported when ignoring casing, but was: "
                  + actualValue.getClass().getName());
        }
        break;
      default:
        throw new ActivitiIllegalArgumentException("Unsupported variable query operation: " + variable.getVariableOperation());
      }
    }
  }
View Full Code Here

  protected Map<String, Object> getVariablesToSet(ExecutionActionRequest actionRequest) {
    Map<String, Object> variablesToSet = new HashMap<String, Object>();
    for (RestVariable var : actionRequest.getVariables()) {
      if (var.getName() == null) {
        throw new ActivitiIllegalArgumentException("Variable name is required");
      }
     
      Object actualVariableValue = restResponseFactory.getVariableValue(var);
     
      variablesToSet.put(var.getName(), actualVariableValue);
View Full Code Here

  protected RestVariable setBinaryVariable(MultipartHttpServletRequest request,
      Execution execution, int responseVariableType, boolean isNew, String serverRootUrl) {
   
    // Validate input and set defaults
    if (request.getFileMap().size() == 0) {
      throw new ActivitiIllegalArgumentException("No file content was found in request body.");
    }
   
    // Get first file in the map, ignore possible other files
    MultipartFile file = request.getFile(request.getFileMap().keySet().iterator().next());
   
    if (file == null) {
      throw new ActivitiIllegalArgumentException("No file content was found in request body.");
    }
   
    String variableScope = null;
    String variableName = null;
    String variableType = null;
   
    Map<String, String[]> paramMap = request.getParameterMap();
    for (String parameterName : paramMap.keySet()) {
     
      if (paramMap.get(parameterName).length > 0) {
     
        if (parameterName.equalsIgnoreCase("scope")) {
          variableScope = paramMap.get(parameterName)[0];
         
        } else if (parameterName.equalsIgnoreCase("name")) {
          variableName = paramMap.get(parameterName)[0];
         
        } else if (parameterName.equalsIgnoreCase("type")) {
          variableType = paramMap.get(parameterName)[0];
        }
      }
    }
   
    try {
     
      // Validate input and set defaults
      if (variableName == null) {
        throw new ActivitiIllegalArgumentException("No variable name was found in request body.");
      }
     
      if (variableType != null) {
        if (!RestResponseFactory.BYTE_ARRAY_VARIABLE_TYPE.equals(variableType) && !RestResponseFactory.SERIALIZABLE_VARIABLE_TYPE.equals(variableType)) {
          throw new ActivitiIllegalArgumentException("Only 'binary' and 'serializable' are supported as variable type.");
        }
      } else {
        variableType = RestResponseFactory.BYTE_ARRAY_VARIABLE_TYPE;
      }
     
      RestVariableScope scope = RestVariableScope.LOCAL;
      if (variableScope != null) {
        scope = RestVariable.getScopeFromString(variableScope);
      }
     
      if (variableType.equals(RestResponseFactory.BYTE_ARRAY_VARIABLE_TYPE)) {
        // Use raw bytes as variable value
        byte[] variableBytes = IOUtils.toByteArray(file.getInputStream());
        setVariable(execution, variableName, variableBytes, scope, isNew);
       
      } else {
        // Try deserializing the object
        ObjectInputStream stream = new ObjectInputStream(file.getInputStream());
        Object value = stream.readObject();
        setVariable(execution, variableName, value, scope, isNew);
        stream.close();
      }
     
      if (responseVariableType == RestResponseFactory.VARIABLE_PROCESS) {
        return restResponseFactory.createBinaryRestVariable(variableName, scope, variableType,
            null, null, execution.getId(), serverRootUrl);
      } else {
        return restResponseFactory.createBinaryRestVariable(variableName, scope, variableType, null,
            execution.getId(), null, serverRootUrl);
      }
     
    } catch (IOException ioe) {
      throw new ActivitiIllegalArgumentException("Could not process multipart content", ioe);
    } catch (ClassNotFoundException ioe) {
      throw new ActivitiContentNotSupportedException("The provided body contains a serialized object for which the class is nog found: " + ioe.getMessage());
    }
   
  }
View Full Code Here

TOP

Related Classes of org.activiti.engine.ActivitiIllegalArgumentException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.