org.kuali.kfs.sys.report
Class BusinessObjectReportHelper

java.lang.Object
  extended by org.kuali.kfs.sys.report.BusinessObjectReportHelper
Direct Known Subclasses:
TransactionListingReportBusinessObjectReportHelper

public class BusinessObjectReportHelper
extends Object

Helper class for business objects to assist formatting them for error reporting. Utilizes spring injection for modularization and configurability

See Also:
ReportWriterTextServiceImpl

Field Summary
protected  Class<? extends org.kuali.rice.kns.bo.BusinessObject> dataDictionaryBusinessObjectClass
           
protected  org.kuali.rice.kns.service.DataDictionaryService dataDictionaryService
           
static String LEFT_ALIGNMENT
           
static String LINE_BREAK
           
protected  String messageLabel
           
protected  int minimumMessageLength
           
protected  Map<String,String> orderedPropertyNameToHeaderLabelMap
           
static String RIGHT_ALIGNMENT
           
 
Constructor Summary
BusinessObjectReportHelper()
           
 
Method Summary
 void applyColspanOnCellValues(List<String> cellValues)
          apply the colspan definition on the default values of the table cells.
 void applyColspanOnCellWidth(List<Integer> cellWidthList)
          apply the colspan definition on the default width of the table cells
 List<Object> getBlankValues(org.kuali.rice.kns.bo.BusinessObject businessObject)
          Same as getValues except that it actually doesn't retrieve the values from the BO but instead returns a blank linke.
protected  List<Class<? extends org.kuali.rice.kns.web.format.Formatter>> getNumberFormatters()
          get formatter classes defined for numbers
 String getSepartorLine(List<Integer> cellWidthList)
          get the separator line
 List<String> getTableCellAlignment()
          get the alignment definitions of all table cells in one row according to the property's formatter class
 String getTableCellFormat(boolean allowColspan, boolean allowRightAlignment, String separatorLine)
          get the format string for all cells in a table row.
 List<String> getTableCellValues(org.kuali.rice.kns.bo.BusinessObject businessObject, boolean allowColspan)
          Returns the values in a list of the passed in business object in order of the spring definition.
 List<String> getTableCellValuesPaddingWithEmptyCell(org.kuali.rice.kns.bo.BusinessObject businessObject, boolean allowColspan)
          get the values that can be fed into a predefined table.
 List<Integer> getTableCellWidth()
          get the width of all table cells according to the definition
 Map<String,String> getTableDefinition()
          get the primary information that can define a table structure
 List<String> getTableHeader(int maximumPageWidth)
          Returns multiple lines of what represent a table header.
 List<Object> getValues(org.kuali.rice.kns.bo.BusinessObject businessObject)
          Returns the values in a list of the passed in business object in order of the spring definition.
protected  void paddingTableCellValues(int numberOfCell, List<String> tableCellValues)
           
protected  Class<? extends org.kuali.rice.kns.web.format.Formatter> retrievePropertyFormatterClass(Class<? extends org.kuali.rice.kns.bo.BusinessObject> businessObjectClass, String propertyName)
          Returns the maximum length of a value for a given propery, can be overridden to allow for pseudo-properties
protected  Object retrievePropertyValue(org.kuali.rice.kns.bo.BusinessObject businessObject, String propertyName)
          Returns a value for a given property, can be overridden to allow for pseudo-properties
protected  int retrievePropertyValueMaximumLength(Class<? extends org.kuali.rice.kns.bo.BusinessObject> businessObjectClass, String propertyName)
          Returns the maximum length of a value for a given propery, can be overridden to allow for pseudo-properties
 void setColumnCount(int columnCount)
          Sets the columnCount attribute value.
 void setColumnSpanDefinition(Map<String,Integer> columnSpanDefinition)
          Sets the columnSpanDefinition attribute value.
 void setDataDictionaryBusinessObjectClass(Class<? extends org.kuali.rice.kns.bo.BusinessObject> dataDictionaryBusinessObjectClass)
          Sets the dataDictionaryBusinessObjectClass
 void setDataDictionaryService(org.kuali.rice.kns.service.DataDictionaryService dataDictionaryService)
          Sets the dataDictionaryService
 void setMessageLabel(String messageLabel)
          Sets the messageLabel
 void setMinimumMessageLength(int minimumMessageLength)
          Sets the minimumMessageLength
 void setOrderedPropertyNameToHeaderLabelMap(Map<String,String> orderedPropertyNameToHeaderLabelMap)
          Sets the orderedPropertyNameToHeaderLabelMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

