Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

nectar.record
Class Record  view Record download Record.java

java.lang.Object
  extended bynectar.record.Record
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CategoryRecord, CommentRecord, DocumentationRecord, FAQRecord, ForumRecord, ImageFormatRecord, ImageRecord, NewsRecord, PersonRecord, SupportRecord

public abstract class Record
extends java.lang.Object
implements java.io.Serializable

The abstract base model element for data records.

To retrieve records from the datasource, you must first know their ID numbers. To do this, see nectar.data.DataAdapterService on how to build and execute queries that will return relevant ID numbers. Once you have one or more ID number, you should retrieve records through the nectar.services.RecordService methods which return record instances.

You can then use all the Record.get[*]() methods on the record to retrieve raw data objects from the record, or retrieve a nectar.view.RecordView through the Record.getView() method.

Use the set*() methods to modify the data in a Record instance, followed by a nectar.services.RecordService#commit call to persist your changes to the datasource.

To create a new record, call the Record.setupCreate() method on a newly instantiated Record, use the Record.set*() to fill the data, and finally commit it to the database. A newly created record will only have an ID number once it has been committed.


Field Summary
private  nectar.record.datatypes.RecordInteger createdBy
           
private  nectar.record.datatypes.RecordDate createdDate
           
protected  java.util.Vector dataTables
          The Collection of tables that this record can build itself from.
static java.lang.String FIELD_CHILD_ID
          Field name of the implementation id field in the datasource.
static java.lang.String FIELD_CREATED_BY
          Field name of the createdDate field in the datasource.
static java.lang.String FIELD_CREATED_DATE
          Field name of the createdBy field in the datasource.
static java.lang.String FIELD_MODIFIED_DATE
          Field name of the modifiedDate field in the datasource.
static java.lang.String FIELD_ORDER_BY
          Field name of the order_by field in the datasource.
static java.lang.String FIELD_OWNER
          Field name of the owner field in the datasource.
static java.lang.String FIELD_PROJECT
          Field name of the project ID field in the datasource.
static java.lang.String FIELD_RECORD_ID
          Field name of the id field in the datasource.
static java.lang.String FIELD_STATUS
          Field name of the status field in the datasource.
static java.lang.String FIELD_TYPE
          Field name of the type field in the datasource.
protected  java.util.Vector fields
           
private  nectar.record.datatypes.RecordInteger id
           
private static org.apache.commons.logging.Log log
           
private  nectar.record.datatypes.RecordDate modifiedDate
           
private  nectar.record.datatypes.RecordInteger orderBy
           
private  nectar.record.datatypes.RecordInteger owner
           
private  nectar.record.datatypes.RecordInteger project
           
private  java.util.HashMap propertyChangeMap
           
private  nectar.record.datatypes.RecordStatusEnum status
           
static java.lang.String TABLE
          The name of the top-level record table in the datasource.
static java.lang.String[] TOP_LEVEL_FIELD_NAMES
          Array of field names defined for all records.
private  nectar.record.datatypes.RecordTypeEnum type
           
 
Constructor Summary
protected Record()
          Creates a new, empty instance of a Record model.
 
Method Summary
 Record copy()
           
 java.lang.Long getCreatedBy()
          Returns the ID number of the PersonRecord, which describes the person that created this record.
 java.util.Date getCreatedDate()
          Returns the Date at which this record was originally created.
 java.util.Collection getFieldNames()
          Returns the list of field names required to build this record.
protected  java.util.Collection getFields()
           
 java.lang.Long getId()
          Returns the ID number of this record.
 java.util.Date getModifiedDate()
          Returns the Date at which this record was last modified.
 java.lang.Long getOrderBy()
          Returns the ordering value of this record.
 java.lang.Long getOwner()
          Returns the ID number of the record that owns this record or null if this record isn't owned by any other record.
 java.lang.Long getProject()
          Returns the project ID number of this record.
abstract  java.lang.String getRecordType()
          Returns the type String for this Record.
 java.lang.String getStatus()
          Returns the status of this record.
 java.util.Collection getTables()
          Returns a Collection of Strings that lists the datasource names of the tables required to build this Record.
abstract  nectar.view.RecordView getView()
          Creates and returns appropriate RecordView instance for this record.
 void load(java.util.Map values)
          Loads the required data from the datasource into this record instance.
 void setCreatedBy(java.lang.Long value)
          Sets the ID number of the PersonRecord, which describes the person that created this record.
 void setCreatedDate(java.util.Date value)
          Sets the Date at which this record was originally created.
 void setId(java.lang.Long value)
          Sets the ID for this record.
 void setModifiedDate(java.util.Date value)
          Sets the Date at which this record was last modified.
 void setOrderBy(java.lang.Long value)
          Sets the ordering value of this record.
 void setOwner(java.lang.Long value)
          Sets the owner ID number of this record.
 void setProject(java.lang.Long value)
          Sets the project ID for this record.
 void setStatus(java.lang.String value)
          Sets the status of this record.
protected  void setupCreate(java.lang.Long project, java.lang.Long creator)
          loads all the default and system values into an newly instantiated, empty Record instance.
 java.util.HashMap toMap()
          Returns a [field_name] => [(String) value] HashMap of this record.
 java.util.HashMap toObjectMap()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

propertyChangeMap

private java.util.HashMap propertyChangeMap

log

private static org.apache.commons.logging.Log log

dataTables

protected java.util.Vector dataTables
The Collection of tables that this record can build itself from.


TABLE

public static java.lang.String TABLE
The name of the top-level record table in the datasource.


FIELD_RECORD_ID

public static final java.lang.String FIELD_RECORD_ID
Field name of the id field in the datasource.

See Also:
Constant Field Values

FIELD_PROJECT

