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