org.ofbiz.service
Class ModelService

java.lang.Object
  extended by java.util.AbstractMap<java.lang.String,java.lang.Object>
      extended by org.ofbiz.service.ModelService
All Implemented Interfaces:
java.io.Serializable, java.util.Map<java.lang.String,java.lang.Object>

public class ModelService
extends java.util.AbstractMap<java.lang.String,java.lang.Object>
implements java.io.Serializable

Generic Service Model Class

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
 boolean auth
          Does this service require authorization
protected  java.util.Map<java.lang.String,ModelParam> contextInfo
          Context Information, a Map of parameters used by the service, contains ModelParam objects
protected  java.util.List<ModelParam> contextParamList
          Context Information, a List of parameters used by the service, contains ModelParam objects
 boolean debug
          Enable verbose debugging when calling this service
 java.lang.String defaultEntityName
          The default Entity to use for auto-attributes
 java.lang.String definitionLocation
          The location of the definition this service
 java.lang.String description
          The description of this service
 java.lang.String engineName
          The name of the service engine
static java.lang.String ERROR_MESSAGE
           
static java.lang.String ERROR_MESSAGE_LIST
           
static java.lang.String ERROR_MESSAGE_MAP
           
 boolean export
          Can this service be exported via RPC, RMI, SOAP, etc
 java.lang.String fromLoader
          The loader which loaded this definition
 java.util.Set<ModelServiceIface> implServices
          Set of services this service implements
static java.lang.String IN_PARAM
           
protected  boolean inheritedParameters
          Flag to say if we have pulled in our addition parameters from our implemented service(s)
 GroupModel internalGroup
          Internal Service Group
 java.lang.String invoke
          The method or function to invoke for this service
 java.lang.String location
          The package name or location of this service
 int maxRetry
          Sets the max number of times this service will retry when failed (persisted async only)
static java.lang.String module
           
 java.lang.String name
          The name of this service
 java.lang.String nameSpace
          The namespace of this service
 java.util.List<ModelNotification> notifications
          List of email-notifications for this service
static java.lang.String OUT_PARAM
           
 java.util.Set<ModelParam> overrideParameters
          Set of override parameters
 java.util.List<ModelPermGroup> permissionGroups
          List of permission groups for service invocation
 java.lang.String permissionMainAction
          Permission service main-action
 java.lang.String permissionResourceDesc
          Permission service resource-description
 java.lang.String permissionServiceName
          Permission service name
 boolean requireNewTransaction
          Require a new transaction for this service
static java.lang.String resource
           
static java.lang.String RESPOND_ERROR
           
static java.lang.String RESPOND_FAIL
           
static java.lang.String RESPOND_SUCCESS
           
static java.lang.String RESPONSE_MESSAGE
           
 java.lang.String semaphore
          Semaphore setting (wait, fail, none)
 int semaphoreSleep
          Semaphore sleep time (in milliseconds)
 int semaphoreWait
          Semaphore wait time (in milliseconds)
static java.lang.String SUCCESS_MESSAGE
           
static java.lang.String SUCCESS_MESSAGE_LIST
           
static java.lang.String TNS
           
 int transactionTimeout
          Override the default transaction timeout, only works if we start the transaction
 boolean useTransaction
          Create a transaction for this service (if one is not already in place...)?
 boolean validate
          Validate the context info for this service
static java.lang.String XSD
           
 
Constructor Summary
ModelService()
           
