Esri Geoportal Server
1.0

com.esri.gpt.catalog.search
Class ResourceLinkBuilder

java.lang.Object
  extended by com.esri.gpt.catalog.search.ResourceLinkBuilder
Direct Known Subclasses:
IntegrationLinkBuilder

public class ResourceLinkBuilder
extends Object

Builds the collection of bind-able links associated with a document or resource.


Nested Class Summary
static class ResourceLinkBuilder.ServiceType
          Service types.
 
Field Summary
static String RESOURCE_TYPE
           
 
Constructor Summary
ResourceLinkBuilder()
          Default constructor.
 
Method Summary
 void build(SearchXslRecord xRecord, SearchResultRecord record)
          Builds the bind-able resource links associated with a resultant search record.
protected  void buildAddToMapLink(SearchXslRecord xRecord, SearchResultRecord record)
          Builds the link associated with adding a service to the map viewer.
protected  void buildAGSLinks(SearchXslRecord xRecord, SearchResultRecord record)
          Builds a set of links associated with a rest based ArcGIS service map service.
protected  void buildContentTypeLink(SearchXslRecord xRecord, SearchResultRecord record)
          Builds the link associated with the content type icon.
protected  void buildCustomLinks(SearchXslRecord xRecord, SearchResultRecord record)
          Builds the custom links.
protected  void buildDetailsLink(SearchXslRecord xRecord, SearchResultRecord record)
          Builds the link associated with the metadata details page.
protected  void buildMetadataLink(SearchXslRecord xRecord, SearchResultRecord record)
          Builds the link associated with full metadata retrieval.
protected  void buildOpenLink(SearchXslRecord xRecord, SearchResultRecord record)
          Builds a generic Open link for the resource URL associated with the record.
protected  void buildPreviewLink(SearchXslRecord xRecord, SearchResultRecord record)
          Builds the link associated with the resource preview page.
protected  void buildThumbnailLink(SearchXslRecord xRecord, SearchResultRecord record)
          Builds the link associated with the thumbnail.
protected  void buildWebsiteLink(SearchXslRecord xRecord, SearchResultRecord record)
          Builds the link associated with an organizational website.
protected  void determineResourceUrl(SearchXslRecord xRecord, SearchResultRecord record)
          Determines the primary resource URL associated with the resultant record.
protected  String encodeUrlParam(String value)
          Encodes a URL parameter value.
protected  String getBaseContextPath()
          Gets the base context path associated with the HTTP servlet request.
protected  String getMapViewerUrl()
          Gets the map viewer url.
protected  MessageBroker getMessageBroker()
          Gets the resource bundle message broker.
protected  RequestContext getRequestContext()
          Gets the associated request context.
protected  ResourceIdentifier getResourceIdentifier()
          Gets the resource identifier associated with the request.
 void initialize(HttpServletRequest request, RequestContext context, MessageBroker messageBroker)
          Initializes the resource link builder.
protected  String makeLabel(String resourceKey)
          Makes the label associated with a resource bundle key.
protected  ResourceLink makeLink(String url, String tag, String resourceKey)
          Makes a link.
static ResourceLinkBuilder newBuilder(RequestContext context, HttpServletRequest servletRequest, MessageBroker messageBroker)
          Instantiates a new resource link builder.
protected  void setBaseContextPath(String path)
          Sets the base context path associated with the HTTP servlet request.
protected  void setMessageBroker(MessageBroker messageBroker)
          Sets the resource bundle message broker.
protected  void setResourceIdentifier(ResourceIdentifier resourceIdentifier)
          Sets the resource identifier associated with the request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE_TYPE

public static final String RESOURCE_TYPE
See Also:
Constant Field Values
Constructor Detail

ResourceLinkBuilder

public ResourceLinkBuilder()
Default constructor.

Method Detail

getBaseContextPath