minimumMessageLength

protected int minimumMessageLength

messageLabel

protected String messageLabel

dataDictionaryBusinessObjectClass

protected Class<? extends org.kuali.rice.kns.bo.BusinessObject> dataDictionaryBusinessObjectClass

orderedPropertyNameToHeaderLabelMap

protected Map<String,String> orderedPropertyNameToHeaderLabelMap

dataDictionaryService

protected org.kuali.rice.kns.service.DataDictionaryService dataDictionaryService

LEFT_ALIGNMENT

public static final String LEFT_ALIGNMENT
See Also:
Constant Field Values

RIGHT_ALIGNMENT

public static final String RIGHT_ALIGNMENT
See Also:
Constant Field Values

LINE_BREAK

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

BusinessObjectReportHelper

public BusinessObjectReportHelper()
Method Detail

getValues

public List<Object> getValues(org.kuali.rice.kns.bo.BusinessObject businessObject)
Returns the values in a list of the passed in business object in order of the spring definition.

Parameters:
businessObject - for which to return the values
Returns:
the values

retrievePropertyValue

protected Object retrievePropertyValue(org.kuali.rice.kns.bo.BusinessObject businessObject,
                                       String propertyName)
Returns a value for a given property, can be overridden to allow for pseudo-properties

Parameters:
businessObject -
propertyName -
Returns:

retrievePropertyValueMaximumLength

protected int retrievePropertyValueMaximumLength(Class<? extends org.kuali.rice.kns.bo.BusinessObject> businessObjectClass,
                                                 String propertyName)
Returns the maximum length of a value for a given propery, can be overridden to allow for pseudo-properties

Parameters:
businessObjectClass -
propertyName -
Returns:

retrievePropertyFormatterClass

protected Class<? extends org.kuali.rice.kns.web.format.Formatter> retrievePropertyFormatterClass(Class<? extends org.kuali.rice.kns.bo.BusinessObject> businessObjectClass,
                                                                                                  String propertyName)
Returns the maximum length of a value for a given propery, can be overridden to allow for pseudo-properties

Parameters:
businessObjectClass -
propertyName -
Returns:

getBlankValues

public List<Object> getBlankValues(org.kuali.rice.kns.bo.BusinessObject businessObject)
Same as getValues except that it actually doesn't retrieve the values from the BO but instead returns a blank linke. This is useful if indentation for message printing is necessary.

Parameters:
businessObject - for which to return the values
Returns:
spaces in the length of values

getTableHeader

public List<String> getTableHeader(int maximumPageWidth)
Returns multiple lines of what represent a table header. The last line in this list is the format of the table cells.

Parameters:
maximumPageWidth - maximum before line is out of bounds. Used to fill message to the end of this range. Note that if there isn't at least maximumPageWidth characters available it will go minimumMessageLength out of bounds. It is up to the calling class to handle that
Returns:
table header. Last element is the format of the table cells.

getTableDefinition

public Map<String,String> getTableDefinition()
get the primary information that can define a table structure

Returns:
the primary information that can define a table structure

getTableCellValues

public List<String> getTableCellValues(org.kuali.rice.kns.bo.BusinessObject businessObject,
                                       boolean allowColspan)
Returns the values in a list of the passed in business object in order of the spring definition. The value for the "EMPTY_CELL" entry is an empty string.

Parameters:
businessObject - for which to return the values
allowColspan - indicate whether colspan definition can be applied
Returns:
the values being put into the table cells

