| java.lang.Object org.openharmonise.rm.resources.AbstractObject
All known Subclasses: org.openharmonise.rm.resources.AbstractEditableObject, org.openharmonise.rm.metadata.Profile,
AbstractObject | abstract public class AbstractObject implements Cloneable,Comparable,Publishable,DataStoreObject,CacheableObject(Code) | | The abstract class for the core objects of Harmonise, handling the very basic data handling for data such as
system identifiers, name and summary and incorporating core functionality to be built on
by implementing classes.
author: Michael Bell version: $Revision: 1.5 $ |
Constructor Summary | |
public | AbstractObject() Constructs a new or anonymous instance without an interface
to the database. | public | AbstractObject(AbstractDataStoreInterface con) Standard constructor for a new or anonymous resource,
registering an AbstractDataStoreInterface to use
with all database communications. | public | AbstractObject(AbstractDataStoreInterface con, boolean bIsHist) Standard constructor for a new or anonymous historical resource,
registering an AbstractDataStoreInterface to use with all
database communications. | public | AbstractObject(AbstractDataStoreInterface con, int nId) Standard constructor for an existing resource,
registering an AbstractDataStoreInterface to use
with all database communications. | public | AbstractObject(AbstractDataStoreInterface con, int nId, int nKey, boolean bIsHist) Standard constructor for an existing resource which may be historical. |
Method Summary | |
public void | addCacheListener(CacheListener listener) | protected void | addColumnsToPopulateQuery(SelectStatement select, boolean bIsHist) Adds columns to the select query for population of the object. | public void | clear() Clears all data contained in object, the object does however
retain its id. | public Object | clone() | public int | compareTo(Object obj) | public boolean | equals(Object obj) | public boolean | exists() Returns true if this resource exists in the database. | protected void | fullPopulate() Ensures that this object is fully poplated from the database. | public List | getCacheListeners() | public static ColumnRef | getColumnRef(AbstractObject obj, String sColumn) Returns a column reference appropriate for the given
AbstractObject and column name. | public static ColumnRef | getColumnRef(String sClassname, String sColumn) Returns a column reference appropriate for the given
AbstractObject and column name. | public static ColumnRef | getColumnRef(String sClassname, String sColumn, boolean bHist) Returns a column reference appropriate for the given
parameters. | protected static Collection | getCoreColumnRefs(String sClassname) | abstract public String | getDBTableName() | public AbstractDataStoreInterface | getDataStoreInterface() Returns the datastore interface associated with this object. | protected String | getHistoricalDBTableName() Returns the historical table name for this object. | public int | getId() Returns the object id. | public ColumnRef | getInstanceColumnRef(String sColumn, boolean bIsHist) | public int | getKey() | public String | getName() Returns the object name. | protected static ColumnRef | getObjectColumnRef(String sDBTable, String sColumn) Returns a column reference of the correct type given the table and column
identifier. | public String | getSummary() Returns the object summary. | public static String | getTableName(String sClassname, boolean bHist) Returns the table name for the object of the class name given, taking account
for whether the historical table is needed or not. | protected String | getTableName(boolean bIsHist) Returns the database table name for an object of this object's type. | public String | getType() Returns the object type (default class name) for this object. | public int | hashCode() | public boolean | isChanged() Returns true if this object's data has been changed (as
compared to the data held in the database). | public boolean | isHistorical() Returns true if this object is a historical object. | abstract protected boolean | isKeySupported() Returns true if this object has a unique identifier key
as well as the identifier attribute.
Note: This depends on how historical versions of this object are
handled. | protected boolean | isPopulated() Returns true if object has been populated. | protected void | markAsNew() Marks an object as a new object, correctly setting all of the
appropriate flags. | public void | notifyCacheListeners() | public void | populate(Element xmlElement, State state) | protected synchronized void | populateFromDatabase() Populates this object's core data from the database. | protected void | populateFromResultSetRow(ResultSet rs, SelectStatement select) Populates this object from the given result set. | public Element | publish(Template template, HarmoniseOutput xmlDoc, State state) | public Element | publish(Element topEl, HarmoniseOutput xmlDoc, State state) | public void | removeCacheListener(CacheListener listener) | public void | setDataStoreInterface(AbstractDataStoreInterface dsi) Sets the data store interface for this object if this object does not already
have an interface to the data store.
Note: This method is a convenience method for objects created with the empty
constructor, changing the data store interface on an existing object could lead
to unpredictable behaviour. | public void | setHistorical(boolean bIsHistorical) Sets whether this object is historical. | public void | setId(int nId) Set method for id, here for completeness, should use constructor.
Note: Once an object's id has been assigned within the framework it can not
be reassigned. | public void | setIsChanged(boolean bIsChanged) Sets the object changed flag. | public void | setKey(int nKey) Sets the object's unique identifier key. | public void | setName(String sName) Sets the object name. | public void | setSummary(String sSummary) Set the object summary. | public void | setType(String type) Sets the type (default class name) for this object. |
ATTRIB_HISTORICAL | final public static String ATTRIB_HISTORICAL(Code) | | Historical attribute
|
ATTRIB_ID | final public static String ATTRIB_ID(Code) | | Object id attribute name
|
ATTRIB_KEY | final public static String ATTRIB_KEY(Code) | | Object key attribute name
|
ATTRIB_NAME | final public static String ATTRIB_NAME(Code) | | Object name attribute name
|
ATTRIB_OBJECT_TYPE | final public static String ATTRIB_OBJECT_TYPE(Code) | | Alternative object type attribute
|
ATTRIB_TYPE | final public static String ATTRIB_TYPE(Code) | | Object type attribute name
|
CLMN_ID | final protected static String CLMN_ID(Code) | | Id database column name
|
CLMN_NAME | final protected static String CLMN_NAME(Code) | | Object name column name
|
CLMN_SUMMARY | final protected static String CLMN_SUMMARY(Code) | | Object summary column name
|
EXT_HIST | final public static String EXT_HIST(Code) | | Historical extension for database table names
|
NOTDBSAVED_ID | final public static int NOTDBSAVED_ID(Code) | | Constant for a unsaved identifier
|
NOTDBSAVED_KEY | final public static int NOTDBSAVED_KEY(Code) | | Constant for a unsaved object key
|
TAG_HARMONISE_OBJECT | final public static String TAG_HARMONISE_OBJECT(Code) | | HarmoniseObject XML tag name
|
TAG_LINK | final public static String TAG_LINK(Code) | | Link tag name
|
TAG_LINK_IMAGE | final public static String TAG_LINK_IMAGE(Code) | | Link image tag name
|
TAG_LINK_TEXT | final public static String TAG_LINK_TEXT(Code) | | Link text tag name
|
TAG_NAME | final public static String TAG_NAME(Code) | | Name tag name
|
TAG_SUMMARY | final public static String TAG_SUMMARY(Code) | | Summary tag name
|
m_bIsChanged | protected boolean m_bIsChanged(Code) | | Changed flag, true if this object has been changed
(as compared to the data stored in the database)
|
m_bIsPopulated | protected boolean m_bIsPopulated(Code) | | Populated flag, true if this object has been populated
from the database
|
m_nId | protected int m_nId(Code) | | Object id
|
m_nObjectKey | protected int m_nObjectKey(Code) | | Object key
|
m_sTable | protected String m_sTable(Code) | | The database table containing this object's data
|
m_sType | protected String m_sType(Code) | | Type of object, will be the name of the class this should be
instantiated as by default
|
AbstractObject | public AbstractObject()(Code) | | Constructs a new or anonymous instance without an interface
to the database.
|
AbstractObject | public AbstractObject(AbstractDataStoreInterface con)(Code) | | Standard constructor for a new or anonymous resource,
registering an AbstractDataStoreInterface to use
with all database communications.
Parameters: con - the interface to the database |
AbstractObject | public AbstractObject(AbstractDataStoreInterface con, boolean bIsHist)(Code) | | Standard constructor for a new or anonymous historical resource,
registering an AbstractDataStoreInterface to use with all
database communications.
Parameters: con - the interface to the database |
AbstractObject | public AbstractObject(AbstractDataStoreInterface con, int nId)(Code) | | Standard constructor for an existing resource,
registering an AbstractDataStoreInterface to use
with all database communications.
Parameters: con - the interface to the database Parameters: nId - the id of the resource |
AbstractObject | public AbstractObject(AbstractDataStoreInterface con, int nId, int nKey, boolean bIsHist)(Code) | | Standard constructor for an existing resource which may be historical.
Parameters: con - the interface to the database Parameters: nId - the id of the resource Parameters: nKey - the unique key of the resource Parameters: bIsHist - true if the resource is historical |
addColumnsToPopulateQuery | protected void addColumnsToPopulateQuery(SelectStatement select, boolean bIsHist) throws DataStoreException(Code) | | Adds columns to the select query for population of the object.
Note: this method is used by populateFromDatabase
to construct its query.
Parameters: select - the select statment to add columns to throws: DataStoreException - if an error occurs building the select statement |
clear | public void clear()(Code) | | Clears all data contained in object, the object does however
retain its id.
|
exists | public boolean exists()(Code) | | Returns true if this resource exists in the database.
true if resource exists |
getCacheListeners | public List getCacheListeners()(Code) | | |
getColumnRef | public static ColumnRef getColumnRef(AbstractObject obj, String sColumn) throws DataStoreException(Code) | | Returns a column reference appropriate for the given
AbstractObject and column name.
Parameters: obj - an AbstractObject object Parameters: sColumn - the column, tag or attribute name the column reference corresponding to the object and columnname given throws: DataStoreException - if an error occurs |
getColumnRef | public static ColumnRef getColumnRef(String sClassname, String sColumn) throws DataStoreException(Code) | | Returns a column reference appropriate for the given
AbstractObject and column name.
Parameters: sClassname - the class name of an AbstractObject Parameters: sColumn - the column, tag or attribute name the column reference corresponding to the class name and columnname given throws: DataStoreException - if an error occurs |
getColumnRef | public static ColumnRef getColumnRef(String sClassname, String sColumn, boolean bHist) throws DataStoreException(Code) | | Returns a column reference appropriate for the given
parameters.
Parameters: sClassname - the class name of an AbstractObject Parameters: sColumn - the column, tag or attribute name Parameters: bHist - true if the column reference is associated with a historical object the column reference corresponding to the parameters throws: DataStoreException - if an error occurs |
getCoreColumnRefs | protected static Collection getCoreColumnRefs(String sClassname) throws DataStoreException(Code) | | Returns a collection of column refs representing the object's core data
a collection of column refs representing the object's core data throws: DataStoreException - if an error occurs getting the column references |
getDataStoreInterface | public AbstractDataStoreInterface getDataStoreInterface()(Code) | | Returns the datastore interface associated with this object.
the datastore interface associated with this object |
getHistoricalDBTableName | protected String getHistoricalDBTableName()(Code) | | Returns the historical table name for this object.
the historical table name for this object |
getId | public int getId()(Code) | | Returns the object id.
the id of the object |
getObjectColumnRef | protected static ColumnRef getObjectColumnRef(String sDBTable, String sColumn) throws DataStoreException(Code) | | Returns a column reference of the correct type given the table and column
identifier. The column identifier may be an XML tag.
Parameters: sDBTable - the database table Parameters: sColumn - the column, tag or attribute name the appropriate column reference throws: DataStoreException - if an error occurs throws: InvalidColumnReferenceException - if the given column name isinvalid |
getTableName | public static String getTableName(String sClassname, boolean bHist) throws DataStoreException(Code) | | Returns the table name for the object of the class name given, taking account
for whether the historical table is needed or not.
Parameters: sClassname - the class name of an AbstractObject Parameters: bHist - true if the table name is associated with a historical object the table name for the object throws: DataStoreException - if an error occurs |
getTableName | protected String getTableName(boolean bIsHist)(Code) | | Returns the database table name for an object of this object's type.
Parameters: bIsHist - true if the historical table is needed the database table name for an object of this object's type |
hashCode | public int hashCode()(Code) | | |
isChanged | public boolean isChanged() throws DataAccessException(Code) | | Returns true if this object's data has been changed (as
compared to the data held in the database).
true if this object's data has been changed throws: DataAccessException - if there is an error populating this object |
isHistorical | public boolean isHistorical()(Code) | | Returns true if this object is a historical object.
true if this object is a historical object |
isKeySupported | abstract protected boolean isKeySupported()(Code) | | Returns true if this object has a unique identifier key
as well as the identifier attribute.
Note: This depends on how historical versions of this object are
handled. If all versions of the object need to have the same id, to
allow a consistent logical id, the key is used to identify versions.
true if this object has a unique identifier keyas well as the identifier attribute |
isPopulated | protected boolean isPopulated()(Code) | | Returns true if object has been populated.
true if object has been populated |
notifyCacheListeners | public void notifyCacheListeners()(Code) | | |
populateFromDatabase | protected synchronized void populateFromDatabase() throws PopulateException(Code) | | Populates this object's core data from the database.
throws: PopulateException - if an error occurs getting data from database |
populateFromResultSetRow | protected void populateFromResultSetRow(ResultSet rs, SelectStatement select) throws PopulateException(Code) | | Populates this object from the given result set.
Note: this method must only handle data in the current row
Parameters: rs - the result set Parameters: select - the select statement used to generate the result set throws: PopulateException - if an error occurs getting data from the result set |
setDataStoreInterface | public void setDataStoreInterface(AbstractDataStoreInterface dsi) throws PopulateException(Code) | | Sets the data store interface for this object if this object does not already
have an interface to the data store.
Note: This method is a convenience method for objects created with the empty
constructor, changing the data store interface on an existing object could lead
to unpredictable behaviour. At some point in the future we may support the switching of
datastores such that an object can be populated from one datastore and saved to
another but this is not the case at present.
Parameters: dsi - the data store interface throws: PopulateException - if this object already has a data store interface |
setHistorical | public void setHistorical(boolean bIsHistorical)(Code) | | Sets whether this object is historical.
Parameters: bIsHistorical - The is historical flag |
setId | public void setId(int nId)(Code) | | Set method for id, here for completeness, should use constructor.
Note: Once an object's id has been assigned within the framework it can not
be reassigned. This method should only be used in conjunction with the empty
constructor to create an instance of an object with a specific identifier.
Parameters: nId - The id of the object |
setIsChanged | public void setIsChanged(boolean bIsChanged)(Code) | | Sets the object changed flag.
Parameters: bIsChanged - true to set this object as having been changed |
setKey | public void setKey(int nKey)(Code) | | Sets the object's unique identifier key.
Parameters: nKey - the object's unique identifier key |
setSummary | public void setSummary(String sSummary)(Code) | | Set the object summary.
Parameters: sSummary - the object summary |
setType | public void setType(String type)(Code) | | Sets the type (default class name) for this object.
Parameters: type - the type for this object |
|
|