ModelService(ModelService model)
           
 
Method Summary
 void addParam(ModelParam param)
          Adds a parameter definition to this service; puts on list in order added then sorts by order if specified.
 void addParamClone(ModelParam param)
          Adds a clone of a parameter definition to this service
 boolean containsPermissions()
           
 java.lang.String debugInfo()
           
 java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
           
 void evalNotifications(DispatchContext dctx, java.util.Map<java.lang.String,? extends java.lang.Object> context, java.util.Map<java.lang.String,java.lang.Object> result)
          Evaluates notifications
 java.util.Map<java.lang.String,java.lang.Object> evalPermission(DispatchContext dctx, java.util.Map<java.lang.String,? extends java.lang.Object> context)
          Evaluates permission-service for this service.
 boolean evalPermissions(DispatchContext dctx, java.util.Map<java.lang.String,? extends java.lang.Object> context)
          Evaluates permissions for a service.
 java.lang.Object get(java.lang.Object name)
           
 java.util.Set<java.lang.String> getAllParamNames()
           
 int getDefinedInCount()
           
 int getDefinedOutCount()
           
 java.util.List<ModelParam> getInModelParamList()
          Returns a list of ModelParam objects in the order they were defined when the service was created.
 java.util.List<java.lang.Object> getInParameterSequence(java.util.Map<java.lang.String,? extends java.lang.Object> source)
          Gets a list of required IN parameters in sequence.
 java.util.Set<java.lang.String> getInParamNames()
           
 java.util.List<ModelParam> getModelParamList()
          Returns a list of ModelParam objects in the order they were defined when the service was created.
 java.util.Set<java.lang.String> getOutParamNames()
           
 ModelParam getParam(java.lang.String name)
          Gets the ModelParam by name
 java.util.List<java.lang.String> getParameterNames(java.lang.String mode, boolean optional)
           
 java.util.List<java.lang.String> getParameterNames(java.lang.String mode, boolean optional, boolean internal)
          Gets the parameter names of the specified mode (IN/OUT/INOUT).
 void getWSDL(Definition def, java.lang.String locationURI)
           
 boolean inheritedParameters()
          Test if we have already inherited our interface parameters
 void interfaceUpdate(DispatchContext dctx)
          Run the interface update and inherit all interface parameters
 java.util.Map<java.lang.String,java.lang.Object> makeValid(java.util.Map<java.lang.String,? extends java.lang.Object> source, java.lang.String mode)
          Creates a new Map based from an existing map with just valid parameters.
 java.util.Map<java.lang.String,java.lang.Object> makeValid(java.util.Map<java.lang.String,? extends java.lang.Object> source, java.lang.String mode, boolean includeInternal, java.util.List<java.lang.Object> errorMessages)
          Creates a new Map based from an existing map with just valid parameters.
 java.util.Map<java.lang.String,java.lang.Object> makeValid(java.util.Map<java.lang.String,? extends java.lang.Object> source, java.lang.String mode, boolean includeInternal, java.util.List<java.lang.Object> errorMessages, java.util.Locale locale)
          Creates a new Map based from an existing map with just valid parameters.
 java.util.Map<java.lang.String,java.lang.Object> makeValid(java.util.Map<java.lang.String,? extends java.lang.Object> source, java.lang.String mode, boolean includeInternal, java.util.List<java.lang.Object> errorMessages, java.util.TimeZone timeZone, java.util.Locale locale)
          Creates a new Map based from an existing map with just valid parameters.
 java.lang.Object put(java.lang.String o1, java.lang.Object o2)
           
 java.lang.String toString()
           
 org.w3c.dom.Document toWSDL(java.lang.String locationURI)
           
static boolean typeValidate(org.ofbiz.service.ModelParam.ModelParamValidator vali, java.lang.Object testValue)
           
 void updateDefaultValues(java.util.Map<java.lang.String,java.lang.Object> context, java.lang.String mode)
           
 void validate(java.util.Map<java.lang.String,java.lang.Object> context, java.lang.String mode, java.util.Locale locale)
          Validates a Map against the IN or OUT parameter information
static void validate(java.util.Map<java.lang.String,java.lang.String> info, java.util.Map<java.lang.String,? extends java.lang.Object> test, boolean reverse, ModelService model, java.lang.String mode, java.util.Locale locale)
          Validates a map of name, object types to a map of name, objects
 
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, remove, size, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

module

public static final java.lang.String module

XSD

