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, Cloneable, Copyable, 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

Field Summary
 
Fields inherited from class org.kuali.rice.krad.datadictionary.DictionaryBeanBase
componentCode, namespaceCode
 
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  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
 boolean isFullyConfigured()
           
 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
protected  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, setExpressionGraph, setPropertyExpressions
 
Methods inherited from class org.kuali.rice.krad.datadictionary.DictionaryBeanBase
clone, copy, dataDictionaryPostProcessing, getComponentCode, getNamespaceCode, preventModification, setComponentCode, setNamespaceCode, unwrap
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.kuali.rice.krad.datadictionary.DictionaryBean
dataDictionaryPostProcessing, 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

isFullyConfigured

public boolean isFullyConfigured()

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

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

Parameters:
originalHref - original href value


Copyright © 2005–2014 The Kuali Foundation. All rights reserved.