getTableCellFormat

public String getTableCellFormat(boolean allowColspan,
                                 boolean allowRightAlignment,
                                 String separatorLine)
get the format string for all cells in a table row. Colspan definition will be applied if allowColspan is true

Parameters:
allowColspan - indicate whether colspan definition can be applied
allowRightAlignment - indicate whether the right alignment can be applied
separatorLine - the separation line for better look
Returns:
the format string for all cells in a table row

getSepartorLine

public String getSepartorLine(List<Integer> cellWidthList)
get the separator line

Parameters:
cellWidthList - the given cell width list
Returns:
the separator line

applyColspanOnCellWidth

public void applyColspanOnCellWidth(List<Integer> cellWidthList)
apply the colspan definition on the default width of the table cells

Parameters:
the - default width of the table cells

applyColspanOnCellValues

public void applyColspanOnCellValues(List<String> cellValues)
apply the colspan definition on the default values of the table cells. The values will be removed if their positions are taken by others.

Parameters:
the - default values of the table cells

getTableCellValuesPaddingWithEmptyCell

public List<String> getTableCellValuesPaddingWithEmptyCell(org.kuali.rice.kns.bo.BusinessObject businessObject,
                                                           boolean allowColspan)
get the values that can be fed into a predefined table. If the values are not enought to occupy the table cells, a number of empty values are provided.

Parameters:
businessObject - the given business object whose property values will be collected
allowColspan - indicate whether colspan definition can be applied
Returns:

getTableCellWidth

public List<Integer> getTableCellWidth()
get the width of all table cells according to the definition

Returns:
the width of all table cells. The width is in the order defined as the orderedPropertyNameToHeaderLabelMap

getTableCellAlignment

public List<String> getTableCellAlignment()
get the alignment definitions of all table cells in one row according to the property's formatter class

Returns:
the alignment definitions of all table cells in one row according to the property's formatter class

paddingTableCellValues

protected void paddingTableCellValues(int numberOfCell,
                                      List<String> tableCellValues)

getNumberFormatters

protected List<Class<? extends org.kuali.rice.kns.web.format.Formatter>> getNumberFormatters()
get formatter classes defined for numbers

Returns:
the formatter classes defined for numbers

setMinimumMessageLength

public void setMinimumMessageLength(int minimumMessageLength)
Sets the minimumMessageLength

Parameters:
minimumMessageLength - The minimumMessageLength to set.

setMessageLabel

public void setMessageLabel(String messageLabel)
Sets the messageLabel

Parameters:
messageLabel - The messageLabel to set.

setDataDictionaryBusinessObjectClass

public void setDataDictionaryBusinessObjectClass(Class<? extends org.kuali.rice.kns.bo.BusinessObject> dataDictionaryBusinessObjectClass)
Sets the dataDictionaryBusinessObjectClass

Parameters:
dataDictionaryBusinessObjectClass - The dataDictionaryBusinessObjectClass to set.

setOrderedPropertyNameToHeaderLabelMap

public void setOrderedPropertyNameToHeaderLabelMap(Map<String,String> orderedPropertyNameToHeaderLabelMap)
Sets the orderedPropertyNameToHeaderLabelMap

Parameters:
orderedPropertyNameToHeaderLabelMap - The orderedPropertyNameToHeaderLabelMap to set.

setDataDictionaryService

public void setDataDictionaryService(org.kuali.rice.kns.service.DataDictionaryService dataDictionaryService)
Sets the dataDictionaryService

Parameters:
dataDictionaryService - The dataDictionaryService to set.

setColumnCount

public void setColumnCount(int columnCount)
Sets the columnCount attribute value.

Parameters:
columnCount - The columnCount to set.

setColumnSpanDefinition

public void setColumnSpanDefinition(Map<String,Integer> columnSpanDefinition)
Sets the columnSpanDefinition attribute value.

Parameters:
columnSpanDefinition - The columnSpanDefinition to set.


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