Class VelocityReportUtil


  • public class VelocityReportUtil
    extends java.lang.Object
    • Constructor Detail

    • 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 - 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,
                                                 DocumentTypeDTO documentType,
                                                 java.lang.String fieldName,
                                                 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
      • getBackGroundColor

        public java.lang.String getBackGroundColor​(ContourItem doc,
                                                   java.lang.String fieldName,
                                                   DateFormatter dateFormat)
      • getValueForField

        public java.lang.String getValueForField​(ContourItem doc,
                                                 DocumentTypeFieldDTO fieldDTO,
                                                 DateFormatter dateFormat)
        Gets string value for the given field.
        Parameters:
        doc - document
        fieldDTO - field definition
        dateFormat - 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 - document
        fieldDTO - field definition
        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,
                                                 DateFormatter dateFormat)
      • getLookupIdForLookupMatrix

        public java.lang.Object getLookupIdForLookupMatrix​(ContourItem document,
                                                           java.lang.String fieldName)
        Used in velocity custom template to get lookup id for a Lookup Matrix Calculated.
      • 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)
      • wordBreak

        public java.lang.String wordBreak​(java.lang.String text,
                                          int maxLength)
        Workaround for Aspose PDF bug. Long strings without natural word breaks (spaces, dashes, new lines, etc) overrun the boundaries of table cells because Aspose fails to wrap them. This method looks for long sections of continuous text and adds newline characters so Aspose will wrap them
        Parameters:
        text - Some text that may need to be broken up
        text - The maximum text block length to allow
        Returns:
        The text with linebreaks added to any block of text longer than maxLength