public abstract class ServiceContext extends Object implements UIResourceLocator
From release 5.8.0, it is strongly advised to use the new UserService
API.
Please refer to the
current documentation on user services
for more information.
Modifier and Type | Method and Description |
---|---|
abstract void |
addMessage(UserMessage aMessage)
Adds a message regarding the validation of the form in the page.
|
abstract ProcedureResult |
execute(boolean addErrorMessageIfException,
Procedure aProcedure)
Executes the specified procedure and calls its implementation of the method
Procedure.execute . |
abstract ProcedureResult |
execute(Procedure aProcedure)
Executes the specified procedure.
|
abstract Adaptation |
getCurrentAdaptation()
Returns the dataset or record currently selected in the user interface.
|
abstract HierarchyNode |
getCurrentHierarchyNode()
Returns the node currently selected in a hierarchy.
|
abstract AdaptationHome |
getCurrentHome()
Returns the dataspace currently selected in the user interface.
|
abstract SchemaNode |
getCurrentNode()
Returns the data model node currently selected in the current Adaptation.
|
abstract Path |
getCurrentPathInAdaptation()
Returns the path of the node currently selected in the user interface.
|
abstract Request |
getCurrentRequest()
Returns the request corresponding to the current table view in the EBX® user interface,
including the filters and sort criteria set on the view.
|
abstract Request |
getCurrentRequestOnHierarchyLeaves()
Returns the request over the records of the current hierarchy leaves.
|
abstract Request |
getCurrentRequestOnSelectedOccurrences()
Returns the request over the records currently selected in the EBX® user interface.
|
abstract SchemaNode |
getCurrentTable()
Returns the table node currently selected in EBX®.
|
abstract Locale |
getLocale()
Returns the current locale of the user interface session.
|
abstract String |
getModuleName()
Returns the name of the module that declares the service
being executed.
|
abstract List<HierarchyNode> |
getSelectedHierarchyNodes()
Returns the nodes currently selected in a hierarchy.
|
abstract List<Adaptation> |
getSelectedOccurrences()
Returns the records currently selected in the user interface.
|
static ServiceContext |
getServiceContext(HttpServletRequest aRequest)
Retrieves a context instance from HTTP request attributes.
|
abstract String |
getServiceDescription()
Returns the description of the service, localized for the session's current locale.
|
abstract ServiceKey |
getServiceKey()
Returns the key of the current service.
|
abstract String |
getServiceLabel()
Returns the label of the service, localized for the session's current locale.
|
abstract Session |
getSession()
Returns the current session context.
|
abstract UIServiceComponentWriter |
getUIComponentWriter()
This method can be used in a Servlet to get a
component writer in order to add standard EBX® components.
|
abstract UIServiceComponentWriter |
getUIComponentWriterForJSP(JspWriter aJspWriter)
This method can be used in a JSP to get a
component writer to add some integrated components.
|
abstract String |
getURLForEndingService()
Returns a user interface URL indicating that the execution of this service is finished.
|
abstract String |
getURLForEndingServiceInPopup()
Returns a user interface URL indicating that the execution of this service is finished.
|
abstract String |
getURLForForwardingToResource(String aResourcePath)
Returns a user interface URL forwarding this service execution to the specified resource.
|
abstract String |
getURLForIncludingResource(String aResourcePath)
Returns a user interface URL indicating that this service execution continues to the resource
specified.
|
abstract String |
getURLForServiceSelection(AdaptationHome aHome,
Adaptation aRecordOrInstance,
SchemaNode aNode,
ServiceKey aServiceKey)
Returns a user interface URL that selects the specified node in the given record or dataset
and starts the specified service on it, in the context of the given
AdaptationHome . |
abstract String |
getURLForServiceSelection(AdaptationHome aHome,
Adaptation aRecordOrInstance,
ServiceKey aServiceKey)
Returns a user interface URL that selects the specified record or dataset
and starts the specified service on it, in the context of the given
AdaptationHome . |
abstract String |
getURLForServiceSelection(AdaptationHome aHome,
ServiceKey aServiceKey)
Returns a user interface URL that selects the specified dataspace
and starts the specified service on it.
|
abstract String |
getURLForServiceSelection(Adaptation aRecordOrInstance,
SchemaNode aNode,
ServiceKey aServiceKey)
Returns a user interface URL which selects the specified node in the given record or dataset
and starts the specified service on it.
|
abstract String |
getURLForServiceSelection(Adaptation aRecordOrInstance,
ServiceKey aServiceKey)
Returns a user interface URL which selects the specified record or dataset
and starts the specified service on it.
|
abstract String |
getURLForServiceSelection(ServiceKey aServiceKey)
Returns a user interface URL to start the specified service.
|
abstract List<SchemaNode> |
getViewedSchemaNodes()
Returns the nodes (or "columns" from a user perspective)
that are currently displayed by the tabular view.
|
abstract boolean |
isCalledOnHierarchyNode()
Returns
true if the current service is called from the contextual menu of a hierarchy node. |
abstract boolean |
isCalledOnHome()
Returns
true if the current service is called from a dataspace or snapshot menu. |
abstract boolean |
isCalledOnInstance()
Returns
true if the current service is called from a dataset menu. |
abstract boolean |
isCalledOnOccurrencePage()
Returns
true if the current service is called from a record page. |
abstract boolean |
isCalledOnTable()
Returns
true if the current service is called on the whole table view. |
abstract boolean |
isCalledOnTableSelection()
Returns
true if the current service is called on the selected records of the view. |
void |
setContextSensitiveHelpURL(String aURL)
Enables the context-sensitive help button in the header of the workspace.
|
void |
setTitle(UserMessage aMessage)
Replaces the default title of the user service in the header of the workspace.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createWebComponentForRootSession, createWebComponentForSubSession, getURLForAjaxComponent, getURLForAjaxComponent, getURLForPerspectiveSelection, getURLForPerspectiveSelection, getURLForResource, getURLForResource, getURLForResource, getURLForResource, getURLForResource, getURLForRest, getURLForSelection, getURLForSelection, getURLForSelection, getURLForSelection, getURLForSelection, getURLForSelection, getURLForViewSelection
public static final ServiceContext getServiceContext(HttpServletRequest aRequest)
null
while in the context of a service execution (this means that
the user interface is performing a server-side include).public abstract ProcedureResult execute(Procedure aProcedure)
This method is equivalent to:
ServiceContext.execute(true, aProcedure);
execute(boolean, Procedure)
public abstract ProcedureResult execute(boolean addErrorMessageIfException, Procedure aProcedure)
Procedure.execute
.addErrorMessageIfException
- specifies whether the user interface automatically reports an error message
whenever the execution has encountered an error.aProcedure
- the procedure to be executed.public abstract AdaptationHome getCurrentHome()
public abstract Adaptation getCurrentAdaptation()
This method returns a dataset if:
isCalledOnInstance()
);isCalledOnTable()
);isCalledOnTableSelection()
).This method returns a record if:
isCalledOnTableSelection()
);isCalledOnOccurrencePage()
);isCalledOnHierarchyNode()
).IllegalStateException
- if the current service is running on a dataspace or snapshot (see
isCalledOnHome()
).getSelectedOccurrences()
public abstract Request getCurrentRequest()
null
if this service is called outside a table context.
If this service is invoked in a hierarchy view, returns the request on the target table. Filters are not applied (except record-level permission rules, if any).
isCalledOnTable()
public abstract Request getCurrentRequestOnSelectedOccurrences()
null
if this service is called outside the context of a table.
If no records are selected, the returned request will have an empty result.
isCalledOnTableSelection()
public abstract Request getCurrentRequestOnHierarchyLeaves()
null
if this service is called outside the context of a hierarchy.isCalledOnTable()
public abstract List<Adaptation> getSelectedOccurrences() throws UnsupportedOperationException
Adaptation
that correspond to the records selected in
the user interface, or an empty list if the service is being executed on a data
set or from the contextual menu of a hierarchy node.UnsupportedOperationException
- if too many records are specified; the limit is specified by the property
ebx.view.restrictSelectionsOnLargeLists.threshold
.
If large volumes of data are involved, it is recommended to use
the method getCurrentRequestOnSelectedOccurrences()
instead.getCurrentRequestOnSelectedOccurrences()
public abstract List<SchemaNode> getViewedSchemaNodes()
Returns null
if this service is called outside a table view or
if no specific filtering has been applied to columns.
public abstract SchemaNode getCurrentNode()
IllegalStateException
- if the current service is running on a dataspace or snapshot (see
isCalledOnHome()
).getCurrentAdaptation()
public abstract SchemaNode getCurrentTable()
IllegalStateException
- if the current service is running outside a table context.public abstract HierarchyNode getCurrentHierarchyNode()
null
if
the current service is not called from the contextual menu of a hierarchy node
(see isCalledOnHierarchyNode()
).isCalledOnHierarchyNode()
public abstract List<HierarchyNode> getSelectedHierarchyNodes()
HierarchyNode
that corresponds to the nodes selected in
the user interface displayed hierarchy. Returns null
if the current service is not called
in the context of a hierarchy.public abstract Path getCurrentPathInAdaptation()
IllegalStateException
- if the current service is running on a dataspace or on a snapshot (see
isCalledOnHome()
).public abstract Locale getLocale()
Session.getLocale()
public abstract Session getSession()
public abstract String getServiceLabel()
The label of the service is specified in the data model, under the node
xs:annotation/xs:documentation
.
setTitle(UserMessage)
public abstract ServiceKey getServiceKey()
ServiceKey
public abstract String getServiceDescription()
The description of the service is specified in the data model, under the node
xs:annotation/xs:documentation
.
public abstract void addMessage(UserMessage aMessage)
public final void setContextSensitiveHelpURL(String aURL)
Clicking on the button displays the help pop-up with the target URL.
The simple help button can also be placed anywhere with
UIComponentWriter.addButtonHelp(String)
.
aURL
- the URL of the pop-up content.public final void setTitle(UserMessage aMessage)
aMessage
- the text of the title.public abstract String getURLForIncludingResource(String aResourcePath)
The resource must be in the same web application as the service.
aResourcePath
- path of the resource in its web application (it must not contain the web application's
specific path).UIResourceLocator
public abstract String getURLForForwardingToResource(String aResourcePath)
The resource must be in the same web application as the service.
aResourcePath
- absolute path of the resource in its web application (it must not contain the web
application's
specific path, and must start with '/').UIResourceLocator
public abstract String getURLForEndingService()
UIResourceLocator
public abstract String getURLForEndingServiceInPopup()
public abstract String getURLForServiceSelection(ServiceKey aServiceKey)
ServiceKey.WORKFLOW
).IllegalArgumentException
- if the built-in service is not supported by this method; this is the case for
MASSDELETE
, COMPARE
,
and CLOSE
.UIResourceLocator
public abstract String getURLForServiceSelection(Adaptation aRecordOrInstance, ServiceKey aServiceKey)
IllegalArgumentException
- if the built-in service is not supported by this method; this is the case for
MASSDELETE
, COMPARE
,
and CLOSE
.UIResourceLocator
public abstract String getURLForServiceSelection(AdaptationHome aHome, ServiceKey aServiceKey)
IllegalArgumentException
- if the built-in service is not supported by this method; this is the case for
MASSDELETE
, COMPARE
,
and CLOSE
.UIResourceLocator
public abstract String getURLForServiceSelection(AdaptationHome aHome, Adaptation aRecordOrInstance, ServiceKey aServiceKey)
AdaptationHome
.IllegalArgumentException
- if the built-in service is not supported by this method; this is the case for
MASSDELETE
, COMPARE
,
and CLOSE
.UIResourceLocator
public abstract String getURLForServiceSelection(Adaptation aRecordOrInstance, SchemaNode aNode, ServiceKey aServiceKey)
IllegalArgumentException
- if the built-in service is not supported by this method; this is the case for
MASSDELETE
, COMPARE
,
and CLOSE
.UIResourceLocator
public abstract String getURLForServiceSelection(AdaptationHome aHome, Adaptation aRecordOrInstance, SchemaNode aNode, ServiceKey aServiceKey)
AdaptationHome
.IllegalArgumentException
- if the built-in service is not supported by this method; this is the case for
MASSDELETE
, COMPARE
,
and CLOSE
.UIResourceLocator
public abstract boolean isCalledOnHome()
true
if the current service is called from a dataspace or snapshot menu.getCurrentHome()
public abstract boolean isCalledOnInstance()
true
if the current service is called from a dataset menu.getCurrentAdaptation()
public abstract boolean isCalledOnTable()
true
if the current service is called on the whole table view.
In this case, it is expected that the service will be applied to the whole view or to the filtered view.
It is obtained by calling the method getCurrentRequest()
.
getCurrentRequest()
public abstract boolean isCalledOnHierarchyNode()
true
if the current service is called from the contextual menu of a hierarchy node.
In this case, it is expected that the service will be applied to a hierarchy node.
It is obtained by calling the method getCurrentHierarchyNode()
.
getCurrentHierarchyNode()
public abstract boolean isCalledOnTableSelection()
true
if the current service is called on the selected records of the view.
In this case, it is expected that the service be applied to the selected records.
They are obtained by calling the method getSelectedOccurrences()
.
getSelectedOccurrences()
public abstract boolean isCalledOnOccurrencePage()
true
if the current service is called from a record page.
In this case, it is expected that the service will be applied to the current record.
It is obtained by calling the method getCurrentAdaptation()
.
getCurrentAdaptation()
public abstract UIServiceComponentWriter getUIComponentWriter()
Attention: This getter must not be called from a JSP.
Use getUIComponentWriterForJSP(JspWriter)
instead.
public abstract UIServiceComponentWriter getUIComponentWriterForJSP(JspWriter aJspWriter)
Attention: This method must be called by only one JSP page.
In the case of jsp:include
, this method must not be called from the initial page
and the target page at the same time.
aJspWriter
- the out
buffer used to write HTMLpublic abstract String getModuleName()