Class TdbTextField

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

    public class TdbTextField
    extends TdbField
    Container and manipulation logic for a TExt field
    • Constructor Summary

      Constructors 
      Constructor Description
      TdbTextField​(TdbFieldTemplate tmpl)
      Constructor, creates a blank instance based on the template provided
      TdbTextField​(java.lang.String name)
      Constructor, creates a blank instance based on the name provided
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void appendText​(java.lang.String val)
      Text-specific function to append to the current value of a text field.
      void appendValue​(java.lang.String val)
      Append the provided paragraph text to the field's value
      This method cannot be used after any calls have been made to setText() or appendText() as the field is no longer defined in terms of paragraphs at that point.
      void appendValues​(java.util.Collection<java.lang.String> values)
      Append several paragraphs to this text field.
      void clear()
      Clear any existing state the field might have
      int getFieldSize()
      Retrieve the size of the value in the field.
      java.lang.String getText()
      Get the complete content of the field.
      TdbTextExtractionInfo getTextExtractionInfo()
      Provides access to an object that allows control and enabling of text extraction operations on this TExt field.
      TdbFieldType getType()
      Retrieve the field type
      java.lang.String getValue​(int index)
      Retrieve the value of the n'th paragraph.
      int getValueCount()
      Retrieve the number of paragraphs in the field.
      void insertValue​(int index, java.lang.String value)
      Inserts a new paragraph into the field.
      void insertValues​(int index, java.util.Collection<java.lang.String> values)
      Inserts several new paragraphs into the field.
      boolean isChanged()
      Returns the change status for the field.
      boolean isFormatted()
      Returns true if this TdbTextField contains a value produced by an output format and thereby doesn't correspond to an actual database field.
      boolean isPartial()
      Returns true if this TdbTextField contains a partial value.
      java.util.List<java.lang.String> originalValues()
      Retrieve the display form of the field, with the paragraphs being elements within the collection returned.
      void removeValue​(int index)
      Removes a paragraph from the field.
      void setText​(java.lang.String val)
      Text-specific function to set the initial value of a text field to that provided.
      void setValue​(int index, java.lang.String val)
      Set the value of a specific paragraph to that provided.
      java.lang.String toString()
      Retrieves a two newline-delimited string representation of the display content of the field
      java.util.List<java.lang.String> values()
      Retrieve the current content of the field -- refer to TdbField.Values for more detail.
      • Methods inherited from class java.lang.Object

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

      • TdbTextField

        public TdbTextField​(TdbFieldTemplate tmpl)
        Constructor, creates a blank instance based on the template provided
        Parameters:
        tmpl - Field template
      • TdbTextField

        public TdbTextField​(java.lang.String name)
        Constructor, creates a blank instance based on the name provided
        Parameters:
        name - Name of field
    • Method Detail

      • isFormatted

        public boolean isFormatted()
        Returns true if this TdbTextField contains a value produced by an output format and thereby doesn't correspond to an actual database field.
        Returns:
        True if the value is generated by an output format.
      • isPartial

        public boolean isPartial()
        Returns true if this TdbTextField contains a partial value.
        Specified by:
        isPartial in class TdbField
        Returns:
        True if the value is partial

        Partial values are typically produced when requesting a hit-focused so-called "teaser" value, e.g. for display in result lists.

        Partial values should be considered read-only, even if the current user has write access to the field. Writing back a partial value will overwrite the existing full value, causing what amounts to data corruption.

      • isChanged

        public boolean isChanged()
        Returns the change status for the field.
        Overrides:
        isChanged in class TdbField
        Returns:
        True if the field has uncommitted changes, otherwise false.
        Since:
        8.0-4
      • originalValues

        public java.util.List<java.lang.String> originalValues()
        Retrieve the display form of the field, with the paragraphs being elements within the collection returned.
        Specified by:
        originalValues in class TdbField
        Returns:
        Collection of field display values
      • values

        public java.util.List<java.lang.String> values()
        Retrieve the current content of the field -- refer to TdbField.Values for more detail. If the field has been modified using setText() or appendText() this property retrieves an array collection a single item, that item being the current value of the field. If those methods have not been used, the array retrieved holds a value for each paragraph in the field.
        Specified by:
        values in class TdbField
        Returns:
        Collection of field values
        See Also:
        TdbField.values()
      • getText

        public java.lang.String getText()
        Get the complete content of the field.
        If the field has just been retrieved from the server, and is therefore divided neatly into paragraph values, this property uses default paragraph separation rules to contruct the text (i.e. two newline equivalents). This may or may not match the database rules in question, and so care should be exercised by calling applications.
        Returns:
        The value of the complete field
      • getTextExtractionInfo

        public TdbTextExtractionInfo getTextExtractionInfo()
        Provides access to an object that allows control and enabling of text extraction operations on this TExt field.
      • clear

        public void clear()
        Clear any existing state the field might have
        Specified by:
        clear in class TdbField
      • getFieldSize

        public int getFieldSize()
        Retrieve the size of the value in the field.
        Specified by:
        getFieldSize in class TdbField
        Returns:
        Total size of the contents of the field.
        See Also:
        TdbField.getFieldSize()
      • getValue

        public java.lang.String getValue​(int index)
                                  throws TdbException
        Retrieve the value of the n'th paragraph.
        Note that if the field has been updated using the setText() or AppendText() methods, there is no concept of paragraph break maintained on the client, therefore any setting of index will result in the same string being returned, i.e. the entire text content of the field. This method really only has value, therefore, immediately after retrieving a record from the server.
        Specified by:
        getValue in class TdbField
        Parameters:
        index - The index of the paragraph to retrieve
        Returns:
        The value of the paragraph, or the value of the entire field if the field has been modified using the setText() or appendText() methods.
        Throws:
        TdbException
      • setValue

        public void setValue​(int index,
                             java.lang.String val)
                      throws TdbException
        Set the value of a specific paragraph to that provided.
        This method provides a structured means of updating a text field's current content. This is only valid before any call is made to either setText() or appendText, after which the field's value is not defined in terms of paragraphs.
        Specified by:
        setValue in class TdbField
        Parameters:
        index - The offset of the paragraph to update
        val - The value to establish as the paragraph's value
        Throws:
        TdbException
      • appendValue

        public void appendValue​(java.lang.String val)
                         throws TdbException
        Append the provided paragraph text to the field's value
        This method cannot be used after any calls have been made to setText() or appendText() as the field is no longer defined in terms of paragraphs at that point.
        Specified by:
        appendValue in class TdbField
        Parameters:
        val - The paragraph value to append to the field
        Throws:
        TdbException
      • appendValues

        public void appendValues​(java.util.Collection<java.lang.String> values)
                          throws TdbException
        Append several paragraphs to this text field.
        This method cannot be used after any calls have been made to setText() or appendText() as the field is no longer defined in terms of paragraphs at that point.
        Specified by:
        appendValues in class TdbField
        Parameters:
        values - The paragraph values to append to the field
        Throws:
        TdbException
      • getValueCount

        public int getValueCount()
                          throws TdbException
        Retrieve the number of paragraphs in the field.
        If the field has been modified using setText() or appendText(), this method always returns 1, since in that case the field holds a single value and is no longer defined in terms of paragraphs. If those methods have not been used, this method returns a count of paragraphs.
        Specified by:
        getValueCount in class TdbField
        Returns:
        Paragraph count
        Throws:
        TdbException
      • insertValue

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

        public void insertValues​(int index,
                                 java.util.Collection<java.lang.String> values)
                          throws TdbException
        Inserts several new paragraphs into the field.
        Specified by:
        insertValues in class TdbField
        Parameters:
        index - Zero-based index at which to insert the new paragraphs.
        values - The values to insert into the field.
        Throws:
        TdbException
      • removeValue

        public void removeValue​(int index)
                         throws TdbException
        Removes a paragraph from the field.
        This method cannot be used after any calls have been made to setText() or appendText() as the field is no longer defined in terms of paragraphs at that point.
        Specified by:
        removeValue in class TdbField
        Parameters:
        index - Zero-based index of paragraph to remove.
        Throws:
        TdbException
      • setText

        public void setText​(java.lang.String val)
        Text-specific function to set the initial value of a text field to that provided.
        Text fields do not lend themselves to simple manipulation by value offset. Using this method and the appendText() method, however, applications can simply store the whole value of a text field without needing to worry about paragraph boundaries in any specific manner. The text as provided (complete with line breaks, etc.) is stored "as is" and is only ever parsed for lexical structure by the server, using the rules established in the database design. Applications can therefore provide the entire content of the field using a single call to this method, or could choose to provide field content in arbitrary chunks using both this method and appendText()
        Parameters:
        val - The value the field should initially take
      • appendText

        public void appendText​(java.lang.String val)
        Text-specific function to append to the current value of a text field.
        Text fields do not lend themselves to simple manipulation by value offset. Using this method and the setText() method, however, applications can simply store the whole value of a text field without needing to worry about paragraph boundaries in any specific manner. The text as provided (complete with line breaks, etc.) is appended "as is" and is only ever parsed for lexical structure by the server, using the rules established in the database design. Applications can therefore provide the entire content of the field using a single call to setText(), or can choose to provide field content in arbitrary chunks using both setText() and this method. Calling applications must use care when calling this method, ensuring that line breaks are provided where needed, as the string provided here is appended immediately to the end of whatever text has previously been provided. No intermediate white space is infered by this method itself.
        Parameters:
        val - The value to append to the field's current value
      • toString

        public java.lang.String toString()
        Retrieves a two newline-delimited string representation of the display content of the field
        Specified by:
        toString in class TdbField
        Returns:
        Field content