org.histpop.server.objects
Class PersistentObject
java.lang.Object
org.histpop.server.objects.ServerObject
org.histpop.server.objects.PersistentObject
- All Implemented Interfaces:
- ServerObj
- Direct Known Subclasses:
- AssociatedContent, Bibliography, BibliographyType, Category, MasterNumber, Page, ProjectObject, ResourceCode, ResourceType, Section, UserObject
public class PersistentObject
- extends ServerObject
Methods inherited from class org.histpop.server.objects.ServerObject |
addMethod, getMethod, getMethodList, getProperties, getProperty, getType, init, isReadOnly, setID, setProperties, setProperty, setType, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
PersistentObject
public PersistentObject()
PersistentObject
public PersistentObject(java.lang.String id)
setRepository
public void setRepository(Repository r)
getRepository
public Repository getRepository()
getRepository
public static Repository getRepository(java.lang.String type)
getStatements
public java.util.Hashtable getStatements()
throws ServerException
- Throws:
ServerException
load
public void load()
throws ServerException
- Throws:
ServerException
delete
public void delete()
throws ServerException
- Throws:
ServerException
save
public void save()
throws ServerException
- Throws:
ServerException
insert
public void insert()
throws ServerException
- Throws:
ServerException
setPrimaryKey
protected void setPrimaryKey(java.lang.String[] key)
throws ServerException
- Throws:
ServerException
getPrimaryKey
public java.lang.String[] getPrimaryKey()
getID
public java.lang.String getID()
- Overrides:
getID
in class ServerObject
list
public Bag list()
throws ServerException
- Returns a list of all objects in the database in sortfield order.
Note that this is preparedSQL so runs (slightly) faster than the Filter method
- Throws:
ServerException
filter
public java.util.Vector filter(java.lang.String filter)
throws ServerException
- Returns a list of all objects in the database meeting the filter criteria.
Filter is an SQL WHERE clause, without the WHERE.
Note that this is preparedSQL so runs (slightly) faster than the Filter method
- Throws:
ServerException
getPropertyNames
public java.util.Vector getPropertyNames()
Update
public ServerObj Update(ServerContext ctx)
throws ServerException
- Throws:
ServerException
init
public void init(SQLRepository repository,
java.lang.String table,
java.lang.String type,
java.lang.String sortfield)
throws ServerException
- Throws:
ServerException
getFieldList
public java.util.Vector getFieldList()
- Overrides:
getFieldList
in class ServerObject
getIntegerProperty
public java.lang.Integer getIntegerProperty(java.lang.String fieldName)
- Get an integer field property from this persistent object.
Note that aggregated SQL fields from e.g. the COUNT function
return java.lang.Long on Linux, but java.lang.Integer on Windows XP,
so we'd better be prepared for all the different OS flavors.
Also, MySQL 5.x always seems to return java.math.BigInteger
for integer values in result sets, unlike MySQL 4.x.
- Parameters:
fieldName
- The name of the wanted field property
- Returns:
- The integer value of the field
getBooleanProperty
public java.lang.Boolean getBooleanProperty(java.lang.String fieldName)
- Get a Boolean field property from this persistent object.
Boolean types can also be represented as integer values
in the underlying SQL database. If that is the case
do a conversion into a Boolean value.
- Parameters:
fieldName
- The name of the wanted field property
- Returns:
- The Boolean value of the field
destroy
public void destroy()