Class WebFunction

    • Field Detail

      • function

        public final StaticFunc function
        User-defined function.
      • module

        public final WebModule module
        Web module. Only required if used as function template
    • Constructor Detail

      • WebFunction

        protected WebFunction​(StaticFunc function,
                              WebModule module,
                              QueryContext qc)
        Constructor.
        Parameters:
        function - user-defined function
        qc - query context
        module - web module
    • Method Detail

      • parseAnnotations

        public abstract boolean parseAnnotations​(Context ctx)
                                          throws QueryException,
                                                 IOException
        Checks a function for REST and permission annotations. This function is called both when a module is parsed, and when the function is prepared for evaluation.
        Parameters:
        ctx - database context
        Returns:
        true if function contains relevant annotations
        Throws:
        QueryException - query exception
        IOException - I/O exception
      • error

        protected abstract QueryException error​(String msg,
                                                Object... ext)
        Creates an exception with the specified message.
        Parameters:
        msg - message
        ext - error extension
        Returns:
        exception
      • checkVariable

        protected final QNm checkVariable​(String tmp,
                                          boolean... declared)
                                   throws QueryException
        Checks the specified template and adds a variable.
        Parameters:
        tmp - template string
        declared - variable declaration flags
        Returns:
        resulting variable
        Throws:
        QueryException - query exception
      • checkParsed

        protected final boolean checkParsed​(boolean found,
                                            AnnList list,
                                            boolean[] declared)
                                     throws QueryException
        Checks parsed meta data.
        Parameters:
        found - found flag
        list - list of annotations
        declared - declared parameters
        Returns:
        found flag
        Throws:
        QueryException - query exception
      • checkVariable

        protected final QNm checkVariable​(QNm name,
                                          boolean[] declared)
                                   throws QueryException
        Checks if the specified variable exists in the current function.
        Parameters:
        name - variable
        declared - variable declaration flags
        Returns:
        resulting variable
        Throws:
        QueryException - query exception
      • bind

        protected final void bind​(QNm name,
                                  Expr[] args,
                                  Value value,
                                  QueryContext qc,
                                  String info)
                           throws QueryException
        Binds a value to a function argument.
        Parameters:
        name - variable name
        args - arguments
        value - value to be bound
        qc - query context
        info - info string
        Throws:
        QueryException - query exception
      • toString

        protected static String toString​(Item item)
        Returns the specified item as a string.
        Parameters:
        item - item
        Returns:
        string