Package org.apache.ofbiz.minilang
Class SimpleMethod
- java.lang.Object
-
- org.apache.ofbiz.minilang.MiniLangElement
-
- org.apache.ofbiz.minilang.SimpleMethod
-
public final class SimpleMethod extends MiniLangElement
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:
- Mini-language Reference
- Creating model classes that extend
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
module
-
Fields inherited from class org.apache.ofbiz.minilang.MiniLangElement
simpleMethod
-
-
Constructor Summary
Constructors Constructor Description SimpleMethod(org.w3c.dom.Element simpleMethodElement, java.lang.String fromLocation)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addErrorMessage(MethodContext methodContext, java.lang.String message)
void
addMessage(MethodContext methodContext, java.lang.String message)
java.lang.String
exec(MethodContext methodContext)
Execute the Simple Method operationsvoid
gatherArtifactInfo(ArtifactInfoContext aic)
Updatesaic
with this element's artifact information.java.util.Set<java.lang.String>
getAllEntityNamesUsed()
Deprecated.java.util.Set<java.lang.String>
getAllServiceNamesCalled()
Deprecated.java.lang.String
getDefaultErrorCode()
java.lang.String
getDefaultSuccessCode()
java.lang.String
getDelegatorEnvName()
static java.util.Map<java.lang.String,SimpleMethod>
getDirectSimpleMethods(java.lang.String name, java.lang.String content, java.lang.String fromLocation)
java.lang.String
getDispatcherEnvName()
java.lang.String
getEventErrorMessageListName()
java.lang.String
getEventErrorMessageName()
java.lang.String
getEventEventMessageListName()
java.lang.String
getEventEventMessageName()
java.lang.String
getEventRequestName()
java.lang.String
getEventResponseCodeName()
java.lang.String
getEventSessionName()
java.lang.String
getFileName()
java.lang.String
getFromLocation()
java.lang.String
getLocationAndName()
boolean
getLoginRequired()
java.lang.String
getMethodName()
java.util.List<MethodOperation>
getMethodOperations()
java.lang.String
getParameterMapName()
java.lang.String
getSecurityEnvName()
java.lang.String
getServiceErrorMessageListName()
java.lang.String
getServiceErrorMessageMapName()
java.lang.String
getServiceErrorMessageName()
java.lang.String
getServiceResponseMessageName()
java.lang.String
getServiceSuccessMessageListName()
java.lang.String
getServiceSuccessMessageName()
java.lang.String
getShortDescription()
SimpleMethod
getSimpleMethod()
Returns the containingSimpleMethod
object.static SimpleMethod
getSimpleMethod(java.lang.String xmlResource, java.lang.String methodName, java.lang.ClassLoader loader)
static SimpleMethod
getSimpleMethod(java.net.URL xmlUrl, java.lang.String methodName)
static java.util.List<SimpleMethod>
getSimpleMethodsList(java.lang.String xmlResource, java.lang.ClassLoader loader)
Returns a List ofSimpleMethod
objects compiled fromxmlResource
.java.lang.String
getUserLoginEnvName()
boolean
getUseTransaction()
static java.util.List<MethodOperation>
readOperations(org.w3c.dom.Element simpleMethodElement, SimpleMethod simpleMethod)
static java.lang.String
runSimpleEvent(java.lang.String xmlResource, java.lang.String methodName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
static java.lang.String
runSimpleEvent(java.lang.String xmlResource, java.lang.String methodName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.ClassLoader loader)
static java.lang.String
runSimpleEvent(java.net.URL xmlURL, java.lang.String methodName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.ClassLoader loader)
static java.lang.String
runSimpleMethod(java.lang.String xmlResource, java.lang.String methodName, MethodContext methodContext)
static java.lang.String
runSimpleMethod(java.net.URL xmlURL, java.lang.String methodName, MethodContext methodContext)
static java.util.Map<java.lang.String,java.lang.Object>
runSimpleService(java.lang.String xmlResource, java.lang.String methodName, DispatchContext ctx, java.util.Map<java.lang.String,? extends java.lang.Object> context)
static java.util.Map<java.lang.String,java.lang.Object>
runSimpleService(java.lang.String xmlResource, java.lang.String methodName, DispatchContext ctx, java.util.Map<java.lang.String,? extends java.lang.Object> context, java.lang.ClassLoader loader)
static java.util.Map<java.lang.String,java.lang.Object>
runSimpleService(java.net.URL xmlURL, java.lang.String methodName, DispatchContext ctx, java.util.Map<java.lang.String,? extends java.lang.Object> context, java.lang.ClassLoader loader)
static boolean
runSubOps(java.util.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 Detail
-
SimpleMethod
public SimpleMethod(org.w3c.dom.Element simpleMethodElement, java.lang.String fromLocation) throws MiniLangException
- Throws:
MiniLangException
-
-
Method Detail
-
getDirectSimpleMethods
public static java.util.Map<java.lang.String,SimpleMethod> getDirectSimpleMethods(java.lang.String name, java.lang.String content, java.lang.String fromLocation) throws MiniLangException
- Throws:
MiniLangException
-
getSimpleMethod
public static SimpleMethod getSimpleMethod(java.lang.String xmlResource, java.lang.String methodName, java.lang.ClassLoader loader) throws MiniLangException
- Throws:
MiniLangException
-
getSimpleMethod
public static SimpleMethod getSimpleMethod(java.net.URL xmlUrl, java.lang.String methodName) throws MiniLangException
- Throws:
MiniLangException
-
getSimpleMethodsList
public static java.util.List<SimpleMethod> getSimpleMethodsList(java.lang.String xmlResource, java.lang.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 java.util.List<MethodOperation> readOperations(org.w3c.dom.Element simpleMethodElement, SimpleMethod simpleMethod) throws MiniLangException
- Throws:
MiniLangException
-
runSimpleEvent
public static java.lang.String runSimpleEvent(java.lang.String xmlResource, java.lang.String methodName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws MiniLangException
- Throws:
MiniLangException
-
runSimpleEvent
public static java.lang.String runSimpleEvent(java.lang.String xmlResource, java.lang.String methodName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.ClassLoader loader) throws MiniLangException
- Throws:
MiniLangException
-
runSimpleEvent
public static java.lang.String runSimpleEvent(java.net.URL xmlURL, java.lang.String methodName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.ClassLoader loader) throws MiniLangException
- Throws:
MiniLangException
-
runSimpleMethod
public static java.lang.String runSimpleMethod(java.lang.String xmlResource, java.lang.String methodName, MethodContext methodContext) throws MiniLangException
- Throws:
MiniLangException
-
runSimpleMethod
public static java.lang.String runSimpleMethod(java.net.URL xmlURL, java.lang.String methodName, MethodContext methodContext) throws MiniLangException
- Throws:
MiniLangException
-
runSimpleService
public static java.util.Map<java.lang.String,java.lang.Object> runSimpleService(java.lang.String xmlResource, java.lang.String methodName, DispatchContext ctx, java.util.Map<java.lang.String,? extends java.lang.Object> context) throws MiniLangException
- Throws:
MiniLangException
-
runSimpleService
public static java.util.Map<java.lang.String,java.lang.Object> runSimpleService(java.lang.String xmlResource, java.lang.String methodName, DispatchContext ctx, java.util.Map<java.lang.String,? extends java.lang.Object> context, java.lang.ClassLoader loader) throws MiniLangException
- Throws:
MiniLangException
-
runSimpleService
public static java.util.Map<java.lang.String,java.lang.Object> runSimpleService(java.net.URL xmlURL, java.lang.String methodName, DispatchContext ctx, java.util.Map<java.lang.String,? extends java.lang.Object> context, java.lang.ClassLoader loader) throws MiniLangException
- Throws:
MiniLangException
-
runSubOps
public static boolean runSubOps(java.util.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
-
addErrorMessage
public void addErrorMessage(MethodContext methodContext, java.lang.String message)
-
addMessage
public void addMessage(MethodContext methodContext, java.lang.String message)
-
exec
public java.lang.String exec(MethodContext methodContext) throws MiniLangException
Execute the Simple Method operations- Throws:
MiniLangException
-
gatherArtifactInfo
public void gatherArtifactInfo(ArtifactInfoContext aic)
Description copied from class:MiniLangElement
Updatesaic
with this element's artifact information.- Overrides:
gatherArtifactInfo
in classMiniLangElement
- Parameters:
aic
- The artifact information context
-
getAllEntityNamesUsed
@Deprecated public java.util.Set<java.lang.String> getAllEntityNamesUsed() throws MiniLangException
Deprecated.- Throws:
MiniLangException
-
getAllServiceNamesCalled
@Deprecated public java.util.Set<java.lang.String> getAllServiceNamesCalled() throws MiniLangException
Deprecated.- Throws:
MiniLangException
-
getDefaultErrorCode
public java.lang.String getDefaultErrorCode()
-
getDefaultSuccessCode
public java.lang.String getDefaultSuccessCode()
-
getDelegatorEnvName
public java.lang.String getDelegatorEnvName()
-
getDispatcherEnvName
public java.lang.String getDispatcherEnvName()
-
getEventErrorMessageListName
public java.lang.String getEventErrorMessageListName()
-
getEventErrorMessageName
public java.lang.String getEventErrorMessageName()
-
getEventEventMessageListName
public java.lang.String getEventEventMessageListName()
-
getEventEventMessageName
public java.lang.String getEventEventMessageName()
-
getEventRequestName
public java.lang.String getEventRequestName()
-
getEventResponseCodeName
public java.lang.String getEventResponseCodeName()
-
getEventSessionName
public java.lang.String getEventSessionName()
-
getFileName
public java.lang.String getFileName()
-
getFromLocation
public java.lang.String getFromLocation()
-
getLocationAndName
public java.lang.String getLocationAndName()
-
getLoginRequired
public boolean getLoginRequired()
-
getMethodName
public java.lang.String getMethodName()
-
getMethodOperations
public java.util.List<MethodOperation> getMethodOperations()
-
getParameterMapName
public java.lang.String getParameterMapName()
-
getSecurityEnvName
public java.lang.String getSecurityEnvName()
-
getServiceErrorMessageListName
public java.lang.String getServiceErrorMessageListName()
-
getServiceErrorMessageMapName
public java.lang.String getServiceErrorMessageMapName()
-
getServiceErrorMessageName
public java.lang.String getServiceErrorMessageName()
-
getServiceResponseMessageName
public java.lang.String getServiceResponseMessageName()
-
getServiceSuccessMessageListName
public java.lang.String getServiceSuccessMessageListName()
-
getServiceSuccessMessageName
public java.lang.String getServiceSuccessMessageName()
-
getShortDescription
public java.lang.String getShortDescription()
-
getSimpleMethod
public SimpleMethod getSimpleMethod()
Description copied from class:MiniLangElement
Returns the containingSimpleMethod
object.- Overrides:
getSimpleMethod
in classMiniLangElement
- Returns:
- The containing
SimpleMethod
object
-
getUserLoginEnvName
public java.lang.String getUserLoginEnvName()
-
getUseTransaction
public boolean getUseTransaction()
-
-