|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.datacrow.core.objects.DcObject
public class DcObject
This class is what it is all about. Each DcObject represents an item
within Data Crow. DcObjects are very generic by nature. There are no direct
getters and setters for their values. Instead the values are stored in a Map object
and the values are retrieved by using the field indices.
It's recommended before starting new development of plugins to create so called
helper classes for your new module. Examples of helper classes are Software
and Movie
.
DcObjects are managed and maintained by the Data Manager class (DataManager
.
Each DcObject belongs to a (@link DcModule
).
Field Summary | |
---|---|
static int |
_ID
|
static int |
_SYS_AVAILABLE
|
static int |
_SYS_CONTAINER
|
static int |
_SYS_CREATED
|
static int |
_SYS_DISPLAYVALUE
|
static int |
_SYS_EXTERNAL_REFERENCES
|
static int |
_SYS_FILEHASH
|
static int |
_SYS_FILEHASHTYPE
|
static int |
_SYS_FILENAME
|
static int |
_SYS_FILESIZE
|
static int |
_SYS_LENDBY
|
static int |
_SYS_LOANDAYSTILLOVERDUE
|
static int |
_SYS_LOANDUEDATE
|
static int |
_SYS_LOANDURATION
|
static int |
_SYS_MODIFIED
|
static int |
_SYS_MODULE
|
static int |
_SYS_SERVICE
|
static int |
_SYS_SERVICEURL
|
static int |
_VALUE
|
protected java.util.Collection<DcObject> |
children
|
Constructor Summary | |
---|---|
DcObject(int module)
Creates a new instance. |
Method Summary | |
---|---|
void |
addChild(DcObject child)
|
void |
addExternalReference(java.lang.String type,
java.lang.String key)
Adds or updates the existing external key of the specified type. |
void |
addRequest(IRequest request)
Add a request. |
void |
applyEnhancers(boolean update)
Applies the enhancers on this item. |
void |
applyTemplate()
|
void |
applyTemplate(DcTemplate template)
|
protected void |
beforeDelete()
|
protected void |
beforeSave()
Actions to be performed before saving the object. |
void |
checkIntegrity()
Checks the integrity of the item. |
void |
clearValues()
Resets this item. |
DcObject |
clone()
Clones this objects. |
int |
compareTo(DcObject o)
|
void |
copy(DcObject dco,
boolean overwrite,
boolean allowDeletes)
Copies all values from the specified Data Crow object. |
void |
copyImage(Picture picture,
int field)
Copy an existing picture and set it on this item. |
DcImageIcon |
createIcon()
The icon used to represent this item. |
void |
delete(boolean validate)
Permanently deletes the item. |
void |
destroy()
|
boolean |
equals(java.lang.Object o)
|
protected void |
executeRequests(boolean saveSuccessful)
|
protected void |
finalize()
|
void |
flushImages()
Frees the resources hold by this items pictures. |
java.util.List<DcObject> |
getChildren()
Retrieves the child objects belonging to this item. |
java.util.List<DcObject> |
getCurrentChildren()
Gets the children as they have been currently set (without reloading them). |
int |
getDatabaseFieldCount()
Retrieves the database column count. |
java.lang.String |
getDatabaseFieldName(int index)
Retrieves the database column name. |
int |
getDefaultSortFieldIdx()
The default sort field index. |
int |
getDisplayFieldIdx()
Educated guess.. |
java.lang.String |
getDisplayString(int index)
Gets the display value for the specified field. |
java.lang.String |
getExternalReference(java.lang.String type)
|
DcField |
getField(int index)
Retrieves the field |
int[] |
getFieldIndices()
Retrieves all field indices. |
java.util.Collection<DcField> |
getFields()
Retrieves all fields belonging to this object . |
int |
getFieldType(int index)
Retrieves the field type. |
DcField |
getFileField()
|
java.lang.String |
getFilename()
Retrieves the filename value. |
DcImageIcon |
getIcon()
|
java.lang.String |
getID()
The internal ID |
java.lang.String |
getLabel(int index)
|
int |
getMaxFieldLength(int index)
Retrieves the maximum field / value length. |
DcModule |
getModule()
Retrieves the module to which this object belongs. |
java.lang.String |
getName()
Returns the name of this object based on the field settings. |
java.lang.String |
getNormalizedString(int index)
|
java.util.Collection<DcField> |
getNotSearchableFields()
Retrieves all fields on which cannot be searched. |
java.lang.String |
getParentID()
Retrieves the ID of the parent of this object. |
int |
getParentReferenceFieldIndex()
Retrieves the index of the field which is used to hold the link to the parent. |
Requests |
getRequests()
Retrieves all the requests. |
int |
getSystemDisplayFieldIdx()
|
java.lang.String |
getTableName()
The database table name. |
java.lang.String |
getTableShortName()
|
java.lang.Object |
getValue(int index)
Retrieves the value for the specified field. |
protected DcValue |
getValueDef(int index)
|
java.util.Map<java.lang.Integer,DcValue> |
getValues()
Retrieves the value objects. |
int |
hashCode()
|
boolean |
hasPrimaryKey()
Is this object capable of storing IDs? In most cases the answer should be yes. |
void |
initializeImages()
Loads the actual image / picture information. |
void |
initializeReferences()
Loads the actual reference information. |
void |
initializeReferences(int index,
boolean full)
|
boolean |
isChanged()
Checks whether the object holds unchanged values. |
boolean |
isChanged(int index)
Checks whether the specified field holds a changed value. |
boolean |
isDestroyed()
|
boolean |
isEnabled(int index)
Indicates whether the field is enabled. |
boolean |
isFilled(int index)
Does this field contains a value? |
boolean |
isLastInLine()
Indicates the item is last in line of a save or delete action. |
boolean |
isLoaded()
|
boolean |
isNew()
|
boolean |
isRequired(int index)
Checks whether the field is marked as required. |
boolean |
isSearchable(int index)
Indicates whether the specified field can be searched on. |
void |
isUnique()
Checks if the item is unique. |
boolean |
isUpdateGUI()
Indicates whether ANY interface updates should be performed. |
void |
load(int[] fields)
Loads the item from the database. |
void |
loadChildren(int[] fields)
Load all children. |
void |
markAsChanged()
Marks the object as changed. |
void |
markAsUnchanged()
Mark all fields as unchanged. |
void |
merge(DcObject dco)
Merges the values of this and the source item. |
void |
release()
Unloads this items. |
void |
reload()
|
void |
removeChildren()
Remove all children from this object |
void |
removeRequests()
Clears the requests. |
void |
saveNew(boolean queued)
Inserts the item into the database. |
void |
saveUpdate(boolean queued)
Save the changed item to the database. |
void |
saveUpdate(boolean queued,
boolean validate)
Save the changed item to the database. |
void |
setChanged(int index,
boolean b)
Manually mark a field as changed |
void |
setChildren(java.util.Collection<DcObject> children)
|
void |
setIDs()
|
void |
setLastInLine(boolean lastInLine)
Indicates the item is last in line of a save or delete action. |
void |
setLoanInformation()
Update the loan information. |
void |
setLoanInformation(Loan loan)
Update the loan information based on the supplied loan object. |
void |
setNew(boolean b)
|
void |
setUpdateGUI(boolean updateGUI)
Indicate whether ANY interface updates should be performed. |
void |
setValidate(boolean validate)
Indicates if validation should take place when the item is saved. |
void |
setValue(int index,
java.lang.Object o)
Sets a value on this object. |
void |
setValueForColumn(java.lang.String column,
java.lang.Object value)
Set the value using the database field name as key. |
void |
setValueForName(java.lang.String sysName,
java.lang.Object value)
Set the value using the system name of the field. |
void |
setValueLowLevel(int index,
java.lang.Object o)
Applies the value directly on this item. |
java.lang.String |
toString()
|
protected void |
validateRequiredFields()
|
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.util.Collection<DcObject> children
public static final int _ID
public static final int _SYS_MODULE
public static final int _SYS_AVAILABLE
public static final int _SYS_LENDBY
public static final int _SYS_LOANDURATION
public static final int _SYS_CREATED
public static final int _SYS_MODIFIED
public static final int _SYS_SERVICE
public static final int _SYS_SERVICEURL
public static final int _SYS_FILEHASH
public static final int _SYS_FILESIZE
public static final int _SYS_FILENAME
public static final int _SYS_FILEHASHTYPE
public static final int _SYS_CONTAINER
public static final int _SYS_DISPLAYVALUE
public static final int _SYS_LOANDUEDATE
public static final int _SYS_LOANDAYSTILLOVERDUE
public static final int _VALUE
public static final int _SYS_EXTERNAL_REFERENCES
Constructor Detail |
---|
public DcObject(int module)
module
- Method Detail |
---|
public boolean isLastInLine()
public void setLastInLine(boolean lastInLine)
public boolean isUpdateGUI()
public void setUpdateGUI(boolean updateGUI)
public boolean isLoaded()
public void reload()
public void load(int[] fields)
public int getSystemDisplayFieldIdx()
public boolean isDestroyed()
public int getDisplayFieldIdx()
public int getDefaultSortFieldIdx()
public java.lang.String getName()
public boolean hasPrimaryKey()
public void removeRequests()
public java.util.Map<java.lang.Integer,DcValue> getValues()
public void setValueForColumn(java.lang.String column, java.lang.Object value)
column
- value
- public void setValueForName(java.lang.String sysName, java.lang.Object value)
sysName
- value
- public java.lang.String getExternalReference(java.lang.String type)
public void addExternalReference(java.lang.String type, java.lang.String key)
type
- The type of the keykey
- The external key / IDpublic Requests getRequests()
public java.lang.String getTableName()
public java.lang.String getTableShortName()
public int getDatabaseFieldCount()
public java.lang.String getLabel(int index)
public void initializeImages()
public void initializeReferences(int index, boolean full)
public void initializeReferences()
public void addRequest(IRequest request)
request
- public boolean isFilled(int index)
index
- public void removeChildren()
public void setNew(boolean b)
public boolean isNew()
public void loadChildren(int[] fields)
public void setChildren(java.util.Collection<DcObject> children)
public void addChild(DcObject child)
public java.util.List<DcObject> getChildren()
public java.util.List<DcObject> getCurrentChildren()
public java.lang.String getParentID()
public int getParentReferenceFieldIndex()
public DcImageIcon getIcon()
public DcImageIcon createIcon()
public DcField getFileField()
public java.lang.String getFilename()
public DcModule getModule()
public java.util.Collection<DcField> getFields()
public void markAsUnchanged()
#load()
)
public void setLoanInformation()
public void setLoanInformation(Loan loan)
protected void beforeSave() throws ValidationException
ValidationException
public void flushImages()
public void setValue(int index, java.lang.Object o)
index
- The field index.o
- The value to be set.public void setValueLowLevel(int index, java.lang.Object o)
index
- The field index.o
- The value to be set.public void markAsChanged()
public boolean isChanged()
DcValue.isChanged()
public boolean isChanged(int index)
index
- The field indexDcValue.isChanged()
public void setChanged(int index, boolean b)
index
- The field indexb
- Changed true / falseDcValue.isChanged()
public boolean isEnabled(int index)
index
- DcFieldDefinitions
,
DcField.isEnabled()
public boolean isRequired(int index)
index
- The field indexDcFieldDefinitions
public boolean isSearchable(int index)
index
- The field indexpublic java.lang.String getID()
public java.util.Collection<DcField> getNotSearchableFields()
public void release()
public void destroy()
public void clearValues()
nochecks
- Just do it, do not check whether we are dealing with an edited itempublic int getMaxFieldLength(int index)
index
- The field indexpublic java.lang.Object getValue(int index)
index
- The field index.public java.lang.String getNormalizedString(int index)
public java.lang.String getDisplayString(int index)
index
- The field index_SYS_DISPLAYVALUE
public int getFieldType(int index)
index
- The field index.ComponentFactory
public java.lang.String getDatabaseFieldName(int index)
index
- The field index.
public void applyEnhancers(boolean update)
update
- Indicates if the item is new or existing.ValueEnhancers
public void saveNew(boolean queued) throws ValidationException
queued
- Indicates if the item should be saved using the query queue.
ValidationException
Query
,
DatabaseManager
,
QueryQueue
public void saveUpdate(boolean queued) throws ValidationException
queued
- Indicates if the item should be saved using the query queue.
ValidationException
Query
,
DatabaseManager
,
QueryQueue
public void saveUpdate(boolean queued, boolean validate) throws ValidationException
queued
- Indicates if the item should be saved using the query queue.validate
- Indicates if the item should be validated before saving.
ValidationException
Query
,
DatabaseManager
,
QueryQueue
public void delete(boolean validate) throws ValidationException
ValidationException
protected void beforeDelete() throws ValidationException
ValidationException
public void setValidate(boolean validate)
public DcField getField(int index)
index
- Field indexpublic void checkIntegrity() throws ValidationException
update
- Indicates if the item is new or not.
ValidationException
public void isUnique() throws ValidationException
o
- The item to be checked.update
- Indicates if the item is new or not.
ValidationException
public int[] getFieldIndices()
public void setIDs()
protected DcValue getValueDef(int index)
protected void executeRequests(boolean saveSuccessful)
protected void validateRequiredFields() throws ValidationException
ValidationException
public void merge(DcObject dco)
dco
- The source item.public void copy(DcObject dco, boolean overwrite, boolean allowDeletes)
overwrite
- Indicates whether existing values should be overwritten.allowDeletes
- Allows existing values to be cleared.dco
- Source item.public void applyTemplate()
public void applyTemplate(DcTemplate template)
public void copyImage(Picture picture, int field)
public DcObject clone()
clone
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int compareTo(DcObject o)
compareTo
in interface java.lang.Comparable<DcObject>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |