Class Scriptlet

java.lang.Object
org.compiere.model.Scriptlet

public class Scriptlet extends Object
Bean Shell Script Model
Version:
$Id: Scriptlet.java,v 1.2 2006/07/30 00:51:03 jjanke Exp $
Author:
Jorg Janke
  • Field Details

  • Constructor Details

    • Scriptlet

      public Scriptlet()
      Constructor
    • Scriptlet

      public Scriptlet(String variable, String script, Properties prop, int WindowNo)
      Full Constructor
      Parameters:
      variable - Variable Name
      script - The Script
      prop - Environment
      WindowNo - Included Window variables
    • Scriptlet

      public Scriptlet(String variable, String script, HashMap<String,Object> ctx)
      Full Constructor
      Parameters:
      variable - Variable Name
      script - The Script
      ctx - Environment
  • Method Details

    • execute

      public Exception execute()
      Execute Script.
      Loads environment and saves result.
      Returns:
      null or Exception
    • validate

      public void validate() throws bsh.ParseException
      Validate script.
      Throws:
      bsh.ParseException
    • getVariable

      public String getVariable()
      Get Variable
      Returns:
      variable
    • setVariable

      public void setVariable(String variable)
      Set Result Variable Name.
      Parameters:
      variable - - if null set to VARIABLE
    • setScript

      public void setScript(String script)
      Set Script
      Parameters:
      script -
    • getScript

      public String getScript()
      Get Script
      Returns:
      script
    • setEnvironment

      public void setEnvironment(Properties prop, int WindowNo)
      Set Environment
      Parameters:
      prop -
      WindowNo - included Window variables
    • setEnvironment

      public void setEnvironment(String key, String stringValue)
      Set Environment key to value
      Parameters:
      key - variable name ('#' will be converted to '_')
      stringValue - try to convert to Object
    • setEnvironment

      public void setEnvironment(String key, Object value)
      Set Environment key to value
      Parameters:
      key - variable name ('#' will be vonverted to '_')
      value -
    • setEnvironment

      public void setEnvironment(HashMap<String,Object> ctx)
      Set Environment Context
      Parameters:
      ctx -
    • getEnvironment

      public HashMap<String,Object> getEnvironment()
      Get Environment Context
      Returns:
      environment
    • getResult

      public Object getResult(boolean runIt)
      Get Result
      Parameters:
      runIt - if true, execute script
      Returns:
      result or null
    • getDescription

      public Object getDescription()
      Get Description
      Returns:
      description or null
    • toString

      public String toString()
      String Representation incl. Result
      Overrides:
      toString in class Object
      Returns:
      Script