protected String getBaseContextPath()
Gets the base context path associated with the HTTP servlet request.
(http://<host:port>/<Context>)

Returns:
the base context path

setBaseContextPath

protected void setBaseContextPath(String path)
Sets the base context path associated with the HTTP servlet request.
(http://<host:port>/<Context>)

Parameters:
path - the base context path

getMapViewerUrl

protected String getMapViewerUrl()
Gets the map viewer url.

Returns:
the map viewer url

getMessageBroker

protected MessageBroker getMessageBroker()
Gets the resource bundle message broker.

Returns:
the message broker

setMessageBroker

protected void setMessageBroker(MessageBroker messageBroker)
Sets the resource bundle message broker.

Parameters:
messageBroker - the message broker

getRequestContext

protected RequestContext getRequestContext()
Gets the associated request context.

Returns:
the request context

getResourceIdentifier

protected ResourceIdentifier getResourceIdentifier()
Gets the resource identifier associated with the request.

Returns:
the resource identifier

setResourceIdentifier

protected void setResourceIdentifier(ResourceIdentifier resourceIdentifier)
Sets the resource identifier associated with the request.

Parameters:
resourceIdentifier - the resource identifier

build

public void build(SearchXslRecord xRecord,
                  SearchResultRecord record)
Builds the bind-able resource links associated with a resultant search record.

Parameters:
xRecord - the underlying CSW record
record - the search result record

buildAddToMapLink

protected void buildAddToMapLink(SearchXslRecord xRecord,
                                 SearchResultRecord record)
Builds the link associated with adding a service to the map viewer.

Parameters:
xRecord - the underlying CSW record
record - the search result record

buildAGSLinks

protected void buildAGSLinks(SearchXslRecord xRecord,
                             SearchResultRecord record)
Builds a set of links associated with a rest based ArcGIS service map service.

Parameters:
xRecord - the underlying CSW record
record - the search result record

buildContentTypeLink

protected void buildContentTypeLink(SearchXslRecord xRecord,
                                    SearchResultRecord record)
Builds the link associated with the content type icon.

Parameters:
xRecord - the underlying CSW record
record - the search result record

buildDetailsLink

protected void buildDetailsLink(SearchXslRecord xRecord,
                                SearchResultRecord record)
Builds the link associated with the metadata details page.
Records from an extenal repositories do not have a details link.

Parameters:
xRecord - the underlying CSW record
record - the search result record

buildMetadataLink

protected void buildMetadataLink(SearchXslRecord xRecord,
                                 SearchResultRecord record)
Builds the link associated with full metadata retrieval.
Records from an extenal repositories do not have a details link.

Parameters:
xRecord - the underlying CSW record
record - the search result record

buildOpenLink

protected void buildOpenLink(SearchXslRecord xRecord,
                             SearchResultRecord record)
Builds a generic Open link for the resource URL associated with the record.

Parameters:
xRecord - the underlying CSW record
record - the search result record

buildPreviewLink

protected void buildPreviewLink(SearchXslRecord xRecord,
                                SearchResultRecord record)
Builds the link associated with the resource preview page.

Parameters:
xRecord - the underlying CSW record
record - the search result record

buildThumbnailLink

protected void buildThumbnailLink(SearchXslRecord xRecord,
                                  SearchResultRecord record)
Builds the link associated with the thumbnail.

Parameters:
xRecord - the underlying CSW record
record - the search result record

buildWebsiteLink

protected void buildWebsiteLink(SearchXslRecord xRecord,
                                SearchResultRecord record)
Builds the link associated with an organizational website.

Parameters:
xRecord - the underlying CSW record
record - the search result record

buildCustomLinks

protected void buildCustomLinks(SearchXslRecord xRecord,
                                SearchResultRecord record)
Builds the custom links.

Parameters:
xRecord - the x record
record - the record

determineResourceUrl

protected void determineResourceUrl(SearchXslRecord xRecord,
                                    SearchResultRecord record)
Determines the primary resource URL associated with the resultant record.
The primary resource URL is associated with the resource that the metadata record describes.

Parameters:
xRecord - the underlying CSW record
record - the search result record

encodeUrlParam

protected String encodeUrlParam(String value)
Encodes a URL parameter value.

Parameters:
value - the URL parameter value to encode
Returns:
the encoded parameter value

initialize

public void initialize(HttpServletRequest request,
                       RequestContext context,
                       MessageBroker messageBroker)
Initializes the resource link builder.

Parameters:
context - the active request context
request - the active HTTP servlet request (can be null)
messageBroker - the active message broker

makeLabel

protected String makeLabel(String resourceKey)
Makes the label associated with a resource bundle key.

Parameters:
resourceKey - the resource bundle key
Returns:
the associated key

makeLink

protected ResourceLink makeLink(String url,
                                String tag,
                                String resourceKey)
Makes a link.

Parameters:
url - the URL associated with the resource
tag - the tag idenitfying a type of link
resourceKey - the resource bundle key associated with the label

newBuilder

public static ResourceLinkBuilder newBuilder(RequestContext context,
                                             HttpServletRequest servletRequest,
                                             MessageBroker messageBroker)
Instantiates a new resource link builder.

By default, a new instance of com.esri.gpt.catalog.search.ResourceLinkBuilder is returned.

This can be overridden by the configuration parameter: /gptConfig/catalog/parameter@key="resourceLinkBuilder"

Parameters:
context - the active request context
servletRequest - the active HTTP servlet request
messageBroker - the message broker
Returns:
the resource link builder

Esri Geoportal Server
1.0

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.