public static final java.lang.String XSD
See Also:
Constant Field Values

TNS

public static final java.lang.String TNS
See Also:
Constant Field Values

OUT_PARAM

public static final java.lang.String OUT_PARAM
See Also:
Constant Field Values

IN_PARAM

public static final java.lang.String IN_PARAM
See Also:
Constant Field Values

RESPONSE_MESSAGE

public static final java.lang.String RESPONSE_MESSAGE
See Also:
Constant Field Values

RESPOND_SUCCESS

public static final java.lang.String RESPOND_SUCCESS
See Also:
Constant Field Values

RESPOND_ERROR

public static final java.lang.String RESPOND_ERROR
See Also:
Constant Field Values

RESPOND_FAIL

public static final java.lang.String RESPOND_FAIL
See Also:
Constant Field Values

ERROR_MESSAGE

public static final java.lang.String ERROR_MESSAGE
See Also:
Constant Field Values

ERROR_MESSAGE_LIST

public static final java.lang.String ERROR_MESSAGE_LIST
See Also:
Constant Field Values

ERROR_MESSAGE_MAP

public static final java.lang.String ERROR_MESSAGE_MAP
See Also:
Constant Field Values

SUCCESS_MESSAGE

public static final java.lang.String SUCCESS_MESSAGE
See Also:
Constant Field Values

SUCCESS_MESSAGE_LIST

public static final java.lang.String SUCCESS_MESSAGE_LIST
See Also:
Constant Field Values

resource

public static final java.lang.String resource
See Also:
Constant Field Values

name

public java.lang.String name
The name of this service


definitionLocation

public java.lang.String definitionLocation
The location of the definition this service


description

public java.lang.String description
The description of this service


engineName

public java.lang.String engineName
The name of the service engine


nameSpace

public java.lang.String nameSpace
The namespace of this service


location

public java.lang.String location
The package name or location of this service


invoke

public java.lang.String invoke
The method or function to invoke for this service


defaultEntityName

public java.lang.String defaultEntityName
The default Entity to use for auto-attributes


fromLoader

public java.lang.String fromLoader
The loader which loaded this definition


auth

public boolean auth
Does this service require authorization


export

public boolean export
Can this service be exported via RPC, RMI, SOAP, etc


debug

public boolean debug
Enable verbose debugging when calling this service


validate

public boolean validate
Validate the context info for this service


useTransaction

public boolean useTransaction
Create a transaction for this service (if one is not already in place...)?


requireNewTransaction

public boolean requireNewTransaction
Require a new transaction for this service


transactionTimeout

public int transactionTimeout
Override the default transaction timeout, only works if we start the transaction


maxRetry

public int maxRetry
Sets the max number of times this service will retry when failed (persisted async only)


permissionServiceName

public java.lang.String permissionServiceName
Permission service name


permissionMainAction

public java.lang.String permissionMainAction
Permission service main-action


permissionResourceDesc

public java.lang.String permissionResourceDesc
Permission service resource-description


semaphore

public java.lang.String semaphore
Semaphore setting (wait, fail, none)


semaphoreWait

public int semaphoreWait
Semaphore wait time (in milliseconds)


semaphoreSleep

public int semaphoreSleep
Semaphore sleep time (in milliseconds)


implServices

public java.util.Set<ModelServiceIface> implServices
Set of services this service implements


overrideParameters

public java.util.Set<ModelParam> overrideParameters
Set of override parameters


permissionGroups

public java.util.List<ModelPermGroup> permissionGroups
List of permission groups for service invocation


notifications

public java.util.List<ModelNotification> notifications
List of email-notifications for this service


internalGroup

public GroupModel internalGroup
Internal Service Group


contextInfo

protected java.util.Map<java.lang.String,ModelParam> contextInfo
Context Information, a Map of parameters used by the service, contains ModelParam objects


contextParamList

protected java.util.List<ModelParam> contextParamList
Context Information, a List of parameters used by the service, contains ModelParam objects


