Package com.jamasoftware.velocity
Class VelocityReportUtil
- java.lang.Object
-
- com.jamasoftware.velocity.VelocityReportUtil
-
public class VelocityReportUtil extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description VelocityReportUtil(FieldDataTypeManager fieldDataTypeManager)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
cleanText(java.lang.String html)
This method will go through the provided text cleaning out unnecessary syntax.static java.util.Map<java.lang.String,java.lang.Object>
convertStringParamsToReportParams(ReportParameterDTO reportParameterDTO, QuickReportDTO quickReportDTO)
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, DocumentTypeDTO documentType, java.lang.String fieldName, DateFormatter dateFormat)
Gets string value for the given field.java.lang.String
getValueForField(ContourItem doc, DocumentTypeDTO documentType, java.lang.String fieldName, DateFormatter dateFormat, boolean exportToExcel)
Gets string value for the given field.java.lang.String
getValueForField(ContourItem doc, DocumentTypeFieldDTO fieldDTO, DateFormatter dateFormat)
Gets string value for the given field.java.lang.String
getValueForField(ContourItem doc, DocumentTypeFieldDTO fieldDTO, DateFormatter dateFormat, boolean exportToExcel)
Gets string value for the given field.java.lang.String
getValueForField(ContourItem doc, java.lang.String fieldName, 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.
-
-
-
Constructor Detail
-
VelocityReportUtil
public VelocityReportUtil(FieldDataTypeManager fieldDataTypeManager)
-
-
Method Detail
-
getValueForField
public java.lang.String getValueForField(ContourItem doc, DocumentTypeDTO documentType, java.lang.String fieldName, DateFormatter dateFormat)
Gets string value for the given field.- Parameters:
doc
- documentdocumentType
- document type for the documentfieldName
- name of the field (not the label)dateFormat
- date formatter- Returns:
- string value
-
getValueForField
public java.lang.String getValueForField(ContourItem doc, DocumentTypeDTO documentType, java.lang.String fieldName, DateFormatter dateFormat, boolean exportToExcel)
Gets string value for the given field.- Parameters:
doc
- documentdocumentType
- document type for the documentfieldName
- name of the field (not the label)dateFormat
- date formatterexportToExcel
- 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, DocumentTypeFieldDTO fieldDTO, DateFormatter dateFormat)
Gets string value for the given field.- Parameters:
doc
- documentfieldDTO
- field definitiondateFormat
- date formatter- Returns:
- string value
-
getValueForField
public java.lang.String getValueForField(ContourItem doc, DocumentTypeFieldDTO fieldDTO, DateFormatter dateFormat, boolean exportToExcel)
Gets string value for the given field.- Parameters:
doc
- documentfieldDTO
- field definitiondateFormat
- date formatterexportToExcel
- 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, 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:
str
- that needs to have breaks replaced for Excel- Returns:
- str with HTML breaks replaced with line breaks
-
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:
str
- to be encoded for HTML- Returns:
- str encoded for HTML
-
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:
html
- text that needs to be cleaned- Returns:
- html cleaned of unnecessary syntax
-
fromHtmlToRawText
public java.lang.String fromHtmlToRawText(java.lang.String orig)
-
convertStringParamsToReportParams
public static java.util.Map<java.lang.String,java.lang.Object> convertStringParamsToReportParams(ReportParameterDTO reportParameterDTO, QuickReportDTO quickReportDTO)
-
-