org.kuali.rice.krad.uif.util
Class UrlInfo

java.lang.Object
  extended by org.kuali.rice.krad.datadictionary.DictionaryBeanBase
      extended by org.kuali.rice.krad.datadictionary.uif.UifDictionaryBeanBase
          extended by org.kuali.rice.krad.uif.util.UrlInfo
All Implemented Interfaces:
Serializable, DictionaryBean, UifDictionaryBean

public class UrlInfo
extends UifDictionaryBeanBase
implements Serializable

This object represents a url in the Krad framework. The url can be set explicitly to a specific href or a controller plus a viewId can be provided (at very minimum). By default, the krad base bean config points the baseUrl property to 'krad.url' configuration property and the methodToCall to 'start', but these can be reset to any value as needed.

If href is not set, the generated value of href is constructed (in general) as follows:
baseUrl + /controllerMapping + ? + methodToCall param + viewId param + other parameters
with any necessary tokens to construct a valid url. If baseUrl is not provided, the url is not valid and a blank string is returned.

Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
Serialized Form

Constructor Summary
UrlInfo()
          Base constructor
UrlInfo(String href)
          Constructor that initializes an href value
UrlInfo(String baseUrl, String controllerMapping, String viewId, String methodToCall)
          Constructor that sets the base url construction properties
 
Method Summary
protected
<T> void
copyProperties(T dictionaryBaseBean)
          Copies properties for copy()
protected  String generateUrl()
          Generate the url based on properties of this object
 String getBaseUrl()
          The base url value (the value that comes before other properties).
 String getControllerMapping()
          The controllerMapping for the url (string that represents the controllerMapping path appended to baseUrl)
 String getFormKey()
          FormKey representing the key of the form data to retrieve
 String getHref()
          Get the href value for this url object.
 String getMethodToCall()
          MethodToCall representing the methodToCall on the controller (default base bean value is 'start')
 String getOriginalHref()
          The original(set) href value.
 String getPageId()
          PageId representing the page of the view to retrieve by id
 Map<String,String> getRequestParameters()
          Map of key value pairs that will be appended to the request parameters to pass in any custom data
 String getViewId()
          ViewId representing the view by id to retrieve
 String getViewType()
          The viewType representing the View's base type
 void setBaseUrl(String baseUrl)
          Set the baseUrl
 void setControllerMapping(String controllerMapping)
          Set the controllerMapping
 void setFormKey(String formKey)
          Set the formKey
 void setHref(String href)
          Explicitly set the href value - if this is called with a value, all other properties of the url object are ignored.
 void setMethodToCall(String methodToCall)
          Set the methodToCall
 void setOriginalHref(String originalHref)
          toString returns the original href value of url
 void setPageId(String pageId)
          Set pageId
 void setRequestParameters(Map<String,String> requestParameters)
          Set the requestParameters
 void setViewId(String viewId)
          Set viewId
 void setViewType(String viewType)
          Set the viewType
 String toString()
          toString override returns the href value of url
 
Methods inherited from class org.kuali.rice.krad.datadictionary.uif.UifDictionaryBeanBase
getExpressionGraph, getPropertyExpression, getPropertyExpressions, getRefreshExpressionGraph, setExpressionGraph, setPropertyExpressions, setRefreshExpressionGraph
 
Methods inherited from class org.kuali.rice.krad.datadictionary.DictionaryBeanBase
copy, getComponentCode, getNamespaceCode, setComponentCode, setNamespaceCode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.kuali.rice.krad.datadictionary.DictionaryBean
getComponentCode, getNamespaceCode
 

Constructor Detail

UrlInfo

public UrlInfo()
Base constructor


UrlInfo

public UrlInfo(String href)
Constructor that initializes an href value

Parameters:
href - the href value

UrlInfo

public UrlInfo(String baseUrl,
               String controllerMapping,
               String viewId,
               String methodToCall)
Constructor that sets the base url construction properties

Parameters:
baseUrl - the baseUrl
controllerMapping - the controllerMapping
viewId - the id of the view
methodToCall - the methodToCall
Method Detail

generateUrl

protected String generateUrl()
Generate the url based on properties of this object

Returns:
the generatedUrl, blank if not a valid url (no baseUrl value provided)

getHref

public String getHref()
Get the href value for this url object. This is the main call to this url object as it provides the full href value represented by this object.

If href has NOT been explicitly set to a value, the href is generated by constructing pieces of the url set through the properties of this url object. The generated value of href is constructed (in general) as follows:
baseUrl + /controllerMapping + ? + methodToCall param + viewId param + other parameters
with any necessary tokens to construct a valid url. If baseUrl is not provided, the url is not valid and a blank string is returned.

Returns:
THE href represented by this url object, or blank if not valid

setHref

public void setHref(String href)
Explicitly set the href value - if this is called with a value, all other properties of the url object are ignored. This call is basically a full override. This also sets the orginalHref value.

Parameters:
href -

getBaseUrl

public String getBaseUrl()
The base url value (the value that comes before other properties). Default base bean value is set to use 'krad.url' of the configuration properties.

Returns:
the baseUrl

setBaseUrl

public void setBaseUrl(String baseUrl)
Set the baseUrl

Parameters:
baseUrl -

getControllerMapping

public String getControllerMapping()
The controllerMapping for the url (string that represents the controllerMapping path appended to baseUrl)

Returns:
the controllerMapping string

setControllerMapping

public void setControllerMapping(String controllerMapping)
Set the controllerMapping

Parameters:
controllerMapping -

getViewType

public String getViewType()
The viewType representing the View's base type

Returns:
the viewType

setViewType

public void setViewType(String viewType)
Set the viewType

Parameters:
viewType -

getViewId

public String getViewId()
ViewId representing the view by id to retrieve

Returns:
the viewId

setViewId

public void setViewId(String viewId)
Set viewId

Parameters:
viewId -

getPageId

public String getPageId()
PageId representing the page of the view to retrieve by id

Returns:
the pageId

setPageId

public void setPageId(String pageId)
Set pageId

Parameters:
pageId -

getFormKey

public String getFormKey()
FormKey representing the key of the form data to retrieve

Returns:
the formKey

setFormKey

public void setFormKey(String formKey)
Set the formKey

Parameters:
formKey -

getMethodToCall

public String getMethodToCall()
MethodToCall representing the methodToCall on the controller (default base bean value is 'start')

Returns:
methodToCall on controller

setMethodToCall

public void setMethodToCall(String methodToCall)
Set the methodToCall

Parameters:
methodToCall -

getRequestParameters

public Map<String,String> getRequestParameters()
Map of key value pairs that will be appended to the request parameters to pass in any custom data

Returns:
the requestParameters map

setRequestParameters

public void setRequestParameters(Map<String,String> requestParameters)
Set the requestParameters

Parameters:
requestParameters -

getOriginalHref

public String getOriginalHref()
The original(set) href value. This is generally used to determine if the href was explicitly set and not generated by this url object.

Returns:
the original(set) href value

toString

public String toString()
toString override returns the href value of url

Overrides:
toString in class Object
Returns:
href value

setOriginalHref

public void setOriginalHref(String originalHref)
toString returns the original href value of url


copyProperties

protected <T> void copyProperties(T dictionaryBaseBean)
Description copied from class: DictionaryBeanBase
Copies properties for copy()

Overrides:
copyProperties in class UifDictionaryBeanBase
Parameters:
dictionaryBaseBean - base bean


Copyright © 2005-2013 The Kuali Foundation. All Rights Reserved.