Package org.apache.ofbiz.minilang
Class SimpleMethod
java.lang.Object
org.apache.ofbiz.minilang.MiniLangElement
org.apache.ofbiz.minilang.SimpleMethod
Implements the <simple-method> element.
The Mini-language script engine follows the flyweight design pattern. Mini-language XML files are parsed twice - first into a W3C DOM tree, then the DOM tree is parsed into element model objects. Each XML element has a model class, and each model class has its own factory.
Mini-language can be extended by:
- Creating model classes that extend
MethodOperation
- Creating factories for the model classes that implement
MethodOperation.Factory
- Create a service provider information file for the factory classes (see ServiceLoader)
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addErrorMessage
(MethodContext methodContext, String message) void
addMessage
(MethodContext methodContext, String message) exec
(MethodContext methodContext) Execute the Simple Method operationsvoid
Updatesaic
with this element's artifact information.Deprecated.Deprecated.static Map<String,
SimpleMethod> getDirectSimpleMethods
(String name, String content, String fromLocation) boolean
Returns the containingSimpleMethod
object.static SimpleMethod
getSimpleMethod
(String xmlResource, String methodName, ClassLoader loader) static SimpleMethod
getSimpleMethod
(URL xmlUrl, String methodName) static List<SimpleMethod>
getSimpleMethodsList
(String xmlResource, ClassLoader loader) Returns a List ofSimpleMethod
objects compiled fromxmlResource
.static String
boolean
static List<MethodOperation>
readOperations
(Element simpleMethodElement, SimpleMethod simpleMethod) static String
runSimpleEvent
(String xmlResource, String methodName, HttpServletRequest request, HttpServletResponse response) static String
runSimpleEvent
(String xmlResource, String methodName, HttpServletRequest request, HttpServletResponse response, ClassLoader loader) static String
runSimpleEvent
(URL xmlURL, String methodName, HttpServletRequest request, HttpServletResponse response, ClassLoader loader) static String
runSimpleMethod
(String xmlResource, String methodName, MethodContext methodContext) static String
runSimpleMethod
(URL xmlURL, String methodName, MethodContext methodContext) runSimpleService
(String xmlResource, String methodName, DispatchContext ctx, Map<String, ? extends Object> context) runSimpleService
(String xmlResource, String methodName, DispatchContext ctx, Map<String, ? extends Object> context, ClassLoader loader) runSimpleService
(URL xmlURL, String methodName, DispatchContext ctx, Map<String, ? extends Object> context, ClassLoader loader) static boolean
runSubOps
(List<MethodOperation> methodOperations, MethodContext methodContext) Execs the given operations returning true if all return true, or returning false and stopping if any return false.Methods inherited from class org.apache.ofbiz.minilang.MiniLangElement
getLineNumber, getTagName, outputTraceMessage, toString
-
Constructor Details
-
SimpleMethod
- Throws:
MiniLangException
-
-
Method Details
-
getDirectSimpleMethods
public static Map<String,SimpleMethod> getDirectSimpleMethods(String name, String content, String fromLocation) throws MiniLangException - Throws:
MiniLangException
-
getSimpleMethod
public static SimpleMethod getSimpleMethod(String xmlResource, String methodName, ClassLoader loader) throws MiniLangException - Throws:
MiniLangException
-
getSimpleMethod
- Throws:
MiniLangException
-
getSimpleMethodsList
public static List<SimpleMethod> getSimpleMethodsList(String xmlResource, ClassLoader loader) throws MiniLangException Returns a List ofSimpleMethod
objects compiled fromxmlResource
. The ordering in the List is the same as the XML file.This method is used by unit test framework to run tests in the order they appear in the XML file. Method caching is bypassed since the methods are executed only once.
- Parameters:
xmlResource
-loader
-- Returns:
- Throws:
MiniLangException
-
readOperations
public static List<MethodOperation> readOperations(Element simpleMethodElement, SimpleMethod simpleMethod) throws MiniLangException - Throws:
MiniLangException
-
runSimpleEvent
public static String runSimpleEvent(String xmlResource, String methodName, HttpServletRequest request, HttpServletResponse response) throws MiniLangException - Throws:
MiniLangException
-
runSimpleEvent
public static String runSimpleEvent(String xmlResource, String methodName, HttpServletRequest request, HttpServletResponse response, ClassLoader loader) throws MiniLangException - Throws:
MiniLangException
-
runSimpleEvent
public static String runSimpleEvent(URL xmlURL, String methodName, HttpServletRequest request, HttpServletResponse response, ClassLoader loader) throws MiniLangException - Throws:
MiniLangException
-
runSimpleMethod
public static String runSimpleMethod(String xmlResource, String methodName, MethodContext methodContext) throws MiniLangException - Throws:
MiniLangException
-
runSimpleMethod
public static String runSimpleMethod(URL xmlURL, String methodName, MethodContext methodContext) throws MiniLangException - Throws:
MiniLangException
-
runSimpleService
public static Map<String,Object> runSimpleService(String xmlResource, String methodName, DispatchContext ctx, Map<String, ? extends Object> context) throws MiniLangException- Throws:
MiniLangException
-
runSimpleService
public static Map<String,Object> runSimpleService(String xmlResource, String methodName, DispatchContext ctx, Map<String, ? extends Object> context, ClassLoader loader) throws MiniLangException- Throws:
MiniLangException
-
runSimpleService
public static Map<String,Object> runSimpleService(URL xmlURL, String methodName, DispatchContext ctx, Map<String, ? extends Object> context, ClassLoader loader) throws MiniLangException- Throws:
MiniLangException
-
runSubOps
public static boolean runSubOps(List<MethodOperation> methodOperations, MethodContext methodContext) throws MiniLangException Execs the given operations returning true if all return true, or returning false and stopping if any return false.- Throws:
MiniLangException
-
getUserLoginEnvName
-
addErrorMessage
-
addMessage
-
exec
Execute the Simple Method operations- Throws:
MiniLangException
-
gatherArtifactInfo
Description copied from class:MiniLangElement
Updatesaic
with this element's artifact information.- Overrides:
gatherArtifactInfo
in classMiniLangElement
- Parameters:
aic
- The artifact information context
-
getAllEntityNamesUsed
Deprecated.- Throws:
MiniLangException
-
getAllServiceNamesCalled
Deprecated.- Throws:
MiniLangException
-
getDefaultErrorCode
-
getDefaultSuccessCode
-
getEventErrorMessageListName
-
getEventErrorMessageName
-
getEventEventMessageListName
-
getEventEventMessageName
-
getEventRequestName
-
getEventResponseCodeName
-
getEventSessionName
-
getFileName
-
getFromLocation
-
getLocationAndName
-
getLoginRequired
public boolean getLoginRequired() -
getMethodName
-
getMethodOperations
-
getServiceErrorMessageListName
-
getServiceErrorMessageMapName
-
getServiceErrorMessageName
-
getServiceResponseMessageName
-
getServiceSuccessMessageListName
-
getServiceSuccessMessageName
-
getShortDescription
-
getSimpleMethod
Description copied from class:MiniLangElement
Returns the containingSimpleMethod
object.- Overrides:
getSimpleMethod
in classMiniLangElement
- Returns:
- The containing
SimpleMethod
object
-
getUseTransaction
public boolean getUseTransaction()
-