Package com.tietoenator.trip.jxp.data

# Class TdbComponent

java.lang.Object
com.tietoenator.trip.jxp.data.TdbComponent

public class TdbComponent extends Object
Container for a particular component of a record, i.e. either the head or a specific part record.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `TdbField`
  `createField(TdbFieldDesign design)`
  Create a new field instance
  This factory method creates a TdbField-derived object of the appropriate class and associates the new instance with this component.
  `TdbField`
  `createField(String name, TdbFieldType type)`
  Create a new field instance
  This factory method creates a TdbField-derived object of the appropriate class and associates the new instance with this component.
  `void`
  `deleteField(String name)`
  Delete the value of a named field
  Note that after a successful use of this method, the component still contains the named field, but the value of the field is empty.
  `Collection<String>`
  `fieldNames()`
  Retrieve a collection of field names from within the component.
  `Collection<TdbField>`
  `fields()`
  Retrieve a collection of fields from within the component.
  `boolean`
  `getClearOnCommit()`
  Check whether the component should be cleared during a commit.
  `TdbField`
  `getField(String name)`
  Retrieve the value of a named field
  `int`
  `getId()`
  Retrieve the component's ID; this is zero for the head component.
  `String`
  `getName()`
  Retrieve the current value of the part name field (only valid for part components, obviously).
  `TdbRecord`
  `getOwnerRecord()`
  Retrieve a reference to the TdbRecord within which this component exists
  `void`
  `setClearOnCommit(boolean clear)`
  Establish whether the component should be cleared during a commit.
  `void`
  `setField(String name, TdbField field)`
  Set the value of a named field
  `void`
  `setName(String name)`
  Establish, or modify, the value of the part name field (only valid for part components, obviously).

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### getId

    public int getId()
    Retrieve the component's ID; this is zero for the head component.
    Returns:
      The component's ID

  - ### fields

    public Collection<TdbField> fields()
    Retrieve a collection of fields from within the component. Each element of the collection is of a type implementing TdbField. Use the getType() method on each item to retrieve its TRIP field type.
    Returns:
      The collection of fields

  - ### fieldNames

    public Collection<String> fieldNames()
    Retrieve a collection of field names from within the component.
    Returns:
      The collection of field names

  - ### getOwnerRecord

    public TdbRecord getOwnerRecord()
    Retrieve a reference to the TdbRecord within which this component exists
    Returns:
      The containing record

  - ### getName

    public String getName() throws TdbException
    Retrieve the current value of the part name field (only valid for part components, obviously). This method will throw an exception if the database design with which the component is associated does not contain a part name field.
    Returns:
      The value of the part name field
    Throws:
      `TdbException`

  - ### setName

    public void setName(String name) throws TdbException
    Establish, or modify, the value of the part name field (only valid for part components, obviously). This method will throw an exception if the database design with which the component is associated does not contain a part name field.
    Parameters:
      `name` - The new value of the part name field
    Throws:
      `TdbException`

  - ### getClearOnCommit

    public boolean getClearOnCommit()
    Check whether the component should be cleared during a commit.
    By default, components are not cleared during an update, i.e. only the fields that are included within the commit operation are modified by that operation, any other fields within that component are left unmodified. If this flag is set true, however, then the component is first cleared before new content is added. Note that this only has effect when updating an existing record.
    Returns:
      The current value of the clear-on-commit flag

  - ### setClearOnCommit

    public void setClearOnCommit(boolean clear)
    Establish whether the component should be cleared during a commit.
    By default, components are not cleared during an update, i.e. only the fields that are included within the commit operation are modified by that operation, any other fields within that component are left unmodified. If this flag is set true, however, then the component is first cleared before new content is added. Note that this only has effect when updating an existing record.
    Parameters:
      `clear` - The new value of the clear-on-commit flag

  - ### getField

    public TdbField getField(String name)
    Retrieve the value of a named field
    Parameters:
      `name` - Name of field to retrieve
    Returns:
      The appropriate field instance, or null if not found; this field instance is "live" and can be modified as required.

  - ### setField

    public void setField(String name, TdbField field)
    Set the value of a named field
    Parameters:
      `name` - Name of field to store/overwrite
      `field` - Field instance

  - ### deleteField

    public void deleteField(String name)
    Delete the value of a named field
    Note that after a successful use of this method, the component still contains the named field, but the value of the field is empty. When the component is written to the server, the field in the database will be deleted at that time.
    Parameters:
      `name` - Name of field to delete

  - ### createField

    public TdbField createField(TdbFieldDesign design) throws TdbException
    Create a new field instance
    This factory method creates a TdbField-derived object of the appropriate class and associates the new instance with this component.
    Parameters:
      `design` - The design of the field to create
    Returns:
      A new object that implements the TdbField interface
    Throws:
      `TdbException`

  - ### createField

    public TdbField createField(String name, TdbFieldType type) throws TdbException
    Create a new field instance
    This factory method creates a TdbField-derived object of the appropriate class and associates the new instance with this component.
    Parameters:
      `name` - Name of field to create
      `type` - Type of field to create
    Returns:
      A new object that implements the TdbField interface
    Throws:
      `TdbException`