inheritedParameters

protected boolean inheritedParameters
Flag to say if we have pulled in our addition parameters from our implemented service(s)

Constructor Detail

ModelService

public ModelService()

ModelService

public ModelService(ModelService model)
Method Detail

get

public java.lang.Object get(java.lang.Object name)
Specified by:
get in interface java.util.Map<java.lang.String,java.lang.Object>
Overrides:
get in class java.util.AbstractMap<java.lang.String,java.lang.Object>

entrySet

public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
Specified by:
entrySet in interface java.util.Map<java.lang.String,java.lang.Object>
Specified by:
entrySet in class java.util.AbstractMap<java.lang.String,java.lang.Object>

put

public java.lang.Object put(java.lang.String o1,
                            java.lang.Object o2)
Specified by:
put in interface java.util.Map<java.lang.String,java.lang.Object>
Overrides:
put in class java.util.AbstractMap<java.lang.String,java.lang.Object>

toString

public java.lang.String toString()
Overrides:
toString in class java.util.AbstractMap<java.lang.String,java.lang.Object>

debugInfo

public java.lang.String debugInfo()

inheritedParameters

public boolean inheritedParameters()
Test if we have already inherited our interface parameters

Returns:
boolean

getParam

public ModelParam getParam(java.lang.String name)
Gets the ModelParam by name

Parameters:
name - The name of the parameter to get
Returns:
ModelParam object with the specified name

addParam

public void addParam(ModelParam param)
Adds a parameter definition to this service; puts on list in order added then sorts by order if specified.


addParamClone

public void addParamClone(ModelParam param)
Adds a clone of a parameter definition to this service


getAllParamNames

public java.util.Set<java.lang.String> getAllParamNames()

getInParamNames

public java.util.Set<java.lang.String> getInParamNames()

getDefinedInCount

public int getDefinedInCount()

getOutParamNames

public java.util.Set<java.lang.String> getOutParamNames()

getDefinedOutCount

public int getDefinedOutCount()

updateDefaultValues

public void updateDefaultValues(java.util.Map<java.lang.String,java.lang.Object> context,
                                java.lang.String mode)

validate

public void validate(java.util.Map<java.lang.String,java.lang.Object> context,
                     java.lang.String mode,
                     java.util.Locale locale)
              throws ServiceValidationException
Validates a Map against the IN or OUT parameter information

Parameters:
test - The Map object to test
mode - Test either mode IN or mode OUT
Throws:
ServiceValidationException

validate

public static void validate(java.util.Map<java.lang.String,java.lang.String> info,
                            java.util.Map<java.lang.String,? extends java.lang.Object> test,
                            boolean reverse,
                            ModelService model,
                            java.lang.String mode,
                            java.util.Locale locale)
                     throws ServiceValidationException
Validates a map of name, object types to a map of name, objects

Parameters:
info - The map of name, object types
test - The map to test its value types.
reverse - Test the maps in reverse.
Throws:
ServiceValidationException

typeValidate

public static boolean typeValidate(org.ofbiz.service.ModelParam.ModelParamValidator vali,
                                   java.lang.Object testValue)
                            throws GeneralException
Throws:
GeneralException

getParameterNames

public java.util.List<java.lang.String> getParameterNames(java.lang.String mode,
                                                          boolean optional,
                                                          boolean internal)
Gets the parameter names of the specified mode (IN/OUT/INOUT). The parameters will be returned in the order specified in the file. Note: IN and OUT will also contains INOUT parameters.

Parameters:
mode - The mode (IN/OUT/INOUT)
optional - True if to include optional parameters
internal - True to include internal parameters
Returns:
List of parameter names

getParameterNames

public java.util.List<java.lang.String> getParameterNames(java.lang.String mode,
                                                          boolean optional)

makeValid

public java.util.Map<java.lang.String,java.lang.Object> makeValid(java.util.Map<java.lang.String,? extends java.lang.Object> source,
                                                                  java.lang.String mode)
