Package lumis.doui.service
Class DouiService
- java.lang.Object
-
- lumis.portal.service.GenericService
-
- lumis.doui.service.DouiService
-
- All Implemented Interfaces:
IDouiService
,IHyperLinkResolver
,IService
- Direct Known Subclasses:
ActivityStreamService
,CommentItService
,ContentService
,HtmlService
,MicroblogService
,ProducerService
,SocialNetworkIntegrationService
,URLRedirectService
,WSRPConsumerService
@StableMinor(version="16.1", sinceVersion="4.0") public class DouiService extends GenericService implements IDouiService, IHyperLinkResolver
Implements a DOUI Service.- Since:
- 4.0.0
- Version:
- $Revision: 26157 $ $Date: 2024-01-13 11:35:03 -0300 (Sat, 13 Jan 2024) $
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
EVENT_REST_CALL
Key for rest call event.-
Fields inherited from class lumis.portal.service.GenericService
serviceConfig
-
-
Constructor Summary
Constructors Constructor Description DouiService()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addDefaultDouiDefinitionValues(SessionConfig sessionConfig, ServiceConfig serviceConfig, org.w3c.dom.Node douiDefinitionNode, ITransaction transaction)
void
autoAddDependencies(SessionConfig sessionConfig, ServiceInstanceConfig config, ITransaction transaction)
Adds service specific dependencies.org.w3c.dom.Element
getDefaultServiceInstanceMenu(ServiceInstanceConfig serviceInstance)
Returns the default service instance menu definition to use for a service instance.protected java.lang.String
getResourceClassName()
protected IDouiRestInterfaceRequest.ResponseType
getReturnType(java.lang.String restInterfaceName)
Returns the type of the REST result.boolean
hasHtmlField(ITransaction transaction)
Indicates if this service has an html field.void
instanceAdded(SessionConfig sessionConfig, ServiceInstanceConfig config, ITransaction transaction)
Called by the service container to indicate that a service instance has been added.void
instanceDeleted(SessionConfig sessionConfig, ServiceInstanceConfig config, ITransaction transaction)
Called by the service container to indicate that a service instance is about to be deleted.void
instanceDeserialized(ServiceInstanceDeserializationContext serviceInstanceDeserializationContext)
Called after an service instance is deserialized.void
postRegister(SessionConfig sessionConfig, ServiceConfig serviceConfig, ITransaction transaction)
Called by the service manager after a service definition is registered.void
preUnregister(SessionConfig sessionConfig, ITransaction transaction)
Called by the service manager when a service is about to be unregistered.IServiceInterfaceUrl
resolveHyperLink(SessionConfig sessionConfig, HyperLinkConfig hyperLinkConfig, ITransaction transaction)
Resolves an hyperlink to the corresponding URL.protected Response
restCallProcessAction(java.lang.String interfaceSimpleId, java.lang.String restShortName, java.lang.String lumActionId, UriInfo uriInfo)
Process action call API.
This method is intended to be used typically, but not limited to, from the browser, for those who want to execute a given process action.
Before call this API, user must already have performed any required authentication.
The default implementation will return:
307 redirect to the URL that will perform the process action. Bad request (400) if there's something wrong with the request. Forbidden (403) if user has no permission to perform the given request. Internal server error (500) if something went wrong during the processing.
In the default implementation, this method is called by bothrestDoProcessAction(String, String, String, UriInfo, HttpServletRequest)
andrestDoProcessActionWithActionId(String, String, String, UriInfo, HttpServletRequest)
.Response
restDoProcessAction(java.lang.String interfaceSimpleId, java.lang.String restShortName, java.lang.String lumActionId, UriInfo uriInfo, HttpServletRequest request)
Process action call API.
This method is intended to be used typically, but not limited to, from the browser, for those who want to execute a given process action.
Before call this API, user must already have performed any required authentication.
The default implementation will return:
307 redirect to the URL that will perform the process action. Bad request (400) if there's something wrong with the request. Forbidden (403) if user has no permission to perform the given request. Internal server error (500) if something went wrong during the processing.
To override the default behavior, override the methodrestCallProcessAction(String, String, String, UriInfo)
.Response
restDoProcessActionWithActionId(java.lang.String interfaceSimpleId, java.lang.String restShortName, java.lang.String lumActionId, UriInfo uriInfo, HttpServletRequest request)
Process action call API.
This method is intended to be used typically, but not limited to, from the browser, for those who want to execute a given process action.
Before call this API, user must already have performed any required authentication.
The default implementation will return:
307 redirect to the URL that will perform the process action. Bad request (400) if there's something wrong with the request. Forbidden (403) if user has no permission to perform the given request. Internal server error (500) if something went wrong during the processing.
To override the default behavior, override the methodrestCallProcessAction(String, String, String, UriInfo)
.Response
restGetProcessActionRestHelp(java.lang.String interfaceSimpleId, java.lang.String restShortName, HttpServletRequest req, HttpServletResponse resp)
Returns the help for the process action call of the given service interface in the given service instance (given in form of rest short name).
In the default implementation, this method will find alldata controls
of the requested interface and will write as an HTML response the parameters described byIDataControl.getRequestHelpDefinition()
.Response
restLumGetDataGet(java.lang.String restShortName, java.lang.String restInterfaceName, HttpServletRequest servletRequest)
Sub-resource to treats request on GET HTTP method.Response
restLumGetDataPost(java.lang.String restShortName, java.lang.String restInterfaceName, HttpServletRequest servletRequest)
Sub-resource to treats request on POST HTTP method.protected void
setDataTypeAttributes(org.w3c.dom.Node douiDefinitionNode, ITransaction transaction)
Replace number data type for integer data type, for backward compatibility.protected void
setDisplayAttributes(org.w3c.dom.Node douiDefinitionNode, ITransaction transaction)
protected void
setIncludeAlwaysAttributes(org.w3c.dom.Node douiDefinitionNode, ITransaction transaction)
protected void
setLookupAttributes(org.w3c.dom.Node douiDefinitionNode, ITransaction transaction)
protected void
setPositionAttributes(org.w3c.dom.Node douiDefinitionNode, ITransaction transaction)
Sets default attribute values for position field.protected void
setPriorityOptions(org.w3c.dom.Node douiDefinitionNode, ITransaction transaction)
protected void
setSourceFieldAttributes(SessionConfig sessionConfig, ServiceConfig serviceConfig, org.w3c.dom.Node douiDefinitionNode, ITransaction transaction)
protected void
setValidationAttributes(org.w3c.dom.Node douiDefinitionNode, ITransaction transaction)
boolean
usesDocumentService(ITransaction transaction)
Indicates if this service uses a document service (as repository, for example).boolean
usesFileManager(ITransaction transaction)
Indicates if this service uses theFileManager
file storage API.boolean
usesImageService(ITransaction transaction)
Deprecated.boolean
usesMediaRepository(ITransaction transaction)
Indicates if this service may use a media repository.boolean
usesWidgetRepository(ITransaction transaction)
Indicates if this service uses a widget repository.-
Methods inherited from class lumis.portal.service.GenericService
deserializeContent, instanceDeserialized, instanceLoaded, instanceMoved, instanceMoved, instanceSerialized, instanceSerialized, instanceUnloaded, load, postUnregister, preRegister, unload
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface lumis.portal.service.IService
checkFileAccess, deserializeContent, instanceDeserialized, instanceLoaded, instanceMoved, instanceMoved, instanceMoved, instanceSerialized, instanceSerialized, instanceUnloaded, load, postUnregister, preRegister, unload
-
-
-
-
Field Detail
-
EVENT_REST_CALL
public static final java.lang.String EVENT_REST_CALL
Key for rest call event.- Since:
- 14.2.0
- See Also:
- Constant Field Values
-
-
Method Detail
-
restLumGetDataPost
@Path("/lumgetdata/{restInterfaceName}") @POST @Produces({"application/json","application/xml"}) public final Response restLumGetDataPost(@PathParam("restShortName") java.lang.String restShortName, @PathParam("restInterfaceName") java.lang.String restInterfaceName, @Context HttpServletRequest servletRequest)
Sub-resource to treats request on POST HTTP method. This sub-resource is responsible for load a REST interface and return the information as JSON or XML format.- Parameters:
restShortName
- instance of service target that the information will be loaded.restInterfaceName
- name of the rest interface that will be loaded, optionally including an extension (.json or .xml) used to choose the response format.servletRequest
- request object that contains all information that was sent by user.- Returns:
- returns the information loaded from rest interface as JSON or XML format.
- Since:
- 6.1.0
-
getReturnType
protected IDouiRestInterfaceRequest.ResponseType getReturnType(java.lang.String restInterfaceName)
Returns the type of the REST result.- Parameters:
restInterfaceName
- interface rest name that contains the return type.- Returns:
- MediaType.APPLICATION_XML if the rest interface name ends with ".xml". Otherwise return MediaType.APPLICATION_JSON.
- Since:
- 6.1.0
-
restLumGetDataGet
@Path("/lumgetdata/{restInterfaceName}") @GET @Produces({"application/json","application/xml"}) public final Response restLumGetDataGet(@PathParam("restShortName") java.lang.String restShortName, @PathParam("restInterfaceName") java.lang.String restInterfaceName, @Context HttpServletRequest servletRequest)
Sub-resource to treats request on GET HTTP method. This sub-resource is responsible for load a REST interface and return the information as JSON or XML format.- Parameters:
restShortName
- instance of service target that the information will be loaded.restInterfaceName
- name of the rest interface that will be loaded, optionally including an extension (.json or .xml) used to choose the response format.servletRequest
- request object that contains all information that was sent by user.- Returns:
- returns the information loaded from rest interface as JSON or XML format.
- Since:
- 6.1.0
-
restDoProcessAction
@Path("/lumPA/{interfaceSimpleId: [a-zA-Z][\\w]*}.json") @POST public final Response restDoProcessAction(@PathParam("interfaceSimpleId") java.lang.String interfaceSimpleId, @PathParam("restShortName") java.lang.String restShortName, @QueryParam("lumActionId") java.lang.String lumActionId, @Context UriInfo uriInfo, @Context HttpServletRequest request)
Process action call API.
This method is intended to be used typically, but not limited to, from the browser, for those who want to execute a given process action.
Before call this API, user must already have performed any required authentication.
The default implementation will return:
- 307 redirect to the URL that will perform the process action.
- Bad request (400) if there's something wrong with the request.
- Forbidden (403) if user has no permission to perform the given request.
- Internal server error (500) if something went wrong during the processing.
To override the default behavior, override the methodrestCallProcessAction(String, String, String, UriInfo)
.- Parameters:
interfaceSimpleId
- The target interface simple identifier. It is the part after the last '.' character of interface identifier.restShortName
- The target service instance's rest short name.lumActionId
- the target process action identifier.uriInfo
- the URI information about the request.request
- the request.- Returns:
- the
Response
to be sent to the client. - Since:
- 10.4.0
-
restDoProcessActionWithActionId
@Path("/lumPA/{interfaceSimpleId: [a-zA-Z][\\w]*}/{lumActionId: [a-zA-Z][\\w]*}.json") @POST public final Response restDoProcessActionWithActionId(@PathParam("interfaceSimpleId") java.lang.String interfaceSimpleId, @PathParam("restShortName") java.lang.String restShortName, @PathParam("lumActionId") java.lang.String lumActionId, @Context UriInfo uriInfo, @Context HttpServletRequest request)
Process action call API.
This method is intended to be used typically, but not limited to, from the browser, for those who want to execute a given process action.
Before call this API, user must already have performed any required authentication.
The default implementation will return:
- 307 redirect to the URL that will perform the process action.
- Bad request (400) if there's something wrong with the request.
- Forbidden (403) if user has no permission to perform the given request.
- Internal server error (500) if something went wrong during the processing.
To override the default behavior, override the methodrestCallProcessAction(String, String, String, UriInfo)
.- Parameters:
interfaceSimpleId
- The target interface simple identifier. It is the part after the last '.' character of interface identifier.restShortName
- The target service instance's rest short name.lumActionId
- the target process action identifier.uriInfo
- the URI information about the request.request
- the request.- Returns:
- the
Response
to be sent to the client. - Since:
- 10.4.0
-
restCallProcessAction
protected Response restCallProcessAction(java.lang.String interfaceSimpleId, java.lang.String restShortName, java.lang.String lumActionId, UriInfo uriInfo)
Process action call API.
This method is intended to be used typically, but not limited to, from the browser, for those who want to execute a given process action.
Before call this API, user must already have performed any required authentication.
The default implementation will return:
- 307 redirect to the URL that will perform the process action.
- Bad request (400) if there's something wrong with the request.
- Forbidden (403) if user has no permission to perform the given request.
- Internal server error (500) if something went wrong during the processing.
In the default implementation, this method is called by bothrestDoProcessAction(String, String, String, UriInfo, HttpServletRequest)
andrestDoProcessActionWithActionId(String, String, String, UriInfo, HttpServletRequest)
.- Parameters:
interfaceSimpleId
- The target interface simple identifier. It is the part after the last '.' character of interface identifier.restShortName
- The target service instance's rest short name.lumActionId
- the target process action identifier.uriInfo
- the URI information about the request.- Returns:
- the
Response
to be sent to the client. - Since:
- 10.4.0
-
restGetProcessActionRestHelp
@Path("/lumPA/{interfaceSimpleId: [a-zA-Z][\\w]*}/help") @GET public Response restGetProcessActionRestHelp(@PathParam("interfaceSimpleId") java.lang.String interfaceSimpleId, @PathParam("restShortName") java.lang.String restShortName, @Context HttpServletRequest req, @Context HttpServletResponse resp) throws java.lang.Exception
Returns the help for the process action call of the given service interface in the given service instance (given in form of rest short name).
In the default implementation, this method will find alldata controls
of the requested interface and will write as an HTML response the parameters described byIDataControl.getRequestHelpDefinition()
. The default implementation will return:
- An HTML (response code 200) with the parameters.
- Bad request (400) if there's something wrong with the request.
- Forbidden (403) if user has no permission to perform the given request.
- Internal server error (500) if something went wrong during the processing.
- Parameters:
interfaceSimpleId
- The target interface simple identifier. It is the part after the last '.' character of interface identifier.restShortName
- The target service instance's rest short name.req
- The Servlet request.resp
- The Servlet response.- Returns:
- the response code.
- Throws:
java.lang.Exception
- Since:
- 10.4.0
-
preUnregister
public void preUnregister(SessionConfig sessionConfig, ITransaction transaction) throws PortalException
Description copied from interface:IService
Called by the service manager when a service is about to be unregistered.- Specified by:
preUnregister
in interfaceIService
- Overrides:
preUnregister
in classGenericService
- Parameters:
sessionConfig
- the user session information.transaction
- transaction for persistence access.- Throws:
PortalException
-
postRegister
public void postRegister(SessionConfig sessionConfig, ServiceConfig serviceConfig, ITransaction transaction) throws PortalException
Description copied from interface:IService
Called by the service manager after a service definition is registered. This method allows the Service implementation to perform any custom registration that the service may require.- Specified by:
postRegister
in interfaceIService
- Overrides:
postRegister
in classGenericService
- Throws:
PortalException
-
getResourceClassName
protected java.lang.String getResourceClassName()
- Overrides:
getResourceClassName
in classGenericService
-
usesFileManager
public boolean usesFileManager(ITransaction transaction) throws PortalException
Description copied from interface:IDouiService
Indicates if this service uses theFileManager
file storage API.- Specified by:
usesFileManager
in interfaceIDouiService
- Parameters:
transaction
- the transaction for persistence access.- Returns:
- true if this service uses the FileManager, false otherwise.
- Throws:
PortalException
-
usesImageService
@Deprecated public boolean usesImageService(ITransaction transaction) throws PortalException
Deprecated.Description copied from interface:IDouiService
Indicates if this service uses an image service (as repository, for example).- Specified by:
usesImageService
in interfaceIDouiService
- Parameters:
transaction
- the transaction for persistence access.- Returns:
- true if this service uses a image service, false otherwise.
- Throws:
PortalException
-
usesMediaRepository
public boolean usesMediaRepository(ITransaction transaction) throws PortalException
Description copied from interface:IDouiService
Indicates if this service may use a media repository.- Specified by:
usesMediaRepository
in interfaceIDouiService
- Parameters:
transaction
- the transaction for persistence access.- Returns:
true
if this service may use a media service,false
otherwise.- Throws:
PortalException
-
usesDocumentService
public boolean usesDocumentService(ITransaction transaction) throws PortalException
Description copied from interface:IDouiService
Indicates if this service uses a document service (as repository, for example).- Specified by:
usesDocumentService
in interfaceIDouiService
- Parameters:
transaction
- the transaction for persistence access.- Returns:
- true if this service uses a document service, false otherwise.
- Throws:
PortalException
-
usesWidgetRepository
public boolean usesWidgetRepository(ITransaction transaction) throws PortalException
Description copied from interface:IDouiService
Indicates if this service uses a widget repository.- Specified by:
usesWidgetRepository
in interfaceIDouiService
- Parameters:
transaction
- the transaction for persistence access.- Returns:
- true if this service uses a widget repository, false otherwise.
- Throws:
PortalException
-
hasHtmlField
public boolean hasHtmlField(ITransaction transaction) throws PortalException
Description copied from interface:IDouiService
Indicates if this service has an html field.- Specified by:
hasHtmlField
in interfaceIDouiService
- Parameters:
transaction
- the transaction for persistence access.- Returns:
- true if this service has an html field, false otherwise.
- Throws:
PortalException
-
getDefaultServiceInstanceMenu
public org.w3c.dom.Element getDefaultServiceInstanceMenu(ServiceInstanceConfig serviceInstance) throws PortalException
Description copied from interface:IService
Returns the default service instance menu definition to use for a service instance.This default is used if this service does not have a explicit menu definition in its
servicedefinition.xml
.- Specified by:
getDefaultServiceInstanceMenu
in interfaceIService
- Overrides:
getDefaultServiceInstanceMenu
in classGenericService
- Parameters:
serviceInstance
- the service instance.- Returns:
- the menu definition.
- Throws:
PortalException
- if the menu could not be generated.
-
instanceAdded
public void instanceAdded(SessionConfig sessionConfig, ServiceInstanceConfig config, ITransaction transaction) throws ServiceException, PortalException
Description copied from interface:IService
Called by the service container to indicate that a service instance has been added. Dependencies between services must never be created inside this method. Dependencies must be created in theIService.autoAddDependencies(lumis.portal.authentication.SessionConfig, lumis.portal.serviceinstance.ServiceInstanceConfig, lumis.util.ITransaction)
method.- Specified by:
instanceAdded
in interfaceIService
- Overrides:
instanceAdded
in classGenericService
config
- aServiceInstanceConfig
object containing the service's configuration- Throws:
ServiceException
PortalException
-
instanceDeserialized
public void instanceDeserialized(ServiceInstanceDeserializationContext serviceInstanceDeserializationContext) throws PortalException
Description copied from interface:IService
Called after an service instance is deserialized.- Specified by:
instanceDeserialized
in interfaceIService
- Overrides:
instanceDeserialized
in classGenericService
- Throws:
PortalException
-
instanceDeleted
public void instanceDeleted(SessionConfig sessionConfig, ServiceInstanceConfig config, ITransaction transaction) throws PortalException
Description copied from interface:IService
Called by the service container to indicate that a service instance is about to be deleted.- Specified by:
instanceDeleted
in interfaceIService
- Overrides:
instanceDeleted
in classGenericService
config
- aServiceInstanceConfig
object containing the service's configuration- Throws:
ServiceException
PortalException
-
addDefaultDouiDefinitionValues
public void addDefaultDouiDefinitionValues(SessionConfig sessionConfig, ServiceConfig serviceConfig, org.w3c.dom.Node douiDefinitionNode, ITransaction transaction) throws PortalException
- Specified by:
addDefaultDouiDefinitionValues
in interfaceIDouiService
- Throws:
PortalException
-
setSourceFieldAttributes
protected void setSourceFieldAttributes(SessionConfig sessionConfig, ServiceConfig serviceConfig, org.w3c.dom.Node douiDefinitionNode, ITransaction transaction) throws PortalException
- Throws:
PortalException
-
setDataTypeAttributes
protected void setDataTypeAttributes(org.w3c.dom.Node douiDefinitionNode, ITransaction transaction) throws PortalException
Replace number data type for integer data type, for backward compatibility.- Parameters:
douiDefinitionNode
- the doui definition to adjust.transaction
- the transaction for persistence access.- Throws:
PortalException
- Since:
- 4.0.4
-
setPositionAttributes
protected void setPositionAttributes(org.w3c.dom.Node douiDefinitionNode, ITransaction transaction) throws PortalException
Sets default attribute values for position field.- Parameters:
douiDefinitionNode
- the douidefinition xml node.transaction
- the transaction for persistence access.- Throws:
PortalException
- Since:
- 10.3.0
-
setPriorityOptions
protected void setPriorityOptions(org.w3c.dom.Node douiDefinitionNode, ITransaction transaction) throws PortalException
- Throws:
PortalException
-
setIncludeAlwaysAttributes
protected void setIncludeAlwaysAttributes(org.w3c.dom.Node douiDefinitionNode, ITransaction transaction) throws PortalException
- Throws:
PortalException
-
setDisplayAttributes
protected void setDisplayAttributes(org.w3c.dom.Node douiDefinitionNode, ITransaction transaction) throws PortalException
- Throws:
PortalException
-
setLookupAttributes
protected void setLookupAttributes(org.w3c.dom.Node douiDefinitionNode, ITransaction transaction) throws PortalException
- Throws:
PortalException
-
setValidationAttributes
protected void setValidationAttributes(org.w3c.dom.Node douiDefinitionNode, ITransaction transaction) throws PortalException
- Throws:
PortalException
-
autoAddDependencies
public void autoAddDependencies(SessionConfig sessionConfig, ServiceInstanceConfig config, ITransaction transaction) throws ServiceException, PortalException
Description copied from interface:IService
Adds service specific dependencies. This is usually called when an instance of the service is created.- Specified by:
autoAddDependencies
in interfaceIService
- Overrides:
autoAddDependencies
in classGenericService
- Throws:
ServiceException
PortalException
-
resolveHyperLink
public IServiceInterfaceUrl resolveHyperLink(SessionConfig sessionConfig, HyperLinkConfig hyperLinkConfig, ITransaction transaction) throws PortalException
Resolves an hyperlink to the corresponding URL.DouiService delegates this resolution to a
DouiHyperLinkResolver
.- Specified by:
resolveHyperLink
in interfaceIHyperLinkResolver
- Parameters:
sessionConfig
- the user session information.hyperLinkConfig
- hyperlink informationtransaction
- the transaction for persistence access.- Returns:
- the url, or null if the hyperlink could not be resolved.
- Throws:
PortalException
-
-