Package org.activiti.engine

Examples of org.activiti.engine.ActivitiIllegalArgumentException


  @Override
  public void convertVariableValue(Object variableValue, RestVariable result) {
    if(variableValue != null) {
      if(!(variableValue instanceof Date)) {
        throw new ActivitiIllegalArgumentException("Converter can only convert booleans");
      }
      result.setValue(isoFormatter.format(variableValue));
    } else {
      result.setValue(null);
    }
View Full Code Here


  @Override
  public Object getVariableValue(RestVariable result) {
    if(result.getValue() != null) {
      if(!(result.getValue() instanceof Boolean)) {
        throw new ActivitiIllegalArgumentException("Converter can only convert booleans");
      }
      return result.getValue();
    }
    return null;
  }
View Full Code Here

  @Override
  public void convertVariableValue(Object variableValue, RestVariable result) {
    if(variableValue != null) {
      if(!(variableValue instanceof Boolean)) {
        throw new ActivitiIllegalArgumentException("Converter can only convert booleans");
      }
      result.setValue(variableValue);
    } else {
      result.setValue(null);
    }
View Full Code Here

      for (RestVariableScope s : RestVariableScope.values()) {
        if (s.name().equalsIgnoreCase(scope)) {
          return s;
        }
      }
      throw new ActivitiIllegalArgumentException("Invalid variable scope: '" + scope + "'");
    } else {
      return null;
    }
  }
View Full Code Here

  }

  protected void addTaskVariables(HistoricTaskInstanceQuery taskInstanceQuery, List<QueryVariable> variables) {
    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) {
        throw new ActivitiIllegalArgumentException("Value-only query (without a variable-name) is not supported.");
      }

      switch(variable.getVariableOperation()) {
     
      case EQUALS:
        if(nameLess) {
          taskInstanceQuery.taskVariableValueEquals(actualValue);
        } else {
          taskInstanceQuery.taskVariableValueEquals(variable.getName(), actualValue);
        }
        break;
       
      case EQUALS_IGNORE_CASE:
        if(actualValue instanceof String) {
          taskInstanceQuery.taskVariableValueEqualsIgnoreCase(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:
        taskInstanceQuery.taskVariableValueNotEquals(variable.getName(), actualValue);
        break;
       
      case NOT_EQUALS_IGNORE_CASE:
        if(actualValue instanceof String) {
          taskInstanceQuery.taskVariableValueNotEqualsIgnoreCase(variable.getName(), (String)actualValue);
        } else {
          throw new ActivitiIllegalArgumentException("Only string variable values are supported when ignoring casing, but was: " + actualValue.getClass().getName());
        }
        break;
       
      case GREATER_THAN:
        taskInstanceQuery.taskVariableValueGreaterThan(variable.getName(), actualValue);
        break;
       
      case GREATER_THAN_OR_EQUALS:
        taskInstanceQuery.taskVariableValueGreaterThanOrEqual(variable.getName(), actualValue);
        break;
       
      case LESS_THAN:
        taskInstanceQuery.taskVariableValueLessThan(variable.getName(), actualValue);
        break;
       
      case LESS_THAN_OR_EQUALS:
        taskInstanceQuery.taskVariableValueLessThanOrEqual(variable.getName(), actualValue);
        break;
       
      case LIKE:
        if(actualValue instanceof String) {
          taskInstanceQuery.taskVariableValueLike(variable.getName(), (String) actualValue);
        } else {
          throw new ActivitiIllegalArgumentException("Only string variable values are supported using like, but was: " + actualValue.getClass().getName());
        }
        break;
      default:
        throw new ActivitiIllegalArgumentException("Unsupported variable query operation: " + variable.getVariableOperation());
      }
    }
  }
View Full Code Here

  }
 
  protected void addProcessVariables(HistoricTaskInstanceQuery taskInstanceQuery, List<QueryVariable> variables) {
    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) {
        throw new ActivitiIllegalArgumentException("Value-only query (without a variable-name) is not supported.");
      }

      switch(variable.getVariableOperation()) {
     
      case EQUALS:
        taskInstanceQuery.processVariableValueEquals(variable.getName(), actualValue);
        break;
       
      case EQUALS_IGNORE_CASE:
        if(actualValue instanceof String) {
          taskInstanceQuery.processVariableValueEqualsIgnoreCase(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:
        taskInstanceQuery.processVariableValueNotEquals(variable.getName(), actualValue);
        break;
       
      case NOT_EQUALS_IGNORE_CASE:
        if(actualValue instanceof String) {
          taskInstanceQuery.processVariableValueNotEqualsIgnoreCase(variable.getName(), (String)actualValue);
        } else {
          throw new ActivitiIllegalArgumentException("Only string variable values are supported when ignoring casing, but was: " + actualValue.getClass().getName());
        }
        break;
       
      case GREATER_THAN:
        taskInstanceQuery.processVariableValueGreaterThan(variable.getName(), actualValue);
        break;
       
      case GREATER_THAN_OR_EQUALS:
        taskInstanceQuery.processVariableValueGreaterThanOrEqual(variable.getName(), actualValue);
        break;
       
      case LESS_THAN:
        taskInstanceQuery.processVariableValueLessThan(variable.getName(), actualValue);
        break;
       
      case LESS_THAN_OR_EQUALS:
        taskInstanceQuery.processVariableValueLessThanOrEqual(variable.getName(), actualValue);
        break;
       
      case LIKE:
        if(actualValue instanceof String) {
          taskInstanceQuery.processVariableValueLike(variable.getName(), (String) actualValue);
        } else {
          throw new ActivitiIllegalArgumentException("Only string variable values are supported using like, but was: " + actualValue.getClass().getName());
        }
        break;
      default:
        throw new ActivitiIllegalArgumentException("Unsupported variable query operation: " + variable.getVariableOperation());
      }
    }
  }
View Full Code Here

  @Override
  public Object getVariableValue(RestVariable result) {
    if(result.getValue() != null) {
      if(!(result.getValue() instanceof Number)) {
        throw new ActivitiIllegalArgumentException("Converter can only convert shorts");
      }
      return ((Number) result.getValue()).shortValue();
    }
    return null;
  }
View Full Code Here

  @Override
  public void convertVariableValue(Object variableValue, RestVariable result) {
    if(variableValue != null) {
      if(!(variableValue instanceof Short)) {
        throw new ActivitiIllegalArgumentException("Converter can only convert shorts");
      }
      result.setValue(variableValue);
    } else {
      result.setValue(null);
    }
View Full Code Here

  @Override
  public Object getVariableValue(RestVariable result) {
    if(result.getValue() != null) {
      if(!(result.getValue() instanceof Number)) {
        throw new ActivitiIllegalArgumentException("Converter can only convert longs");
      }
      return ((Number) result.getValue()).longValue();
    }
    return null;
  }
View Full Code Here

  @Override
  public void convertVariableValue(Object variableValue, RestVariable result) {
    if(variableValue != null) {
      if(!(variableValue instanceof Long)) {
        throw new ActivitiIllegalArgumentException("Converter can only convert integers");
      }
      result.setValue(variableValue);
    } else {
      result.setValue(null);
    }
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.