Compiere 3.1

org.compiere.model
Class Scriptlet

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

public class Scriptlet
extends Object

Script Model

Version:
$Id: Scriptlet.java,v 1.2 2006/07/30 00:51:03 jjanke Exp $
Author:
Jorg Janke

Field Summary
static String VARIABLE
          Default Result Variable Name
 
Constructor Summary
Scriptlet()
          Constructor
Scriptlet(String variable, String script, Ctx ctx, int WindowNo)
          Full Constructor
Scriptlet(String variable, String script, HashMap<String,Object> ctx)
          Full Constructor
 
Method Summary
 Exception execute()
          Execute Script Loads environment and saves result
 HashMap<String,Object> getEnvironment()
          Get Environment
 Object getResult(boolean runIt)
          Get Result
 String getScript()
          Get Script
 String getVariable()
          Get Variable
 void setEnvironment(Ctx prop, int WindowNo)
          Set Environment
 void setEnvironment(HashMap<String,Object> ctx)
          Set Environment
 void setEnvironment(String key, Object value)
          Set Environment key to value
 void setEnvironment(String key, String stringValue)
          Set Environment key to value
 void setScript(String script)
          Set Script
 void setVariable(String variable)
          Set Variable
 String toString()
          String Representation incl.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VARIABLE

public static final String VARIABLE
Default Result Variable Name

See Also:
Constant Field Values
Constructor Detail

Scriptlet

public Scriptlet()
Constructor


Scriptlet

public Scriptlet(String variable,
                 String script,
                 Ctx ctx,
                 int WindowNo)
Full Constructor

Parameters:
variable - Variable Name
script - The Script
ctx - Context
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 Detail

execute

public Exception execute()
Execute Script Loads environment and saves result

Returns:
null or Exception

getVariable

public String getVariable()
Get Variable

Returns:
variable

setVariable

public void setVariable(String variable)
Set Variable

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(Ctx 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

Parameters:
ctx -

getEnvironment

public HashMap<String,Object> getEnvironment()
Get Environment

Returns:
environment

getResult

public Object getResult(boolean runIt)
Get Result

Parameters:
runIt - if true, execute script
Returns:
result or null

toString

public String toString()
String Representation incl. Result

Overrides:
toString in class Object
Returns:
Scipt

Compiere 3.1

Compiere® is a registered trademark of ComPiere, Inc. ©2004-2008 HumanFlash.com All rights reserved.