public static final java.lang.String FIELD_PROJECT
Field name of the project ID field in the datasource.

See Also:
Constant Field Values

FIELD_CHILD_ID

public static final java.lang.String FIELD_CHILD_ID
Field name of the implementation id field in the datasource.

See Also:
Constant Field Values

FIELD_OWNER

public static final java.lang.String FIELD_OWNER
Field name of the owner field in the datasource.

See Also:
Constant Field Values

FIELD_TYPE

public static final java.lang.String FIELD_TYPE
Field name of the type field in the datasource.

See Also:
Constant Field Values

FIELD_CREATED_DATE

public static final java.lang.String FIELD_CREATED_DATE
Field name of the createdBy field in the datasource.

See Also:
Constant Field Values

FIELD_MODIFIED_DATE

public static final java.lang.String FIELD_MODIFIED_DATE
Field name of the modifiedDate field in the datasource.

See Also:
Constant Field Values

FIELD_CREATED_BY

public static final java.lang.String FIELD_CREATED_BY
Field name of the createdDate field in the datasource.

See Also:
Constant Field Values

FIELD_STATUS

public static final java.lang.String FIELD_STATUS
Field name of the status field in the datasource.

See Also:
Constant Field Values

FIELD_ORDER_BY

public static final java.lang.String FIELD_ORDER_BY
Field name of the order_by field in the datasource.

See Also:
Constant Field Values

TOP_LEVEL_FIELD_NAMES

public static final java.lang.String[] TOP_LEVEL_FIELD_NAMES
Array of field names defined for all records.


id

private nectar.record.datatypes.RecordInteger id

project

private nectar.record.datatypes.RecordInteger project

owner

private nectar.record.datatypes.RecordInteger owner

type

private nectar.record.datatypes.RecordTypeEnum type

createdDate

private nectar.record.datatypes.RecordDate createdDate

modifiedDate

private nectar.record.datatypes.RecordDate modifiedDate

createdBy

private nectar.record.datatypes.RecordInteger createdBy

status

private nectar.record.datatypes.RecordStatusEnum status

orderBy

private nectar.record.datatypes.RecordInteger orderBy

fields

protected java.util.Vector fields
Constructor Detail

Record

protected Record()
Creates a new, empty instance of a Record model. To load records, you should use RecordService.get[Record](id); instead of this constructor. To create a new Record to be inserted into the datasource, you should use the constructors of the child class of the Record class, then call setupCreate()

Method Detail

copy

public final Record copy()

getRecordType

public abstract java.lang.String getRecordType()
Returns the type String for this Record.


getTables

public final java.util.Collection getTables()
Returns a Collection of Strings that lists the datasource names of the tables required to build this Record.


getFields

protected java.util.Collection getFields()

getFieldNames

public final java.util.Collection getFieldNames()
Returns the list of field names required to build this record.


load

public final void load(java.util.Map values)
Loads the required data from the datasource into this record instance. To load a record you should use the RecordService.getRecord(Long id) method. Using this method directly will harm performance and is very insecure, since all the caching, distributed synchronization, etc. will be bypassed.


toMap

public final java.util.HashMap toMap()
Returns a [field_name] => [(String) value] HashMap of this record.


toObjectMap

public final java.util.HashMap toObjectMap()

setupCreate

protected void setupCreate(java.lang.Long project,
                           java.lang.Long creator)
loads all the default and system values into an newly instantiated, empty Record instance.


getId

public final java.lang.Long getId()
Returns the ID number of this record.


getProject

public final java.lang.Long getProject()
Returns the project ID number of this record.


setProject

public final void setProject(java.lang.Long value)
                      throws RecordInvalidInputException
Sets the project ID for this record.


setId

public final void setId(java.lang.Long value)
                 throws RecordInvalidInputException
Sets the ID for this record. Note that you can't modify the id number of a record, only set it on a newly created instance.


getOwner

public final java.lang.Long getOwner()
Returns the ID number of the record that owns this record or null if this record isn't owned by any other record.


setOwner

public final void setOwner(java.lang.Long value)
                    throws RecordInvalidInputException
Sets the owner ID number of this record.


getCreatedDate

public final java.util.Date getCreatedDate()
Returns the Date at which this record was originally created.


setCreatedDate

public final void setCreatedDate(java.util.Date value)
                          throws RecordInvalidInputException
Sets the Date at which this record was originally created. This method always throws a RecordInvalidInputException since the createdDate is generated internally, and cannot be modified.


getModifiedDate

public final java.util.Date getModifiedDate()
Returns the Date at which this record was last modified.


setModifiedDate

public final void setModifiedDate(java.util.Date value)
                           throws RecordInvalidInputException
Sets the Date at which this record was last modified. This method always throws a RecordInvalidInputException since the modifiedDate is generated internally, and cannot be modified.


getCreatedBy

public final java.lang.Long getCreatedBy()
Returns the ID number of the PersonRecord, which describes the person that created this record.


setCreatedBy

public final void setCreatedBy(java.lang.Long value)
                        throws RecordInvalidInputException
Sets the ID number of the PersonRecord, which describes the person that created this record. This method always throws a RecordInvalidInputException since the createdBy field is generated internally, and cannot be modified.


getStatus

public final java.lang.String getStatus()
Returns the status of this record.


setStatus

public final void setStatus(java.lang.String value)
                     throws RecordInvalidInputException
Sets the status of this record.


getOrderBy

public final java.lang.Long getOrderBy()
Returns the ordering value of this record.


setOrderBy

public final void setOrderBy(java.lang.Long value)
                      throws RecordInvalidInputException
Sets the ordering value of this record.


getView

public abstract nectar.view.RecordView getView()
Creates and returns appropriate RecordView instance for this record. You can safely typecast the return value to the RecordView subclass associated to this record.