Creates a new Map based from an existing map with just valid parameters. Tries to convert parameters to required type.

Parameters:
source - The source map
mode - The mode which to build the new map

makeValid

public java.util.Map<java.lang.String,java.lang.Object> makeValid(java.util.Map<java.lang.String,? extends java.lang.Object> source,
                                                                  java.lang.String mode,
                                                                  boolean includeInternal,
                                                                  java.util.List<java.lang.Object> errorMessages)
Creates a new Map based from an existing map with just valid parameters. Tries to convert parameters to required type.

Parameters:
source - The source map
mode - The mode which to build the new map
includeInternal - When false will exclude internal fields

makeValid

public java.util.Map<java.lang.String,java.lang.Object> makeValid(java.util.Map<java.lang.String,? extends java.lang.Object> source,
                                                                  java.lang.String mode,
                                                                  boolean includeInternal,
                                                                  java.util.List<java.lang.Object> errorMessages,
                                                                  java.util.Locale locale)
Creates a new Map based from an existing map with just valid parameters. Tries to convert parameters to required type.

Parameters:
source - The source map
mode - The mode which to build the new map
includeInternal - When false will exclude internal fields
locale - Locale to use to do some type conversion

makeValid

public java.util.Map<java.lang.String,java.lang.Object> makeValid(java.util.Map<java.lang.String,? extends java.lang.Object> source,
                                                                  java.lang.String mode,
                                                                  boolean includeInternal,
                                                                  java.util.List<java.lang.Object> errorMessages,
                                                                  java.util.TimeZone timeZone,
                                                                  java.util.Locale locale)
Creates a new Map based from an existing map with just valid parameters. Tries to convert parameters to required type.

Parameters:
source - The source map
mode - The mode which to build the new map
includeInternal - When false will exclude internal fields
tz - TimeZone to use to do some type conversion
locale - Locale to use to do some type conversion

containsPermissions

public boolean containsPermissions()

evalPermission

public java.util.Map<java.lang.String,java.lang.Object> evalPermission(DispatchContext dctx,
                                                                       java.util.Map<java.lang.String,? extends java.lang.Object> context)
Evaluates permission-service for this service.

Parameters:
dctx - DispatchContext from the invoked service
context - Map containing userLogin and context infromation
Returns:
result of permission service invocation

evalNotifications

public void evalNotifications(DispatchContext dctx,
                              java.util.Map<java.lang.String,? extends java.lang.Object> context,
                              java.util.Map<java.lang.String,java.lang.Object> result)
Evaluates notifications


evalPermissions

public boolean evalPermissions(DispatchContext dctx,
                               java.util.Map<java.lang.String,? extends java.lang.Object> context)
Evaluates permissions for a service.

Parameters:
dctx - DispatchContext from the invoked service
context - Map containing userLogin infromation
Returns:
true if all permissions evaluate true.

getInParameterSequence

public java.util.List<java.lang.Object> getInParameterSequence(java.util.Map<java.lang.String,? extends java.lang.Object> source)
Gets a list of required IN parameters in sequence.

Returns:
A list of required IN parameters in the order which they were defined.

getModelParamList

public java.util.List<ModelParam> getModelParamList()
Returns a list of ModelParam objects in the order they were defined when the service was created.


getInModelParamList

public java.util.List<ModelParam> getInModelParamList()
Returns a list of ModelParam objects in the order they were defined when the service was created.


interfaceUpdate

public void interfaceUpdate(DispatchContext dctx)
                     throws GenericServiceException
Run the interface update and inherit all interface parameters

Parameters:
dctx - The DispatchContext to use for service lookups
Throws:
GenericServiceException

toWSDL

public org.w3c.dom.Document toWSDL(java.lang.String locationURI)
                            throws WSDLException
Throws:
WSDLException

getWSDL

public void getWSDL(Definition def,
                    java.lang.String locationURI)
             throws WSDLException
Throws:
WSDLException