Class WurbletArgumentParser

java.lang.Object
org.tentackle.wurblet.WurbletArgumentParser

public class WurbletArgumentParser extends Object
Parses the wurblet arguments.
The parser analyzes all regular wurblet arguments, i.e. without the options (starting with --). The arguments consist of:
  • a logical expression describing the WHERE clause
  • optional extra arguments, e.g. for attributes to be updated
  • optional sorting criteria
  • optional load joins
The expression ends implicitly at the first sorting criteria or load join or explicitly at the pipe-character |.

An expression consists of operands (which may be arguments or nested expressions) connected via logical operators. There are 3 kinds of operators:

  1. AND
  2. OR
  3. NOT
The default operator, if missing, is AND.
Some examples:
 fee fie
 (foe or foo) and (voice or plugh)
 ((fee or fie) and foe) or foo
 
A complete wurblet example:
 @wurblet selectUpTo PdoSelectList --remote processed:=:null or processed:>= +id *address
 
Author:
harald
  • Constructor Details

    • WurbletArgumentParser

      public WurbletArgumentParser(Entity entity, boolean argumentGroupingEnabled, List<String> arguments) throws org.wurbelizer.wurbel.WurbelException
      Creates a parser.
      Parameters:
      entity - the entity the wurblet is applied to
      argumentGroupingEnabled - true if pipe character separates expression from extra arguments
      arguments - the wurblet arguments
      Throws:
      org.wurbelizer.wurbel.WurbelException - if parsing failed
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getEntity

      public Entity getEntity()
      Gets the entity the wurblet is applied to.
      Returns:
      the entity
    • getExpression

      public WurbletArgumentExpression getExpression()
      Gets the where expression.
      Returns:
      the expression
    • getExpressionArguments

      public List<WurbletArgument> getExpressionArguments()
      Gets all arguments part of the expression.
      Returns:
      the expression arguments
    • getExtraArguments

      public List<WurbletArgument> getExtraArguments()
      Gets the extra arguments.
      Those are not part of the expression and not sorting arguments.
      Returns:
      the extra arguments
    • getSortingArguments

      public List<WurbletArgument> getSortingArguments()
      Gets the sorting arguments.
      Returns:
      the sorting arguments
    • getJoinArguments

      public List<WurbletArgument> getJoinArguments()
      Gets the join arguments.
      Returns:
      the joins
    • getJoinPaths

      public List<JoinPath> getJoinPaths()
      Gets the consolidated relation paths for the join arguments.
      Returns:
      the join paths
    • getMethodArguments

      public List<WurbletArgument> getMethodArguments()
      Gets the method arguments.
      Returns:
      all arguments
    • getAllArguments

      public List<WurbletArgument> getAllArguments()
      Gets all arguments.
      Returns:
      all arguments
    • createArgument

      public WurbletArgument createArgument(String arg, boolean expressionFinished, boolean argumentGroupingEnabled) throws org.wurbelizer.wurbel.WurbelException
      Creates a wurblet argument.

      Parameters:
      arg - the argument string
      expressionFinished - true if expression is finished
      argumentGroupingEnabled - true if argument grouping is enabled
      Returns:
      the created argument
      Throws:
      org.wurbelizer.wurbel.WurbelException - if parsing arg failed