com.jamasoftware.contour.report.util
Class VelocityReportUtil

java.lang.Object
  extended by com.jamasoftware.contour.report.util.VelocityReportUtil

public class VelocityReportUtil
extends java.lang.Object

Utility methods for velocity report.


Constructor Summary
VelocityReportUtil(com.jamasoftware.contour.util.type.FieldDataTypeManager fieldDataTypeManager)
           
 
Method Summary
 java.lang.String cleanText(java.lang.String html)
          This method will go through the provided text cleaning out unnecessary syntax.
 java.lang.String encodeTextForHTML(java.lang.String str)
          This method will search through the provided text looking for html/xml tags and replacing them with the ascii equivalent.
 java.lang.String fromHtmlToRawText(java.lang.String orig)
           
 java.lang.String getValueForField(ContourItem doc, com.jamasoftware.contour.service.dto.DocumentTypeDTO documentType, java.lang.String fieldName, com.jamasoftware.contour.util.DateFormatter dateFormat)
          Gets string value for the given field.
 java.lang.String getValueForField(ContourItem doc, com.jamasoftware.contour.service.dto.DocumentTypeDTO documentType, java.lang.String fieldName, com.jamasoftware.contour.util.DateFormatter dateFormat, boolean exportToExcel)
          Gets string value for the given field.
 java.lang.String getValueForField(ContourItem doc, com.jamasoftware.contour.service.dto.DocumentTypeFieldDTO fieldDTO, com.jamasoftware.contour.util.DateFormatter dateFormat)
          Gets string value for the given field.
 java.lang.String getValueForField(ContourItem doc, com.jamasoftware.contour.service.dto.DocumentTypeFieldDTO fieldDTO, com.jamasoftware.contour.util.DateFormatter dateFormat, boolean exportToExcel)
          Gets string value for the given field.
 java.lang.String getValueForField(ContourItem doc, java.lang.String fieldName, com.jamasoftware.contour.util.DateFormatter dateFormat)
           
 java.lang.String replaceBreakForExcel(java.lang.String str)
          This will search through the provided text looking for HTML breaks and Word style breaks and replace them with a simple line break so that the output to Excel.
 java.lang.String replaceMSCharacters(java.lang.String orig, boolean keepNewlines)
          This will replace all Microsoft special characters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VelocityReportUtil

public VelocityReportUtil(com.jamasoftware.contour.util.type.FieldDataTypeManager fieldDataTypeManager)
Method Detail

getValueForField

public java.lang.String getValueForField(ContourItem doc,
                                         com.jamasoftware.contour.service.dto.DocumentTypeDTO documentType,
                                         java.lang.String fieldName,
                                         com.jamasoftware.contour.util.DateFormatter dateFormat)
Gets string value for the given field.

Parameters:
doc - document
documentType - document type for the document
fieldName - name of the field (not the label)
dateFormat - date formatter
Returns:
string value

getValueForField

public java.lang.String getValueForField(ContourItem doc,
                                         com.jamasoftware.contour.service.dto.DocumentTypeDTO documentType,
                                         java.lang.String fieldName,
                                         com.jamasoftware.contour.util.DateFormatter dateFormat,
                                         boolean exportToExcel)
Gets string value for the given field.

Parameters:
doc - document
documentType - document type for the document
fieldName - name of the field (not the label)
dateFormat - date formatter
exportToExcel - whether to export to Excel or not. If export to Excel, the HTML tags will be escaped.
Returns:
string value

getValueForField

public java.lang.String getValueForField(ContourItem doc,
                                         com.jamasoftware.contour.service.dto.DocumentTypeFieldDTO fieldDTO,
                                         com.jamasoftware.contour.util.DateFormatter dateFormat)
Gets string value for the given field.

Parameters:
doc - document
fieldDTO - field definition
fieldName - name of the field (not the label)
dateFormat - date formatter
Returns:
string value

getValueForField

public java.lang.String getValueForField(ContourItem doc,
                                         com.jamasoftware.contour.service.dto.DocumentTypeFieldDTO fieldDTO,
                                         com.jamasoftware.contour.util.DateFormatter dateFormat,
                                         boolean exportToExcel)
Gets string value for the given field.

Parameters:
doc - document
fieldDTO - field definition
fieldName - name of the field (not the label)
dateFormat - date formatter
exportToExcel - whether to export to Excel or not. If export to Excel, the HTML tags will be escaped.
Returns:
string value

getValueForField

public java.lang.String getValueForField(ContourItem doc,
                                         java.lang.String fieldName,
                                         com.jamasoftware.contour.util.DateFormatter dateFormat)

replaceBreakForExcel

public java.lang.String replaceBreakForExcel(java.lang.String str)
This will search through the provided text looking for HTML breaks and Word style breaks and replace them with a simple line break so that the output to Excel.
For example if you would like to display a rich text field in Excel the HTML breaks are treated as new cells. This method will convert the breaks so the text displays correctly in a single Excell cell.

Parameters:
text -
Returns:
text

encodeTextForHTML

public java.lang.String encodeTextForHTML(java.lang.String str)
This method will search through the provided text looking for html/xml tags and replacing them with the ascii equivalent. Line breaks will also be converted to true HTML breaks.
For example if you use a regular text box on the form within Contour the line breaks will be ignored when displayed in Word. Using the method will ensure those breaks show up. This method will also ensure that if you have entered explicit xml/html tags they will be converted to show up as they were entered.

Parameters:
text -
Returns:
text

cleanText

public java.lang.String cleanText(java.lang.String html)
This method will go through the provided text cleaning out unnecessary syntax.
For example this is a useful if the text has been copied from Word which will result in a lot of extra data which can cause odd behavior in reports.

Parameters:
text -
Returns:
text

fromHtmlToRawText

public java.lang.String fromHtmlToRawText(java.lang.String orig)

replaceMSCharacters

public java.lang.String replaceMSCharacters(java.lang.String orig,
                                            boolean keepNewlines)
This will replace all Microsoft special characters.
For example if text has been copied by Word chances are things like quotes, dash etc are all special characters.

Parameters:
String - text
boolean - keepNewLine
Returns:
text


Copyright (c) 2010 Jama Software, Inc. All Rights Reserved.