Class ServiceContext
- All Implemented Interfaces:
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.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionabstract voidaddMessage(UserMessage aMessage) Adds a message regarding the validation of the form in the page.abstract ProcedureResultExecutes the specified procedure and calls its implementation of the methodProcedure.execute.abstract ProcedureResultExecutes the specified procedure.abstract AdaptationReturns the dataset or record currently selected in the user interface.abstract HierarchyNodeReturns the node currently selected in a hierarchy.abstract AdaptationHomeReturns the dataspace currently selected in the user interface.abstract SchemaNodeReturns the data model node currently selected in the current Adaptation.abstract PathReturns the path of the node currently selected in the user interface.abstract RequestReturns the request corresponding to the current table view in the EBX® user interface, including the filters and sort criteria set on the view.abstract RequestReturns the request over the records of the current hierarchy leaves.abstract RequestReturns the request over the records currently selected in the EBX® user interface.abstract SchemaNodeReturns the table node currently selected in EBX®.abstract LocaleReturns the current locale of the user interface session.abstract StringReturns the name of the module that declares the service being executed.abstract List<HierarchyNode>Returns the nodes currently selected in a hierarchy.abstract List<Adaptation>Returns the records currently selected in the user interface.static final ServiceContextgetServiceContext(HttpServletRequest aRequest) Retrieves a context instance from HTTP request attributes.abstract StringReturns the description of the service, localized for the session's current locale.abstract ServiceKeyReturns the key of the current service.abstract StringReturns the label of the service, localized for the session's current locale.abstract SessionReturns the current session context.abstract UIServiceComponentWriterThis method can be used in a Servlet to get a component writer in order to add standard EBX® components.abstract UIServiceComponentWritergetUIComponentWriterForJSP(JspWriter aJspWriter) This method can be used in a JSP to get a component writer to add some integrated components.abstract StringReturns a user interface URL indicating that the execution of this service is finished.abstract StringReturns a user interface URL indicating that the execution of this service is finished.abstract StringgetURLForForwardingToResource(String aResourcePath) Returns a user interface URL forwarding this service execution to the specified resource.abstract StringgetURLForIncludingResource(String aResourcePath) Returns a user interface URL indicating that this service execution continues to the resource specified.abstract StringgetURLForServiceSelection(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 givenAdaptationHome.abstract StringgetURLForServiceSelection(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 givenAdaptationHome.abstract StringgetURLForServiceSelection(AdaptationHome aHome, ServiceKey aServiceKey) Returns a user interface URL that selects the specified dataspace and starts the specified service on it.abstract StringgetURLForServiceSelection(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 StringgetURLForServiceSelection(Adaptation aRecordOrInstance, ServiceKey aServiceKey) Returns a user interface URL which selects the specified record or dataset and starts the specified service on it.abstract StringgetURLForServiceSelection(ServiceKey aServiceKey) Returns a user interface URL to start the specified service.abstract List<SchemaNode>Returns the nodes (or "columns" from a user perspective) that are currently displayed by the tabular view.abstract booleanReturnstrueif the current service is called from the contextual menu of a hierarchy node.abstract booleanReturnstrueif the current service is called from a dataspace or snapshot menu.abstract booleanReturnstrueif the current service is called from a dataset menu.abstract booleanReturnstrueif the current service is called from a record page.abstract booleanReturnstrueif the current service is called on the whole table view.abstract booleanReturnstrueif the current service is called on the selected records of the view.final voidEnables the context-sensitive help button in the header of the workspace.final voidsetTitle(UserMessage aMessage) Replaces the default title of the user service in the header of the workspace.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.orchestranetworks.ui.UIResourceLocator
createWebComponentForRootSession, createWebComponentForSubSession, getURLForAjaxComponent, getURLForAjaxComponent, getURLForPerspectiveSelection, getURLForPerspectiveSelection, getURLForResource, getURLForResource, getURLForResource, getURLForResource, getURLForResource, getURLForRest, getURLForSelection, getURLForSelection, getURLForSelection, getURLForSelection, getURLForSelection, getURLForSelection, getURLForViewSelection
-
Method Details
-
getServiceContext
Retrieves a context instance from HTTP request attributes. This method will not returnnullwhile in the context of a service execution (this means that the user interface is performing a server-side include). -
execute
Executes the specified procedure.This method is equivalent to:
ServiceContext.execute(true, aProcedure);- See Also:
-
execute
Executes the specified procedure and calls its implementation of the methodProcedure.execute.- Parameters:
addErrorMessageIfException- specifies whether the user interface automatically reports an error message whenever the execution has encountered an error.aProcedure- the procedure to be executed.- Returns:
- the result of the execution (particularly, whether it has thrown an exception).
- Since:
- 5.2.1
-
getCurrentHome
Returns the dataspace currently selected in the user interface. -
getCurrentAdaptation
Returns the dataset or record currently selected in the user interface.This method returns a dataset if:
- the current service is running from a dataset menu (see
isCalledOnInstance()); - the current service is running on a whole table,
from "Services on table" menu category (see
isCalledOnTable()); - the current service is running on a table selection,
from "Services on selected records" menu category, and more than one record is selected (see
isCalledOnTableSelection()).
This method returns a record if:
- the current service is running on a table selection
and exactly one record is selected (see
isCalledOnTableSelection()); - the current service is running on a page record (see
isCalledOnOccurrencePage()); - the current service is running on a hierarchy node (see
isCalledOnHierarchyNode()).
- Throws:
IllegalStateException- if the current service is running on a dataspace or snapshot (seeisCalledOnHome()).- See Also:
- the current service is running from a dataset menu (see
-
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. Returnsnullif 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).
- See Also:
-
getCurrentRequestOnSelectedOccurrences
Returns the request over the records currently selected in the EBX® user interface. Returnsnullif this service is called outside the context of a table.If no records are selected, the returned request will have an empty result.
- See Also:
-
getCurrentRequestOnHierarchyLeaves
Returns the request over the records of the current hierarchy leaves. Returnsnullif this service is called outside the context of a hierarchy.- Since:
- 5.8.0
- See Also:
-
getSelectedOccurrences
Returns the records currently selected in the user interface.- Returns:
- a List of
Adaptationthat 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. - Throws:
UnsupportedOperationException- if too many records are specified; the limit is specified by the propertyebx.view.restrictSelectionsOnLargeLists.threshold. If large volumes of data are involved, it is recommended to use the methodgetCurrentRequestOnSelectedOccurrences()instead.- See Also:
-
getViewedSchemaNodes
Returns the nodes (or "columns" from a user perspective) that are currently displayed by the tabular view.Returns
nullif this service is called outside a table view or if no specific filtering has been applied to columns. -
getCurrentNode
Returns the data model node currently selected in the current Adaptation. If called on a table records selection, this method always returns the current table node.- Throws:
IllegalStateException- if the current service is running on a dataspace or snapshot (seeisCalledOnHome()).- See Also:
-
getCurrentTable
Returns the table node currently selected in EBX®. In a hierarchy view, this is the target table.- Throws:
IllegalStateException- if the current service is running outside a table context.- Since:
- 5.6.0
-
getCurrentHierarchyNode
Returns the node currently selected in a hierarchy. Returnsnullif the current service is not called from the contextual menu of a hierarchy node (seeisCalledOnHierarchyNode()).- See Also:
-
getSelectedHierarchyNodes
Returns the nodes currently selected in a hierarchy.- Returns:
- List of
HierarchyNodethat corresponds to the nodes selected in the user interface displayed hierarchy. Returnsnullif the current service is not called in the context of a hierarchy.
-
getCurrentPathInAdaptation
Returns the path of the node currently selected in the user interface.- Throws:
IllegalStateException- if the current service is running on a dataspace or on a snapshot (seeisCalledOnHome()).
-
getLocale
Returns the current locale of the user interface session.- See Also:
-
getSession
Returns the current session context. -
getServiceLabel
Returns the label of the service, localized for the session's current locale.The label of the service is specified in the data model, under the node
xs:annotation/xs:documentation.- See Also:
-
getServiceKey
Returns the key of the current service.- Since:
- 5.4.1
- See Also:
-
getServiceDescription
Returns the description of the service, localized for the session's current locale.The description of the service is specified in the data model, under the node
xs:annotation/xs:documentation. -
addMessage
Adds a message regarding the validation of the form in the page. This message will be displayed in the standard message pane of the user interface. -
setContextSensitiveHelpURL
Enables the context-sensitive help button in the header of the workspace.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).- Parameters:
aURL- the URL of the pop-up content.- Since:
- 5.2.3
-
setTitle
Replaces the default title of the user service in the header of the workspace.- Parameters:
aMessage- the text of the title.- Since:
- 5.2.3
-
getURLForIncludingResource
Returns a user interface URL indicating that this service execution continues to the resource specified.The resource must be in the same web application as the service.
- Parameters:
aResourcePath- path of the resource in its web application (it must not contain the web application's specific path).- See Also:
-
getURLForForwardingToResource
Returns a user interface URL forwarding this service execution to the specified resource.The resource must be in the same web application as the service.
- Parameters:
aResourcePath- absolute path of the resource in its web application (it must not contain the web application's specific path, and must start with '/').- Since:
- 5.5.0
- See Also:
-
getURLForEndingService
Returns a user interface URL indicating that the execution of this service is finished.- See Also:
-
getURLForEndingServiceInPopup
Returns a user interface URL indicating that the execution of this service is finished. After closing the service, the pop-up in which it was displayed is closed automatically. The service must have been called using a preview button, displaying it in an inner pop-up. This method must not be called to close a service in the main window. -
getURLForServiceSelection
Returns a user interface URL to start the specified service. When the URL is accessed, the service will be launched on the current content, unless this service automatically selects its own target content (for example,ServiceKey.WORKFLOW).- Throws:
IllegalArgumentException- if the built-in service is not supported by this method; this is the case forMASSDELETE,COMPARE, andCLOSE.- Since:
- 5.4.3
- See Also:
-
getURLForServiceSelection
public 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.- Throws:
IllegalArgumentException- if the built-in service is not supported by this method; this is the case forMASSDELETE,COMPARE, andCLOSE.- Since:
- 5.3.0
- See Also:
-
getURLForServiceSelection
Returns a user interface URL that selects the specified dataspace and starts the specified service on it.- Throws:
IllegalArgumentException- if the built-in service is not supported by this method; this is the case forMASSDELETE,COMPARE, andCLOSE.- Since:
- 5.4.2
- See Also:
-
getURLForServiceSelection
public 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 givenAdaptationHome.- Throws:
IllegalArgumentException- if the built-in service is not supported by this method; this is the case forMASSDELETE,COMPARE, andCLOSE.- Since:
- 5.4.2
- See Also:
-
getURLForServiceSelection
public 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.- Throws:
IllegalArgumentException- if the built-in service is not supported by this method; this is the case forMASSDELETE,COMPARE, andCLOSE.- Since:
- 5.3.1
- See Also:
-
getURLForServiceSelection
public 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 givenAdaptationHome.- Throws:
IllegalArgumentException- if the built-in service is not supported by this method; this is the case forMASSDELETE,COMPARE, andCLOSE.- Since:
- 5.4.2
- See Also:
-
isCalledOnHome
public abstract boolean isCalledOnHome()Returnstrueif the current service is called from a dataspace or snapshot menu.- See Also:
-
isCalledOnInstance
public abstract boolean isCalledOnInstance()Returnstrueif the current service is called from a dataset menu.- See Also:
-
isCalledOnTable
public abstract boolean isCalledOnTable()Returnstrueif 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().- See Also:
-
isCalledOnHierarchyNode
public abstract boolean isCalledOnHierarchyNode()Returnstrueif 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().- See Also:
-
isCalledOnTableSelection
public abstract boolean isCalledOnTableSelection()Returnstrueif 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().- See Also:
-
isCalledOnOccurrencePage
public abstract boolean isCalledOnOccurrencePage()Returnstrueif 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().- See Also:
-
getUIComponentWriter
This method can be used in a Servlet to get a component writer in order to add standard EBX® components.Attention: This getter must not be called from a JSP. Use
getUIComponentWriterForJSP(JspWriter)instead.- Since:
- 5.2.0
-
getUIComponentWriterForJSP
This method can be used in a JSP to get a component writer to add some integrated components.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.- Parameters:
aJspWriter- theoutbuffer used to write HTML- Since:
- 5.2.0
-
getModuleName
Returns the name of the module that declares the service being executed.- Since:
- 5.2.3
-