Interface ScriptHelper

  • All Known Implementing Classes:
    ScriptHelperImpl

    public interface ScriptHelper
    A script helper object. The OFBiz scripting framework will include an instance of this class in the script's bindings.

    The scripting language will determine how the helper is used. Most languages will access it as a variable:
    partyValue = ofbiz.findOne("Party");
    while other languages might access it as a native method or function:
    partyValue = findOne("Party");

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​? extends java.lang.Object> createServiceMap​(java.lang.String serviceName, java.util.Map<java.lang.String,​? extends java.lang.Object> inputMap)
      Extracts service IN parameters from inputMap and returns them in a new Map.
      void error​(java.lang.String message)
      Sets the event/service status to error status.
      java.lang.String evalString​(java.lang.String original)
      Evaluates a String and returns the result.
      void failure​(java.lang.String message)
      Sets the event/service status to failure status.
      java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> findList​(java.lang.String entityName, java.util.Map<java.lang.String,​? extends java.lang.Object> fields)
      Returns a List of GenericValues.
      java.util.Map<java.lang.String,​java.lang.Object> findOne​(java.lang.String entityName)
      Finds a GenericValue by primary key.
      java.util.Map<java.lang.String,​java.lang.Object> findOne​(java.lang.String entityName, java.util.Map<java.lang.String,​? extends java.lang.Object> fields, java.util.Map<java.lang.String,​? extends java.lang.Object> args)
      Finds a GenericValue by primary key.
      void logError​(java.lang.String message)
      Logs an error message.
      void logInfo​(java.lang.String message)
      Logs an info message.
      void logWarning​(java.lang.String message)
      Logs a warning message.
      java.util.Map<java.lang.String,​java.lang.Object> makeValue​(java.lang.String entityName)
      Creates a new, empty GenericValue.
      java.util.Map<java.lang.String,​java.lang.Object> makeValue​(java.lang.String entityName, java.util.Map<java.lang.String,​java.lang.Object> fields)
      Creates a new, empty GenericValue.
      java.util.Map<java.lang.String,​? extends java.lang.Object> runService​(java.lang.String serviceName, java.util.Map<java.lang.String,​? extends java.lang.Object> inputMap)
      Runs a service synchronously.
      java.util.Map<java.lang.String,​? extends java.lang.Object> runService​(java.lang.String serviceName, java.util.Map<java.lang.String,​? extends java.lang.Object> inputMap, java.util.Map<java.lang.String,​? extends java.lang.Object> args)
      Runs a service synchronously.
      void success()
      Sets the event/service status to success status.
      void success​(java.lang.String message)
      Sets the event/service status to success status.
    • Method Detail

      • createServiceMap

        java.util.Map<java.lang.String,​? extends java.lang.Object> createServiceMap​(java.lang.String serviceName,
                                                                                          java.util.Map<java.lang.String,​? extends java.lang.Object> inputMap)
                                                                                   throws javax.script.ScriptException
        Extracts service IN parameters from inputMap and returns them in a new Map.
        Parameters:
        serviceName -
        inputMap -
        Returns:
        The matching service parameters
        Throws:
        javax.script.ScriptException
      • error

        void error​(java.lang.String message)
        Sets the event/service status to error status.
        Parameters:
        message -
      • evalString

        java.lang.String evalString​(java.lang.String original)
        Evaluates a String and returns the result.
        Parameters:
        original -
        Returns:
      • failure

        void failure​(java.lang.String message)
        Sets the event/service status to failure status.
        Parameters:
        message -
      • findList

        java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> findList​(java.lang.String entityName,
                                                                                        java.util.Map<java.lang.String,​? extends java.lang.Object> fields)
                                                                                 throws javax.script.ScriptException
        Returns a List of GenericValues.
        Parameters:
        entityName -
        fields -
        Returns:
        Throws:
        javax.script.ScriptException
      • findOne

        java.util.Map<java.lang.String,​java.lang.Object> findOne​(java.lang.String entityName)
                                                                throws javax.script.ScriptException
        Finds a GenericValue by primary key. The helper will construct a primary key from existing variables.
        Parameters:
        entityName -
        Returns:
        Throws:
        javax.script.ScriptException
      • findOne

        java.util.Map<java.lang.String,​java.lang.Object> findOne​(java.lang.String entityName,
                                                                       java.util.Map<java.lang.String,​? extends java.lang.Object> fields,
                                                                       java.util.Map<java.lang.String,​? extends java.lang.Object> args)
                                                                throws javax.script.ScriptException
        Finds a GenericValue by primary key. The helper will construct a primary key from existing variables and/or fields.
        Parameters:
        entityName -
        fields -
        args -
        Returns:
        Throws:
        javax.script.ScriptException
      • logError

        void logError​(java.lang.String message)
        Logs an error message.
        Parameters:
        message -
      • logInfo

        void logInfo​(java.lang.String message)
        Logs an info message.
        Parameters:
        message -
      • logWarning

        void logWarning​(java.lang.String message)
        Logs a warning message.
        Parameters:
        message -
      • makeValue

        java.util.Map<java.lang.String,​java.lang.Object> makeValue​(java.lang.String entityName)
                                                                  throws javax.script.ScriptException
        Creates a new, empty GenericValue.
        Parameters:
        entityName -
        Returns:
        Throws:
        javax.script.ScriptException
      • makeValue

        java.util.Map<java.lang.String,​java.lang.Object> makeValue​(java.lang.String entityName,
                                                                         java.util.Map<java.lang.String,​java.lang.Object> fields)
                                                                  throws javax.script.ScriptException
        Creates a new, empty GenericValue.
        Parameters:
        entityName -
        fields -
        Returns:
        Throws:
        javax.script.ScriptException
      • runService

        java.util.Map<java.lang.String,​? extends java.lang.Object> runService​(java.lang.String serviceName,
                                                                                    java.util.Map<java.lang.String,​? extends java.lang.Object> inputMap)
                                                                             throws javax.script.ScriptException
        Runs a service synchronously.
        Parameters:
        serviceName -
        inputMap -
        Returns:
        Throws:
        javax.script.ScriptException
      • runService

        java.util.Map<java.lang.String,​? extends java.lang.Object> runService​(java.lang.String serviceName,
                                                                                    java.util.Map<java.lang.String,​? extends java.lang.Object> inputMap,
                                                                                    java.util.Map<java.lang.String,​? extends java.lang.Object> args)
                                                                             throws javax.script.ScriptException
        Runs a service synchronously.
        Parameters:
        serviceName -
        inputMap -
        args -
        Returns:
        Throws:
        javax.script.ScriptException
      • success

        void success()
        Sets the event/service status to success status.
      • success

        void success​(java.lang.String message)
        Sets the event/service status to success status.
        Parameters:
        message -