|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.udo.cs.miningmart.m4.core.M4Object
edu.udo.cs.miningmart.m4.core.M4Data
Superclass for all M4 Data objects (as opposed to operators).
Field Summary | |
protected Docu |
myDocumentation
|
Fields inherited from class edu.udo.cs.miningmart.m4.core.M4Object |
myId, myName |
Fields inherited from interface edu.udo.cs.miningmart.m4.utils.M4Table |
NOT_NULL |
Constructor Summary | |
M4Data(DB m4Db)
Construct a new M4 Data object. |
Method Summary | |
protected void |
deleteLocal()
This method is called after the generic delete and can be overridden to delete related objects stored in cross-tables etc. |
void |
deleteSoon()
The method to delete all references of an M4Data
object and to remove the tuple(s) representing the object
from the M4 database.
|
java.util.Collection |
exportLocal(java.io.Writer out,
java.util.Collection dependent)
This method is called during exporting objects. |
java.lang.Object |
genericGetter(java.lang.String nameOfGetter)
This method is used by the generic store method for M4Data objects.
|
void |
genericSetter(java.lang.String nameOfSetter,
java.lang.Class parameterClassOfSetter,
java.lang.Object objectToSet)
This method is used by the autoLoad facility for M4Data objects.
|
java.util.Collection |
getDependentObjects()
This method is part of the XML-serialization and needs to be implemented by all M4Data sub-classes that need to be serialized. |
java.lang.String |
getDocumentation()
Returns the description String for this M4 object. |
protected abstract java.util.Collection |
getObjectsInNamespace(java.lang.Class typeOfObjects)
This method returns the objects of the specified type that form a namespace in the scope of this M4Data object. |
java.util.Collection |
getObjectsReferencingMe(java.lang.Class theClass)
This is a service method for container objects loading their M4Data
objects. |
java.util.Collection |
getObjectsReferencingMe(java.lang.Class theClass,
java.lang.String foreignKey)
This is a service method for container objects loading their M4Data
objects. |
java.lang.String |
getObjectTag()
|
java.lang.String |
getValidName(java.lang.String name,
java.lang.Class typeOfNamedObject)
|
java.lang.String |
getXmlIdTag()
|
java.lang.String |
getXmlVersion()
|
boolean |
hasDeleteStatus()
Method added by T. |
void |
importLocal(java.lang.String tag,
java.lang.String embedded)
Method for importing local fields (recognized by unknown tags) from XML. |
boolean |
isDirty()
Check if this object reflects the state of the database or if the object needs to be written back to the database at the next store command. |
boolean |
isWaitingForDelete()
Indicates if this object's representation will be deleted in the database at the next update operation. |
Docu |
primitiveGetDocObject()
|
void |
primitiveSetDocObject(Docu doc)
|
void |
readFromDb()
This implementation of load(long) is a generic one, making use
of the information available for objects implementing the M4Table
interface. |
protected void |
readFromDbLocal()
This method allows for reading associated objects from cross-tables etc. |
protected abstract void |
removeAllM4References()
This method needs to be implemented by all M4Data
objects. |
protected void |
removeDocObject()
|
void |
removeFromDb()
This method removes the tuple representing this object from the database and from the M4 cache. |
static void |
removeSetFromDb(java.util.Collection objectsToDelete)
Helper method of DB.updateDatabase(): Calls the instance method of objects to remove themself from the database for all objects in the specified collection. |
protected void |
setDirty()
Sets the internal flag of this object indicating that it needs to be updated in the database at the next store command. |
void |
setDocumentation(java.lang.String text)
Sets the description String for this M4 object. |
void |
setId(long newId)
Overrides the super-method just to set the dirty-flag |
void |
setName(java.lang.String n)
Overrides the super-method just to set the dirty-flag |
protected void |
storeLocal()
This method is called after the generic storing and can be overridden to store related objects to cross-tables etc. |
static java.util.Collection |
updateObjectsFromTable(java.lang.String dbTableName)
Helper method of DB.updateDatabase(): For the specified table this method calls the instance methods of the corresponding dirty M4Data objects. |
Methods inherited from class edu.udo.cs.miningmart.m4.core.M4Object |
compareTo, doPrint, doPrint, equals, executeBusinessSingleValueSqlRead, executeBusinessSingleValueSqlReadL, executeBusinessSqlRead, executeBusinessSqlWrite, executeM4SingleValueSqlRead, executeM4SingleValueSqlReadL, executeM4SqlRead, executeM4SqlWrite, getCasePrintObject, getId, getM4Db, getM4ObjectFromCache, getName, getNextM4SequenceValue, isNew, load, print, putM4ObjectToCache, replaceSpacesInName |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface edu.udo.cs.miningmart.m4.utils.M4Table |
getIdAttributeName, getM4Info, getM4TableName |
Field Detail |
protected Docu myDocumentation
Constructor Detail |
public M4Data(DB m4Db)
m4Db
- The DB object that is used in the current
compiler thread.miningmart.operator.utils.DB
Method Detail |
public void readFromDb() throws M4Exception
load(long)
is a generic one, making use
of the information available for objects implementing the M4Table
interface. The query is composed automatically from the M4 table name and the
ID of this object, the ResultSet
is analysed and the setter methods
specified by getM4Info()
are called exploiting self-reflection.
All fields not loaded by this load method should be read on demand by active getters.
readFromDb
in class M4Object
M4Exception
protected void readFromDbLocal() throws M4Exception
M4Exception
public boolean isDirty()
public boolean isWaitingForDelete()
protected void setDirty()
public void setId(long newId) throws M4Exception
setId
in interface M4Object
setId
in class M4Object
newId
- The new id for this M4 object.
M4Exception
M4Object.setId(long)
public void setName(java.lang.String n)
setName
in interface M4Object
setName
in class M4Object
n
- The new name.M4Object.setName(String)
protected abstract java.util.Collection getObjectsInNamespace(java.lang.Class typeOfObjects) throws M4Exception
null
. If a namespace could
exist but doesn't, an empty Collection is returned.
typeOfObjects
- the type of objects that form the namespace
typeOfObjects
,
or null
.
M4Exception
public java.lang.String getValidName(java.lang.String name, java.lang.Class typeOfNamedObject) throws M4Exception
M4Exception
edu.udo.cs.miningmart.m4.M4Data#getValidName(String)
public void deleteSoon() throws M4Exception
M4Data
object and to remove the tuple(s) representing the object
from the M4 database.
After calling the method removeAllM4References()
this method sets an internal flag indicating that it needs to be
deleted at the next store command. This includes setting the
dirty flag.
M4Exception
protected abstract void removeAllM4References() throws M4Exception
M4Data
objects. It has to remove all references to other
M4Object
s.
M4Exception
public java.util.Collection getObjectsReferencingMe(java.lang.Class theClass) throws M4Exception
M4Data
objects. This method is called with the type of contained objects as the parameter.
theClass
- the class of the embedded objects
Collection
of M4Data
objects of the specified
class. The Collection
contains all those objects of this type
referencing this
parameter by ID with a database attribute explicitly
listed in the M4Info
. This method also works when cross-tables need
to be used.
M4Exception
public java.util.Collection getObjectsReferencingMe(java.lang.Class theClass, java.lang.String foreignKey) throws M4Exception
M4Data
objects. In contrast to the method without the foreign key attribute name as a
parameter this method is just to be called if there is no exception to the generic
case of loading (e.g. no cross-tables).
theClass
- the class object of objects to be returnedforeignKey
- the name of the foreign key attribute in the database
realising the references to objects of the type of m4d
Collection
of objects referencing this
object
M4Exception
M4Data#getObjectsReferencing(M4Data)
public void genericSetter(java.lang.String nameOfSetter, java.lang.Class parameterClassOfSetter, java.lang.Object objectToSet) throws M4Exception
M4Data
objects.
By making use of self-reflection setters do not have to be activated directly,
but they can also be addressed by their name and the type of parameter they
expect.
nameOfSetter
- the name of the setter method is to be specified hereparameterClassOfSetter
- the class object of the target method's
only parameterobjectToSet
- the object that is set using the setter specified by
the other two parameters
M4Exception
- if no method with the given name or signature exists,
or if an InvocationTargetException
or
IllegalAccessException
occurs.public java.lang.Object genericGetter(java.lang.String nameOfGetter) throws M4Exception
M4Data
objects.
By making use of self-reflection getters do not have to be activated directly.
Only getters without any parameters are supported by this method.
nameOfGetter
- the name of the getter method is to be specified here
M4Exception
- if no method expecting no parameters with the given name
exists, or if an InvocationTargetException
or
IllegalAccessException
occurs.public java.lang.String getDocumentation() throws M4Exception
null
if none exists
M4Exception
public void setDocumentation(java.lang.String text) throws M4Exception
text
- The description String to set
M4Exception
public Docu primitiveGetDocObject()
public void primitiveSetDocObject(Docu doc)
protected void removeDocObject() throws M4Exception
M4Exception
protected void storeLocal() throws M4Exception
M4Exception
protected void deleteLocal() throws M4Exception
M4Exception
public static java.util.Collection updateObjectsFromTable(java.lang.String dbTableName) throws M4Exception
M4Data
objects. If there are references
between objects of the same table then these references are solved by
analyzing the dependencies. If there are cyclic dependencies, then an
M4Exception
is thrown.
Collection
of the objects to be deleted later on.
M4Exception
public static void removeSetFromDb(java.util.Collection objectsToDelete) throws M4Exception
M4Exception
public void removeFromDb() throws M4Exception
DB.updateDatabase()
!
M4Exception
public boolean hasDeleteStatus() throws M4Exception
M4Exception
public java.lang.String getXmlVersion()
XmlInfo.getXmlVersion()
public java.lang.String getXmlIdTag()
XmlInfo.getXmlIdTag()
public java.lang.String getObjectTag()
XmlInfo.getXmlIdTag()
public java.util.Collection getDependentObjects() throws M4Exception
M4Data
sub-classes that need to be serialized.
Collection
of all M4Data
Java objects
holding a foreign key reference to this
object.
This method must never return null
.
M4Exception
public java.util.Collection exportLocal(java.io.Writer out, java.util.Collection dependent) throws M4Exception, java.io.IOException
String
in the collection, starting with openning and ending with the closing tag.
If the object to be stored needs to be serialized itself (as a separate object),
then the method export
of that method needs to be used, which
needs to have the specified Writer
and Collection
as parameters. The parameters should never be used in any other way!
out
- a Writer
to be passed to export
methods of embedded objectsdependent
- a Collection
to be passed to
export
methods of embedded objects
Collection
of XML-String
s specifying
the additional attributes of this object
M4Exception
java.io.IOException
public void importLocal(java.lang.String tag, java.lang.String embedded) throws XmlException, M4Exception
tag
- the tag indicating the local field to be importedembedded
- the String
between the opening and closing tag
XmlException
M4Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |