Class WurbletArgumentParser


  • public class WurbletArgumentParser
    extends java.lang.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 Detail

      • WurbletArgumentParser

        public WurbletArgumentParser​(org.tentackle.model.Entity entity,
                                     boolean argumentGroupingEnabled,
                                     java.util.List<java.lang.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 Detail

      • toString

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

        public org.tentackle.model.Entity getEntity()
        Gets the entity the wurblet is applied to.
        Returns:
        the entity
      • getExpressionArguments

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

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

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

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

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

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

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

        public WurbletArgument createArgument​(java.lang.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