lumis.portal.hyperlink
Class GenericHyperLinkResolver

Package class diagram package GenericHyperLinkResolver
java.lang.Object
  extended by lumis.portal.hyperlink.GenericHyperLinkResolver
All Implemented Interfaces:
IHyperLinkResolver
Direct Known Subclasses:
DouiHyperLinkResolver

@StableMinor(version="6.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

Constructor Summary
GenericHyperLinkResolver()
           
 
Method Summary
protected  IServiceInterfaceUrl createUrl(SessionConfig sessionConfig, HyperLinkConfig hyperLinkConfig, String pageId, ITransaction transaction)
          Creates an URL for the given hyperlink.
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 given hyperlinkConfig
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericHyperLinkResolver

public GenericHyperLinkResolver()
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 calls resolveDestinationPageId(SessionConfig, HyperLinkConfig, ITransaction) to resolve the destination page. If there is a destination service interface instance or a destination page could be resolved, then createUrl(SessionConfig, HyperLinkConfig, String, ITransaction) is called to create the resulting URL, else null is returned.

Specified by:
resolveHyperLink in interface IHyperLinkResolver
Parameters:
sessionConfig - the user session information.
hyperLinkConfig - hyperlink information
transaction - 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. The HyperLinkConfig.HyperLinkConfig(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 - the HyperLinkConfig 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 the resolveDestinationInterfaceId(SessionConfig, HyperLinkConfig, ITransaction) method for resolving the destination interface id if it is not specified in the hyperLinkConfig.

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 given hyperlinkConfig

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


Lumisportal  6.2.0.120405 - Copyright © 2006–2012 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.