Package com.tietoenator.trip.jxp.data
Class TdbComponent
java.lang.Object
com.tietoenator.trip.jxp.data.TdbComponent
Container for a particular component of a record, i.e. either the
head or a specific part record.
-
Method Summary
Modifier and TypeMethodDescriptioncreateField
(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.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.Retrieve a collection of field names from within the component.fields()
Retrieve a collection of fields from within the component.boolean
Check whether the component should be cleared during a commit.Retrieve the value of a named fieldint
getId()
Retrieve the component's ID; this is zero for the head component.getName()
Retrieve the current value of the part name field (only valid for part components, obviously).Retrieve a reference to the TdbRecord within which this component existsvoid
setClearOnCommit
(boolean clear) Establish whether the component should be cleared during a commit.void
Set the value of a named fieldvoid
Establish, or modify, the value of the part name field (only valid for part components, obviously).
-
Method Details
-
getId
public int getId()Retrieve the component's ID; this is zero for the head component.- Returns:
- The component's ID
-
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
Retrieve a collection of field names from within the component.- Returns:
- The collection of field names
-
getOwnerRecord
Retrieve a reference to the TdbRecord within which this component exists- Returns:
- The containing record
-
getName
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
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
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
Set the value of a named field- Parameters:
name
- Name of field to store/overwritefield
- Field instance
-
deleteField
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
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
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 createtype
- Type of field to create- Returns:
- A new object that implements the TdbField interface
- Throws:
TdbException
-