rjw.dc.core.objects
Class DataCrowObject

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

public abstract 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
 
Method Summary
 boolean checkIntegrity(boolean update)
          Checks if the values are unique and if all the required fields have been filled
 void clearValues()
           
 void delete(RequestorCollection requestors)
           
 int[] getFieldIndices()
           
 java.lang.String getFieldName(int columnIndex)
           
 java.lang.String[] getFieldNames()
          Returns all the database field names
 int getFieldType(int index)
           
 int[] getFieldTypes()
          Returns all the database field names
 int[] getHiddenFields()
           
 java.lang.String getLabel(int columnIndex)
           
 java.lang.String[] getLabels()
           
 int getMaxFieldLength(int columnIndex)
           
 int[] getMaxFieldLengths()
           
 java.lang.String getModuleName()
           
 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
 int[] getVisibleFields()
           
 java.lang.Object[] getVisibleValues()
           
 boolean isAmazonUpdateAllowed()
           
 boolean isHidden(int field)
           
 boolean isImdbUpdateAllowed()
           
 boolean isRequired(int field)
           
 boolean isUnique(DataCrowObject o, boolean bUpdateQuery)
          Checks to see whether the record already exists or not
 void load(QueryOptions options, RequestorCollection requestors)
          Loads records.
 void saveNew(RequestorCollection requestors)
          Inserts a new record.
 void saveUpdate(RequestorCollection requestors)
          Updates a record.
static void setAlwaysGenerateID(boolean alwaysGenerateID)
           
 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
abstract  void setValues(java.lang.Object[] row)
           
 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
Method Detail

isHidden

public boolean isHidden(int field)

isRequired

public boolean isRequired(int field)

getHiddenFields

public int[] getHiddenFields()

getVisibleFields

public int[] getVisibleFields()

getVisibleValues

public java.lang.Object[] getVisibleValues()

isAmazonUpdateAllowed

public boolean isAmazonUpdateAllowed()

isImdbUpdateAllowed

public boolean isImdbUpdateAllowed()

setAlwaysGenerateID

public static void setAlwaysGenerateID(boolean alwaysGenerateID)

setValues

public abstract void setValues(java.lang.Object[] row)

setValue

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

Parameters:
iField - field indicator

clearValues

public void clearValues()

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)

getModuleName

public java.lang.String getModuleName()

getFieldTypes

public int[] getFieldTypes()
Returns all the database field names

Returns:
(String[]) database field names

getFieldType

public int getFieldType(int index)

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.


delete

public void delete(RequestorCollection requestors)

load

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

Parameters:
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

getFieldIndices

public int[] getFieldIndices()