Class ScriptHelperImpl
- java.lang.Object
-
- org.apache.ofbiz.common.scripting.ScriptHelperImpl
-
- All Implemented Interfaces:
ScriptHelper
public final class ScriptHelperImpl extends java.lang.Object implements ScriptHelper
An implementation of theScriptHelper
interface.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
module
-
Constructor Summary
Constructors Constructor Description ScriptHelperImpl(javax.script.ScriptContext context)
-
Method Summary
All Methods Instance Methods Concrete 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 frominputMap
and returns them in a newMap
.void
error(java.lang.String message)
Sets the event/service status to error status.java.lang.String
evalString(java.lang.String original)
Evaluates aString
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 aList
ofGenericValue
s.java.util.Map<java.lang.String,java.lang.Object>
findOne(java.lang.String entityName)
Finds aGenericValue
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 aGenericValue
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, emptyGenericValue
.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, emptyGenericValue
.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
public 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
Description copied from interface:ScriptHelper
Extracts service IN parameters frominputMap
and returns them in a newMap
.- Specified by:
createServiceMap
in interfaceScriptHelper
- Returns:
- The matching service parameters
- Throws:
javax.script.ScriptException
-
error
public void error(java.lang.String message)
Description copied from interface:ScriptHelper
Sets the event/service status to error status.- Specified by:
error
in interfaceScriptHelper
-
evalString
public java.lang.String evalString(java.lang.String original)
Description copied from interface:ScriptHelper
Evaluates aString
and returns the result.- Specified by:
evalString
in interfaceScriptHelper
- Returns:
-
failure
public void failure(java.lang.String message)
Description copied from interface:ScriptHelper
Sets the event/service status to failure status.- Specified by:
failure
in interfaceScriptHelper
-
findList
public 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
Description copied from interface:ScriptHelper
Returns aList
ofGenericValue
s.- Specified by:
findList
in interfaceScriptHelper
- Returns:
- Throws:
javax.script.ScriptException
-
findOne
public java.util.Map<java.lang.String,java.lang.Object> findOne(java.lang.String entityName) throws javax.script.ScriptException
Description copied from interface:ScriptHelper
Finds aGenericValue
by primary key. The helper will construct a primary key from existing variables.- Specified by:
findOne
in interfaceScriptHelper
- Returns:
- Throws:
javax.script.ScriptException
-
findOne
public 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
Description copied from interface:ScriptHelper
Finds aGenericValue
by primary key. The helper will construct a primary key from existing variables and/orfields
.- Specified by:
findOne
in interfaceScriptHelper
- Returns:
- Throws:
javax.script.ScriptException
-
logError
public void logError(java.lang.String message)
Description copied from interface:ScriptHelper
Logs an error message.- Specified by:
logError
in interfaceScriptHelper
-
logInfo
public void logInfo(java.lang.String message)
Description copied from interface:ScriptHelper
Logs an info message.- Specified by:
logInfo
in interfaceScriptHelper
-
logWarning
public void logWarning(java.lang.String message)
Description copied from interface:ScriptHelper
Logs a warning message.- Specified by:
logWarning
in interfaceScriptHelper
-
makeValue
public java.util.Map<java.lang.String,java.lang.Object> makeValue(java.lang.String entityName) throws javax.script.ScriptException
Description copied from interface:ScriptHelper
Creates a new, emptyGenericValue
.- Specified by:
makeValue
in interfaceScriptHelper
- Returns:
- Throws:
javax.script.ScriptException
-
makeValue
public 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
Description copied from interface:ScriptHelper
Creates a new, emptyGenericValue
.- Specified by:
makeValue
in interfaceScriptHelper
- Returns:
- Throws:
javax.script.ScriptException
-
runService
public 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
Description copied from interface:ScriptHelper
Runs a service synchronously.- Specified by:
runService
in interfaceScriptHelper
- Returns:
- Throws:
javax.script.ScriptException
-
runService
public 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
Description copied from interface:ScriptHelper
Runs a service synchronously.- Specified by:
runService
in interfaceScriptHelper
- Returns:
- Throws:
javax.script.ScriptException
-
success
public void success()
Description copied from interface:ScriptHelper
Sets the event/service status to success status.- Specified by:
success
in interfaceScriptHelper
-
success
public void success(java.lang.String message)
Description copied from interface:ScriptHelper
Sets the event/service status to success status.- Specified by:
success
in interfaceScriptHelper
-
-