rjw.dc.core.objects
Class DataCrowObject

java.lang.Object
  |
  +--rjw.dc.core.objects.DataCrowObject
Direct Known Subclasses:
Catagory, Movie, Mp3, Software

public class DataCrowObject
extends java.lang.Object

Base class for all Data Crow objects. Here the fields, values and required fields are stored. Checks are done to garantee uniqueness and validity of the records. Objects which extend this class need to override the save and load methods

Since:
1.3
Version:
DC0.50
Author:
Robert-Jan van der Waals

Field Summary
static int _ID
          The record ID
 
Constructor Summary
DataCrowObject()
           
 
Method Summary
 boolean checkIntegrity(boolean update)
          Checks if the values are unique and if all the required fields have been filled
 java.lang.String getFieldName(int columnIndex)
           
 java.lang.String[] getFieldNames()
          Returns all the database field names
 java.lang.String getLabel(int columnIndex)
           
 java.lang.String[] getLabels()
           
 int getMaxFieldLength(int columnIndex)
           
 int[] getMaxFieldLengths()
           
 int[] getRequiredFields()
          Returns the required field names
 boolean getSilence()
          Indicates if queries should display output return (boolean) show output y/n
 java.lang.String getTableName()
          Returns the tablename
 java.lang.String getUnfilledRequiredFields()
          Checks to see whether al required fields have been filled
 java.lang.Object getValue(int iField)
          Returns the value of a field
 java.lang.Object[] getValues()
          Returns all values
 boolean isUnique(DataCrowObject o, boolean bUpdateQuery)
          Checks to see whether the record already exists or not
 void load(QueryOptions options, RequestorCollection oRequestor)
          Loads records.
 void saveNew(RequestorCollection requestors)
          Inserts a new record.
 void saveUpdate(RequestorCollection requestors)
          Updates a record.
 void setSilence(boolean silence)
          Disables the output of this query to the log and log screen
 void setUIRowNumber(int row)
           
 void setValidation(boolean validate)
          Specifies if values should be validated
 void setValue(int iField, java.lang.Object value)
          Sets a value for the given field
 QueryCondition toQueryCondition(boolean select)
          Creates a query condition for select statements by using the field names and their values
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_ID

public static final int _ID
The record ID

See Also:
Constant Field Values
Constructor Detail

DataCrowObject

public DataCrowObject()
Method Detail

setValue

public void setValue(int iField,
                     java.lang.Object value)
Sets a value for the given field

Parameters:
iField - field indicator

getLabels

public java.lang.String[] getLabels()

getLabel

public java.lang.String getLabel(int columnIndex)

getMaxFieldLengths

public int[] getMaxFieldLengths()

getMaxFieldLength

public int getMaxFieldLength(int columnIndex)

getValue

public java.lang.Object getValue(int iField)
Returns the value of a field

Parameters:
iField - field indicator
Returns:
(String) field value

getValues

public java.lang.Object[] getValues()
Returns all values

Returns:
(String[]) all values for the fields

setUIRowNumber

public void setUIRowNumber(int row)

getFieldNames

public java.lang.String[] getFieldNames()
Returns all the database field names

Returns:
(String[]) database field names

getFieldName

public java.lang.String getFieldName(int columnIndex)

getRequiredFields

public int[] getRequiredFields()
Returns the required field names

Returns:
(String[]) required field names

getTableName

public java.lang.String getTableName()
Returns the tablename

Returns:
(String) name of the database table

saveNew

public void saveNew(RequestorCollection requestors)
Inserts a new record. Requests to the UI can be passed.


saveUpdate

public void saveUpdate(RequestorCollection requestors)
Updates a record. Requests to the UI can be passed.


load

public void load(QueryOptions options,
                 RequestorCollection oRequestor)
Loads records. Requests to the UI can be passed.

Parameters:
oRequestor - collection of requests, can be null
options - query options, can be null

setSilence

public void setSilence(boolean silence)
Disables the output of this query to the log and log screen

Parameters:
silence - show output y/n

getSilence

public boolean getSilence()
Indicates if queries should display output return (boolean) show output y/n


setValidation

public void setValidation(boolean validate)
Specifies if values should be validated

Parameters:
validate - valdate values indicator

toQueryCondition

public QueryCondition toQueryCondition(boolean select)
Creates a query condition for select statements by using the field names and their values

Returns:
QueryCondition query condition definition

checkIntegrity

public boolean checkIntegrity(boolean update)
Checks if the values are unique and if all the required fields have been filled

Parameters:
update - indicates if the values are new or existing
Returns:
(boolean) result

isUnique

public boolean isUnique(DataCrowObject o,
                        boolean bUpdateQuery)
Checks to see whether the record already exists or not

Parameters:
o - object to be checked
bUpdateQuery - indicates whether the object is to be updated or if it is a new object

getUnfilledRequiredFields

public java.lang.String getUnfilledRequiredFields()
Checks to see whether al required fields have been filled

Returns:
(String) string of unfilled fields