public class ExpressionScript
extends java.lang.Object
implements java.io.Serializable
Accela Automation
File: ExpressionScript.java
Accela, Inc.
Copyright (C): 2007-2014
Description:
TODO
Notes:
$Id: ExpressionScript.java 128065 2009-04-23 02:14:37Z ..\hikelee.li $
Revision History
<Date>, <Who>, <What>
Nov 27, 2007 hikelee.li Initial.
| Modifier and Type | Field and Description |
|---|---|
HttpClientScript |
httpClient |
ProxyInvoker |
proxyInvoker |
| Constructor and Description |
|---|
ExpressionScript(ExpressionScriptModel scriptModel)
Specific which portlets which are used by expression are displayed in web page now
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
addDate(java.lang.String startDate,
long addDays)
Add or subtract date for some days
|
void |
addMessage(java.lang.String message)
Add the message for page form
|
void |
addVariblesFromDB(java.lang.Long viewID,
java.lang.String querySQL,
java.util.List<java.lang.String> params)
Add referenced portlet field variables into expression input parameters
|
void |
callEMSEScript(java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,java.lang.Object>> calledEMSE)
Call EMSE Script with script name and script parameters
|
void |
checkDateUseLocaleDatePattern(java.lang.String date,
java.lang.String errorMsg)
Check the date string whether is valid date format or not according current language date pattern,
if it's not a valid date format, throw a exception.
|
void |
cleanEvn()
Clean JS engine's context to avoid memory leak.
|
java.util.List<java.lang.Object> |
createParamList()
Create a new lookup table query parameter.
|
java.util.Map<java.lang.String,java.lang.Object> |
createParamMap()
Create a new Hashtable use as the parameters Map;
For example, it can be used for EMSE Script input parameters initial
|
long |
diffDate(java.lang.String startDate,
java.lang.String endDate)
Calculate how many days data1 before data2
|
java.lang.String |
executeAggregateFunction(java.lang.String functionName,
java.util.List<java.lang.Object> values)
Calculation the aggregate function for running total column
|
java.lang.String |
formatDate(java.lang.String dateString,
java.lang.String pattern)
Parser date string into given formatted string
This method use to convert inputed date string to given formatted string.
|
java.lang.String |
getCurrentDatePattern()
Get current agency date format pattern according the I18N setting
|
java.lang.String |
getExpressionName()
Get current running Expression Name
|
java.util.Map<java.lang.String,java.lang.String> |
getOutputMap()
Get a new HashMap for look up output params; Key is asi field appears in asi portlet Value is corresponding look
up table column var output=expression.getOutputMap(); output.put('field1','code:sub:column2')
|
ScriptRoot |
getScriptRoot()
Get EMSE ScriptRoot to support EMSE
|
java.lang.String |
getScriptText()
Get current running Expression script text
|
long |
getSourceSeqNbr(java.lang.String serviceProvCode)
Get agency source sequence number by agency code
|
int |
getTotalRowCount()
Get table total row count
|
com.accela.aa.aamain.expression.ExpressionFieldModel |
getValue(int rowIndex,
java.lang.String variableKey)
Get a table cell by row index and column name
|
com.accela.aa.aamain.expression.ExpressionFieldModel |
getValue(java.lang.String variableKey)
Get expression field by variableKey
|
ScriptResult |
includeScript(java.lang.String scriptID)
Allows a user to execute another script within the same context.
|
void |
initEnv(org.mozilla.javascript.Context cx,
org.mozilla.javascript.Scriptable scope)
Initialize JS engine environment for invoking sub script in a context.
|
java.lang.String |
lookup(java.lang.String sqlStr,
java.util.List<java.lang.String> sqlParams)
Execute lookup() function
|
java.lang.String |
parseDate(java.lang.String dateString)
Parser date string into java.util.Date
This method use to generate the reference portlet data search SQL statement,
if the field type is HTML_TEXTBOX_OF_DATE, we need parse the field value date
string to a date object with current agency date pattern setting, then parse
the date object format to "MM/dd/yyyy" and use it as the SQL parameter.
|
void |
print(java.lang.String info)
Print debug information
|
void |
setReturn(com.accela.aa.aamain.expression.ExpressionFieldModel model)
Set field as a return field
|
void |
setReturn(int rowIndex,
com.accela.aa.aamain.expression.ExpressionFieldModel model)
Set field as a return field
|
public final transient ProxyInvoker proxyInvoker
public final transient HttpClientScript httpClient
public ExpressionScript(ExpressionScriptModel scriptModel) throws com.accela.aa.exception.AAException
scriptModel - The initialled Expression runtime envriomentcom.accela.aa.exception.AAExceptionpublic void initEnv(org.mozilla.javascript.Context cx,
org.mozilla.javascript.Scriptable scope)
cx - scope - public void cleanEvn()
public ScriptResult includeScript(java.lang.String scriptID)
scriptID - the 'code' for the script (not the 'name')java.lang.Exception - the exceptionpublic void addVariblesFromDB(java.lang.Long viewID,
java.lang.String querySQL,
java.util.List<java.lang.String> params)
throws com.accela.aa.exception.AAException,
java.rmi.RemoteException
viewID - querySQL - params - com.accela.aa.exception.AAExceptionjava.rmi.RemoteExceptionpublic com.accela.aa.aamain.expression.ExpressionFieldModel getValue(int rowIndex,
java.lang.String variableKey)
rowIndex - - row indexvariableKey - - column namepublic com.accela.aa.aamain.expression.ExpressionFieldModel getValue(java.lang.String variableKey)
variableKey - Stringpublic int getTotalRowCount()
public void addMessage(java.lang.String message)
message - public void setReturn(int rowIndex,
com.accela.aa.aamain.expression.ExpressionFieldModel model)
rowIndex - table row indexmodel - current variable reference ExpressionFieldModel Objectpublic void setReturn(com.accela.aa.aamain.expression.ExpressionFieldModel model)
model - current variable reference ExpressionFieldModel Objectpublic java.util.Map<java.lang.String,java.lang.String> getOutputMap()
public java.util.List<java.lang.Object> createParamList()
public java.util.Map<java.lang.String,java.lang.Object> createParamMap()
public void callEMSEScript(java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,java.lang.Object>> calledEMSE)
calledEMSE - java.rmi.RemoteExceptioncom.accela.aa.exception.AAExceptionpublic java.lang.String lookup(java.lang.String sqlStr,
java.util.List<java.lang.String> sqlParams)
sqlStr - StringsqlParams - List of Stringpublic java.lang.String executeAggregateFunction(java.lang.String functionName,
java.util.List<java.lang.Object> values)
throws com.accela.aa.exception.AAException,
java.rmi.RemoteException
functionName - Stringvalues - List of Objectcom.accela.aa.exception.AAExceptionjava.rmi.RemoteExceptionpublic long getSourceSeqNbr(java.lang.String serviceProvCode)
throws java.rmi.RemoteException,
com.accela.aa.exception.AAException
serviceProvCode - java.rmi.RemoteExceptioncom.accela.aa.exception.AAExceptionpublic java.lang.String addDate(java.lang.String startDate,
long addDays)
throws com.accela.aa.exception.AAException
startDate - The date to be added. Date format MM/DD/YYYY, for example 04/29/2008addDays - How many days to be addedcom.accela.aa.exception.AAExceptionpublic long diffDate(java.lang.String startDate,
java.lang.String endDate)
throws com.accela.aa.exception.AAException
startDate - - Date formate MM/DD/YYYY, for example: 04/29/2008endDate - - Date formate MM/DD/YYYY, for example: 04/29/2008java.lang.Exceptioncom.accela.aa.exception.AAExceptionpublic void checkDateUseLocaleDatePattern(java.lang.String date,
java.lang.String errorMsg)
throws com.accela.aa.exception.AAException
date - errorMsg - com.accela.aa.exception.AAExceptionpublic java.lang.String formatDate(java.lang.String dateString,
java.lang.String pattern)
throws java.text.ParseException
dateString - pattern - format string. It is yyyy/MM/dd for bug 33067java.text.ParseExceptionpublic java.lang.String parseDate(java.lang.String dateString)
throws java.text.ParseException
dateString - java.text.ParseExceptionpublic java.lang.String getCurrentDatePattern()
public void print(java.lang.String info)
info - public ScriptRoot getScriptRoot() throws com.accela.aa.exception.AAException
com.accela.aa.exception.AAExceptionpublic java.lang.String getScriptText()
public java.lang.String getExpressionName()