|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface HydrateObject
This is an optional base interface for Hydrate objects and specifies a set of services that need to be supported by an object to fully operate as part of the hydrate framework. Objects that are part of the model are not required to support this interface and business interfaces that represent the data model must not inherit from this interface. The code will test to see if an object it has been asked to use supports the interface and if not it will be proxied into doing so. You are however encouraged to use the code generated objects, all of which do support this interface since the framework will operate more efficiently with these objects. Supporting the interface directly avoids the overhead of having to create a proxy for each object when it is used by the framework. The methods on this base interface fall into three categories: those that store 'shadow' information about the object such as whether it has been persisted to a database, those that present functionality that is available elsewhere in a more efficient or convenient manner, such as methods to retrieve keys, determine whether attributes are populated or update attributes by name, and those that are part of the persistence framework, such as 'save' or 'writeAttributesXML'.
Field Summary | |
---|---|
static int |
ATTR_MANDATORY
|
static int |
ATTR_MULTIPLE
|
static int |
ATTR_MULTIPLEOPTIONAL
|
static int |
ATTR_NONE
|
static int |
ATTR_OPTIONAL
|
static short |
saveALL
|
static short |
savePOST
|
static short |
savePRE
|
static short |
STATECHANGED
|
static short |
STATEPOSTSAVE
|
static short |
STATEPRESAVE
|
static short |
STATEUNCHANGED
|
static short |
STATEUPDATING
|
Method Summary | |
---|---|
int |
attributeType(java.lang.String localName)
Determine if a particular string represents the name of a valid attribute. |
void |
forget()
Discard this object. |
ObjectContext |
getContext()
|
java.lang.String |
getDiscriminator()
|
java.lang.Class |
getFamily()
Gets the family class associated with this object. |
java.lang.Class |
getImplementedIfc()
Each business object concrete class implements a particular business object interface. |
ObjectKey |
getKey(java.lang.Class keyCls)
|
boolean |
isChanged()
|
boolean |
isFieldPopulated(java.lang.String id)
This call can be used to determine if a field is populated and presents an alternative to catching the NotPopulatedException that is thrown when accessing such fields |
boolean |
isPersisted()
Determine if the object is persisted in the database. |
boolean |
isPreSaving()
|
boolean |
isRemoved()
Determine if a request has been made to remove the object from the database |
boolean |
isUpdating()
|
void |
mergeDown(java.lang.Object object)
Merge the given object into this object. |
void |
save(SaveContext ctx)
This method is called by users of this business object to persist it in a persistent store. |
void |
save(SaveContext ctx,
short saveType)
This method should be overridden in derived classes to save this object in a persistent store. |
void |
setAttrFromString(java.lang.String localName,
java.lang.String data)
Set an attribute from a string representation of the attribute. |
void |
setClean()
Set the object to a 'clean' state. |
void |
setContext(ObjectContext ctx)
Set the object context associated with the object |
void |
setDirty()
Set the object to a 'dirty' state. |
void |
setNotPersisted()
Call this method to indicate that the object has not been persisted in a database. |
void |
setPersisted()
Call this method to indicate that the object has been persisted in a database. |
void |
setPostSaving()
Set the object to a state indicating that it is finishing the update process on an object |
void |
setPreSaving()
Set the object to a state indicating that it has been partially updated |
void |
setRemoved(boolean removed)
Mark this object as having been deleted from the database. |
void |
writeAttributesXML(XMLElementWriterParser writerParser,
java.lang.String prefix,
java.lang.String[] failIfNotPop,
java.lang.String[] excludeAttrs)
Write all attributes to an XML stream |
Field Detail |
---|
static final short STATEUNCHANGED
static final short STATECHANGED
static final short STATEUPDATING
static final short STATEPRESAVE
static final short STATEPOSTSAVE
static final short saveALL
static final short savePRE
static final short savePOST
static final int ATTR_NONE
static final int ATTR_MANDATORY
static final int ATTR_OPTIONAL
static final int ATTR_MULTIPLE
static final int ATTR_MULTIPLEOPTIONAL
Method Detail |
---|
boolean isChanged()
boolean isUpdating()
boolean isPreSaving()
void setPreSaving()
void setPostSaving()
void setClean()
isChanged
will subsequently
return false unless the object is not in the database. isUpdating
will subsequently return false.
void setDirty()
isChanged
will subsequently
return true.
boolean isFieldPopulated(java.lang.String id)
void save(SaveContext ctx) throws SaveException
SaveException
void save(SaveContext ctx, short saveType) throws SaveException
saveType
- determines how much of the object to save. This is needed
when business objects are recursively saving business objects that they
contain or reference. It is important to defer the saving of all many-to-many
and one-to-many relationships to the end of the save process. The valid values
are saveALL to save the entire object, savePRE to save many-to-one relationships
and the object itself - these relationships must be saved before the main object
cos it will need primary keys for the referenced objects. savePOST saves
one-to-many and many-to-many relationships and marks the object as clean.
SaveException
void writeAttributesXML(XMLElementWriterParser writerParser, java.lang.String prefix, java.lang.String[] failIfNotPop, java.lang.String[] excludeAttrs) throws org.xml.sax.SAXException
writerParser
- the writer parser that has information about the stream being written to.prefix
- a text prefix if the elements are being flattenedfailIfNotPop
- true to fail the write (with a SAX exception) if one or more attributes are not populatedexcludeAttrs
- a list of field names to be excluded
org.xml.sax.SAXException
int attributeType(java.lang.String localName)
localName
- the name of the attribute
ATTR_MANDATORY
if the parameter is a mandatory attribute,
ATTR_OPTIONAL
for an optional attribute and ATTR_NONE
for an invalid attribute namevoid setAttrFromString(java.lang.String localName, java.lang.String data)
localName
- the name of the attributedata
- the string data to be parsed or null if the value is to be
set to 'Not Set'void forget()
ObjectKey getKey(java.lang.Class keyCls)
java.lang.String getDiscriminator()
void setPersisted()
void setNotPersisted()
boolean isPersisted()
ObjectContext getContext()
void setContext(ObjectContext ctx)
ctx
- the new contextjava.lang.Class getImplementedIfc()
this.getKey().getKeyClass()
since the key class is always the base business class and this
method returns the actual interface that is being implemented.
java.lang.Class getFamily()
void mergeDown(java.lang.Object object)
object
- the object to merge.void setRemoved(boolean removed)
boolean isRemoved()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |