Class GenericHyperLinkResolver
- java.lang.Object
-
- lumis.portal.hyperlink.GenericHyperLinkResolver
-
- All Implemented Interfaces:
IHyperLinkResolver
- Direct Known Subclasses:
DouiHyperLinkResolver
@StableMinor(version="14.2", sinceVersion="4.0") public class GenericHyperLinkResolver extends Object implements IHyperLinkResolver
A generic implementation for resolving hyperlinks. This implementation contains some protected methods that may be overriden for easier customization.- Since:
- 4.0.10
- Version:
- $Revision: 24985 $ $Date: 2022-05-02 23:04:30 -0300 (Mon, 02 May 2022) $
-
-
Constructor Summary
Constructors Constructor Description GenericHyperLinkResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected IServiceInterfaceUrl
createUrl(SessionConfig sessionConfig, HyperLinkConfig hyperLinkConfig, String pageId, ITransaction transaction)
Creates an URL for the given hyperlink.protected boolean
interfaceInstanceCanBeUsedAsLinkTarget(String interfaceInstanceId)
Returns whether the interface instance with the given identifier can be used in hyperlinks or not.protected void
keepPagePreviousState(IServiceInterfaceUrl url, HyperLinkConfig hyperLinkConfig)
Configures the URL object to keep the current page previous parameters.protected String
resolveDestinationInterfaceId(SessionConfig sessionConfig, HyperLinkConfig hyperLinkConfig, ITransaction transaction)
Resolves the interface that should be the destination for the givenhyperlinkConfig
protected String
resolveDestinationPageId(SessionConfig sessionConfig, HyperLinkConfig hyperLinkConfig, ITransaction transaction)
Tries to resolve the destination page for the specified hyperlink.IServiceInterfaceUrl
resolveHyperLink(SessionConfig sessionConfig, HyperLinkConfig hyperLinkConfig, ITransaction transaction)
Resolves an hyperlink to the corresponding URL.protected void
setUrlParameters(SessionConfig sessionConfig, IServiceInterfaceUrl url, Map<String,String[]> parameters, ITransaction transaction)
Replaces the parameters in the url with the parameters in the given map.
-
-
-
Method Detail
-
resolveHyperLink
public IServiceInterfaceUrl resolveHyperLink(SessionConfig sessionConfig, HyperLinkConfig hyperLinkConfig, ITransaction transaction) throws PortalException
Resolves an hyperlink to the corresponding URL.If no destination service interface instance was specified in the
hyperLinkConfig
, then this method callsresolveDestinationPageId(SessionConfig, HyperLinkConfig, ITransaction)
to resolve the destination page. If there is a destination service interface instance or a destination page could be resolved, thencreateUrl(SessionConfig, HyperLinkConfig, String, ITransaction)
is called to create the resulting URL.Otherwise, if the requested interface and service instance can be resolved to be displayed in an auto administration page, a URL to it is returned.
Otherwise
null
is returned.- 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
-
createUrl
protected IServiceInterfaceUrl createUrl(SessionConfig sessionConfig, HyperLinkConfig hyperLinkConfig, String pageId, ITransaction transaction) throws PortalException
Creates an URL for the given hyperlink.This implementation call
setUrlParameters(SessionConfig, IServiceInterfaceUrl, Map, ITransaction)
to fill the created URL's parameters.- Parameters:
sessionConfig
- the user session information.hyperLinkConfig
- the hyperlink value.pageId
- the destination page. If null the created URL will not have an explicit pageId specified.transaction
- the transaction for persistence access.- Returns:
- the created URL, or null if the arguments could not be resolved into a URL.
- Throws:
PortalException
- Since:
- 4.0.10
-
keepPagePreviousState
protected void keepPagePreviousState(IServiceInterfaceUrl url, HyperLinkConfig hyperLinkConfig)
Configures the URL object to keep the current page previous parameters. TheHyperLinkConfig(IServiceInterfaceRequest, lumis.portal.serviceinterface.IServiceInterfaceResponse)
constructor must have been used or this method will have no effect.Note that the parameters that belongs to the target of the URL will be replaced as defined by the URL. This method is intended to preserve the previous parameters of other targets in the current page.
- Parameters:
url
- the URL object.hyperLinkConfig
- theHyperLinkConfig
being used to create the URL object.- Since:
- 5.6.0
- See Also:
IServiceInterfaceUrl.setTargetScope(int, String)
,HyperLinkConfig.setTargetId(String)
,HyperLinkConfig.setTargetType(int)
-
setUrlParameters
protected void setUrlParameters(SessionConfig sessionConfig, IServiceInterfaceUrl url, Map<String,String[]> parameters, ITransaction transaction) throws PortalException
Replaces the parameters in the url with the parameters in the given map. To customize the parameters set in the url, this method may be overrided.- Parameters:
sessionConfig
- the user session information.url
- the url to set parameters.parameters
- the parameters to set in the url.transaction
- the transaction for persistence access.- Throws:
PortalException
- Since:
- 4.0.10
- See Also:
PortalRequestParameters.isReservedParameter(String)
-
resolveDestinationPageId
protected String resolveDestinationPageId(SessionConfig sessionConfig, HyperLinkConfig hyperLinkConfig, ITransaction transaction) throws PortalException
Tries to resolve the destination page for the specified hyperlink. Calls theresolveDestinationInterfaceId(SessionConfig, HyperLinkConfig, ITransaction)
method for resolving the destination interface id if it is not specified in thehyperLinkConfig
.- Parameters:
sessionConfig
- the user session information.hyperLinkConfig
- the hyperlink.transaction
- the transaction for persistence access.- Returns:
- the pageId, or null if the destination page could not be resolved.
- Throws:
PortalException
- Since:
- 4.0.10
-
resolveDestinationInterfaceId
protected String resolveDestinationInterfaceId(SessionConfig sessionConfig, HyperLinkConfig hyperLinkConfig, ITransaction transaction) throws PortalException
Resolves the interface that should be the destination for the givenhyperlinkConfig
- Parameters:
sessionConfig
- the user session information.hyperLinkConfig
- the hyperLink information.transaction
- theh transaction for persistence access.- Returns:
- the resolved destination interface id, or null if it could not be resolved.
- Throws:
PortalException
- Since:
- 4.0.10
-
interfaceInstanceCanBeUsedAsLinkTarget
protected boolean interfaceInstanceCanBeUsedAsLinkTarget(String interfaceInstanceId) throws PortalException
Returns whether the interface instance with the given identifier can be used in hyperlinks or not.- Parameters:
interfaceInstanceId
- the interface instance identifier.- Returns:
- whether the interface instance with the given identifier can be used in hyperlinks or not.
- Throws:
PortalException
- Since:
- 10.2.0
-
-