Class TdbStringField

  • All Implemented Interfaces:
    com.tietoenator.trip.jxp.internal.utils.DOMSink

    public class TdbStringField
    extends TdbField
    Container for values in a STring field
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void appendValue​(java.lang.String value)
      Not supported for STring fields
      void appendValues​(java.util.Collection<java.lang.String> value)
      Not supported for STring fields
      void clear()
      Clear state from the field
      void convert​(TdbRenditionType rendition, java.lang.String originalFilename, java.lang.String outputDirectory, java.lang.String outputFilename, java.lang.String preferredAdapter, TdbTextField highlightSourceField, boolean refreshHitLocations)
      Render the contents of the field to HTML and write it to a file.
      void copyFromFile​(java.lang.String name)
      Copy the content of the specified file into this field
      void copyToFile​(java.lang.String name)
      Copy the current content of the field (whether rendered or not) into the named file.
      byte[] getBlob()
      Retrieve the current value (in total) of the field.
      java.lang.String getExtractionTarget()
      Deprecated.
      Use the TextExtractionInfo class via the TdbTextField method getTextExtractionInfo() instead.
      int getFieldSize()
      Retrieve the size of the value in the field.
      java.lang.String getPropertyNameField()
      Get the name of the field to retrieve property names during a text extraction operation on this STring field.
      java.lang.String getPropertyValueField()
      Get the name of the field to retrieve property values during a text extraction operation on this STring field.
      java.lang.String getRendition()
      Retrieve the rendition of the field that was requested during the most recent retrieval.
      TdbRenditionType getRenditionType()
      Retrieve the type of rendition that was requested for the field during the latest retrieval.
      TdbFieldType getType()
      Retrieve field type
      java.lang.String getValue​(int index)
      Not supported for STring fields
      int getValueCount()
      Not supported for STring fields
      void insertValue​(int index, java.lang.String value)
      Not supported for STring fields
      void insertValues​(int index, java.util.Collection<java.lang.String> value)
      Not supported for STring fields
      boolean isPartial()
      Returns true if this field contains a partial value.
      java.util.List<java.lang.String> originalValues()
      Not supported for STring fields
      void removeValue​(int index)
      Not supported for STring fields
      void setBlob​(byte[] blob)
      Establish (replace) the current value of the field
      void setExtractionTarget​(java.lang.String name)
      Deprecated.
      Use the TextExtractionInfo class via the TdbTextField method getTextExtractionInfo() instead.
      void setPropertyNameField​(java.lang.String propertyNameField)
      Set the name of the field to retrieve property names during a text extraction operation on this STring field.
      void setPropertyValueField​(java.lang.String propertyValueField)
      Set the name of the field to retrieve property values during a text extraction operation on this STring field.
      void setValue​(int index, java.lang.String value)
      Not supported for STring fields
      java.lang.String toString()
      Override
      java.util.List<java.lang.String> values()
      Not supported for STring fields
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • TdbStringField

        @Deprecated
        public TdbStringField​(TdbFieldTemplate tmpl)
        Deprecated.
        Use TdbStringField(TdbRecord,TdbFieldTemplate) instead.
        Constructor, creates a blank instance based on the template provided
        Parameters:
        tmpl - Field template
      • TdbStringField

        public TdbStringField​(TdbRecord parent,
                              TdbFieldTemplate tmpl)
        Constructor, creates a blank instance based on the template provided
        Parameters:
        parent - The TdbRecord instance associated with this STRING instance
        tmpl - Field template
        Since:
        TRIPjxp version 2.1-3
      • TdbStringField

        @Deprecated
        public TdbStringField​(java.lang.String name)
        Deprecated.
        Use TdbStringField(TdbRecord, String) instead.
        Constructor, creates a blank instance based on the name provided
        Parameters:
        name - Name of field
      • TdbStringField

        public TdbStringField​(TdbRecord parent,
                              java.lang.String name)
        Constructor, creates a blank instance based on the name provided
        Parameters:
        parent - The TdbRecord instance associated with this STRING instance
        name - Name of field
        Since:
        TRIPjxp version 2.1-3
    • Method Detail

      • getFieldSize

        public int getFieldSize()
        Retrieve the size of the value in the field.

        This method causes network I/O if connected to TRIP version 6.2-9:7 or later and the string field value has not yet been accessed.

        Specified by:
        getFieldSize in class TdbField
        Returns:
        Total size of the contents of the field.
        See Also:
        TdbField.getFieldSize()
      • isPartial

        public boolean isPartial()
        Returns true if this field contains a partial value.
        Specified by:
        isPartial in class TdbField
        Returns:
        True if the value is partial
        See Also:
        TdbField.isPartial()
      • getBlob

        public byte[] getBlob()
                       throws TdbException
        Retrieve the current value (in total) of the field.

        From TRIPsystem version 6.2-9:7, STRING values are transferred on demand only. The benefit is that records can be quickly retrieved even if they hold over 100 MB of binary data. When this property is accessed, the field data is requested from the server and transported to the client in 2MB chunks. This lowers the overall resource consumption requirements on both server and client and reduces the total transfer time for the record data.

        Returns:
        The current field's value
        Throws:
        TdbException - if the field is not in original (un-rendered) format
      • setBlob

        public void setBlob​(byte[] blob)
        Establish (replace) the current value of the field
        Parameters:
        blob - The new value the field should contain
      • getRenditionType

        public TdbRenditionType getRenditionType()
        Retrieve the type of rendition that was requested for the field during the latest retrieval. If the field has been modified using setBlob(), the rendition will be reset to DefaultRendition regardless of what rendition, if any, was requested during the latest fetch operation.
        Returns:
        A rendition type (can be DefaultRendition)
      • getRendition

        public java.lang.String getRendition()
                                      throws TdbException
        Retrieve the rendition of the field that was requested during the most recent retrieval. If no such rendition was requested, use getBlob() to retrieve the field's content.
        Returns:
        The rendition of the field that was performed during the most recent retrieval request.
        Throws:
        TdbException - if the field is in original (un-rendered) format.
      • setExtractionTarget

        @Deprecated
        public void setExtractionTarget​(java.lang.String name)
                                 throws TdbException
        Deprecated.
        Use the TextExtractionInfo class via the TdbTextField method getTextExtractionInfo() instead.
        Establish the name of the TExt field with which any text extraction operations on this STring field are to be associated.
        Parameters:
        name - The name of a TExt field from the same database
        Throws:
        TdbException - if the name provided is invalid
      • getExtractionTarget

        @Deprecated
        public java.lang.String getExtractionTarget()
        Deprecated.
        Use the TextExtractionInfo class via the TdbTextField method getTextExtractionInfo() instead.
        Retrieve the name of any TExt field that has been established as the target for any extraction operations performed on this field's content.
        Returns:
        The name of the associated text field, if any.
      • getPropertyNameField

        public java.lang.String getPropertyNameField()
        Get the name of the field to retrieve property names during a text extraction operation on this STring field.
        Returns:
        The name of the associated phrase field, if any.
      • setPropertyNameField

        public void setPropertyNameField​(java.lang.String propertyNameField)
        Set the name of the field to retrieve property names during a text extraction operation on this STring field.
      • getPropertyValueField

        public java.lang.String getPropertyValueField()
        Get the name of the field to retrieve property values during a text extraction operation on this STring field.
        Returns:
        The name of the associated phrase field, if any.
      • setPropertyValueField

        public void setPropertyValueField​(java.lang.String propertyValueField)
        Set the name of the field to retrieve property values during a text extraction operation on this STring field.
      • getValue

        public java.lang.String getValue​(int index)
                                  throws TdbException
        Not supported for STring fields
        Specified by:
        getValue in class TdbField
        Parameters:
        index -
        Returns:
        N/A
        Throws:
        TdbException
      • setValue

        public void setValue​(int index,
                             java.lang.String value)
                      throws TdbException
        Not supported for STring fields
        Specified by:
        setValue in class TdbField
        Parameters:
        index -
        value -
        Throws:
        TdbException
      • appendValues

        public void appendValues​(java.util.Collection<java.lang.String> value)
                          throws TdbException
        Not supported for STring fields
        Specified by:
        appendValues in class TdbField
        Parameters:
        value -
        Throws:
        TdbException
      • insertValue

        public void insertValue​(int index,
                                java.lang.String value)
                         throws TdbException
        Not supported for STring fields
        Specified by:
        insertValue in class TdbField
        Parameters:
        index - Zero-based index at which to insert the new subfield or paragraph.
        value - The value to insert into the field.
        Throws:
        TdbException
      • insertValues

        public void insertValues​(int index,
                                 java.util.Collection<java.lang.String> value)
                          throws TdbException
        Not supported for STring fields
        Specified by:
        insertValues in class TdbField
        Parameters:
        index - Zero-based index at which to insert the new subfields or paragraphs.
        value - The value to insert into the field.
        Throws:
        TdbException
      • removeValue

        public void removeValue​(int index)
                         throws TdbException
        Not supported for STring fields
        Specified by:
        removeValue in class TdbField
        Parameters:
        index - Zero-based index from which to remove a subfield or paragraph.
        Throws:
        TdbException
      • clear

        public void clear()
        Clear state from the field
        Specified by:
        clear in class TdbField
      • convert

        public void convert​(TdbRenditionType rendition,
                            java.lang.String originalFilename,
                            java.lang.String outputDirectory,
                            java.lang.String outputFilename,
                            java.lang.String preferredAdapter,
                            TdbTextField highlightSourceField,
                            boolean refreshHitLocations)
                     throws TdbException,
                            java.io.IOException
        Render the contents of the field to HTML and write it to a file.
        Parameters:
        rendition - How to render the string field contents
        originalFilename - The name of the file stored in this string field
        outputDirectory - Directory in which to put the generated file(s)
        outputFilename - Name of file to which to write the field's content
        preferredAdapter - OPTIONAL name of the TRIPcof file filter adapter to use (not used with TRIPview-C)
        highlightSourceField - OPTIONAL field object for the text field from which to get hit highlighting (pass null for no hit highlighting).
        refreshHitLocations - Pass true (strongly recommended) in order to refresh the hit locations prior to performing the HTML conversion (pass null or empty string to let TRIPcof/TRIPview-C decide which adapter to use).

        The use of this method requires a local installation of TRIPcof or TRIPview-C.

        If TRIPcof is used, its installation directory must be specified as either a system property with the name TRIPCOF_HOME, or an environment variable with the name TRIPCOF_HOME.

        If TRIPview-C is used, its installation directory must be specified as either a system property with the name TRIPVIEW_HOME, or an environment variable with the name TRIPVIEW_HOME.

        This method performs client-side HTML conversion. This requires that the string field value has been fetched from the server without a rendition specification (use a normal TdbFieldTemplate or a TdbRendition with DefaultRendition as the rendition type). When the string value has been fetched, call this method with a HTML-specific rendition type - either BasicHTML or MimeEncodedHtml.

        Note that the rendition type BasicHTML may generate any number of graphic files for the images in the document. These files will be put in the same directory with the generated HTML file. Be sure to specify the filename argument so that it is easy to clean up these files when they are no longer needed.

        Hit highlighting is supported when the associated search set has been created by a FIND or FUZZ CCL order with either the TdbCclCommand class or the TdbSearch class. The TdbRecordSet class is only supported if a pre-existing search order is supplied to it. Using the query capability of the TdbRecordSet class itself is not supported because such search sets are automatically deleted before the data is returned to the client.

        In order to generate an HTML file where search hits are highlighted, supply the text field object to the highlightSourceField parameter. This text field must contain the extracted document text. If TRIPview-C is used, the document should have been processed with TRIPview-C for text extraction. Doing otherwise may result in hit highlighting at invalid or incorrect locations in the text.

        The refreshHitLocations parameter should be set to true when you are using HTML conversion with hit highlighting together with TRIPview-C. Assigning this parameter to false may result in incorrect offset values to hit words. This is because fill characters produced during text extraction may differ from version to version. Setting this parameter to true results in extra network I/O. This parameter must be set to false if TRIPcof is used.

        To produce an HTML document without hit highlighting, pass null to the highlightSourceField parameter.

        For server-side conversion, add a TdbRendition or TdbHighlightRendition instance as field template to the retrieval template instead of a normal TdbFieldTemplate. Then use the file CopyToFile to store the rendered data to a local file, or access it using the Rendition property.

        If TRIPcof is used and logging is enabled in the fifiase.conf configuration file, the directory specified by the AseLogDirectory property in that file must be writable by the operating system user who runs the TRIPjxp application. If the directory is not writable, no log file will be produced by TRIPcof.

        Requesting an HTML conversion with hit highlighting results in network I/O.

        Throws:
        TdbException
        java.io.IOException
      • copyFromFile

        public void copyFromFile​(java.lang.String name)
                          throws java.io.IOException,
                                 TdbException
        Copy the content of the specified file into this field
        Parameters:
        name - Name of file to read
        Throws:
        java.io.IOException
        TdbException - if the file specified is invalid
      • copyToFile

        public void copyToFile​(java.lang.String name)
                        throws java.io.IOException
        Copy the current content of the field (whether rendered or not) into the named file. If the field currently contains rendered content, that rendition will be written using the UTF-8 character set.
        Parameters:
        name - Name of file into which to copy content of field
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Override
        Specified by:
        toString in class TdbField
        Returns:
        string representation