Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.udo.cs.miningmart.m4.core
Class M4Data

    java.lang.Object
      edu.udo.cs.miningmart.m4.core.M4Object
          edu.udo.cs.miningmart.m4.core.M4Data

All Implemented Interfaces:
  M4Object, M4Table, java.io.Serializable, java.lang.Comparable

Direct Known Subclasses:
  Assertion, Case, Column, Columnset, ColumnsetStatistics, ColumnStatistics1, ColumnStatistics2, ConceptInheritance, Condition, Constraint, Coordinates, Docu, GraphicalM4Object, Key, KeyMember, Operator, OpParam, Parameter, Projection

    public abstract class M4Data

extends M4Object
implements M4Table

Superclass for all M4 Data objects (as opposed to operators).

Version:
  $Id: M4Data.java,v 1.14 2006/09/27 14:59:59 euler Exp $
Author:
  Martin Scholz
See Also:
  Serialized Form

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()`
`protected java.lang.String` | `getUniqueName(java.lang.String name, java.util.Collection nameCollection)`
`java.lang.String` | `getValidName(java.lang.String name, java.lang.Class typeOfNamedObject)`
`protected java.lang.String` | `getValidName(java.lang.String name, java.lang.Class typeOfNamedObject, M4Data exception)`
`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, setNotNew`

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

### myDocumentation

    protected Docu myDocumentation

Constructor Detail

### M4Data

    public M4Data(DB m4Db)

  Construct a new M4 Data object. All such objects have a reference to the DB object that is used in the current compiler thread. Thus this DB object is given here.

  Parameters:
    `m4Db` - The DB object that is used in the current compiler thread.
  See Also:
    `miningmart.operator.utils.DB`

Method Detail

### readFromDb

    public void readFromDb()
                    throws M4Exception

  This implementation of `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.

  Specified by:
    `readFromDb` in class `M4Object`
  Throws:
    `M4Exception`

### readFromDbLocal

    protected void readFromDbLocal()
                            throws M4Exception

  This method allows for reading associated objects from cross-tables etc. while loading. The dirty-flag is reset after executing this method. It should be overriden by classes locally reading additional information from DB at loading time.

  Throws:
    `M4Exception`

### isDirty

    public 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.

  Returns:
    TRUE if the object needs to be stored FALSE if it reflects the database.

### isWaitingForDelete

    public boolean isWaitingForDelete()

  Indicates if this object's representation will be deleted in the database at the next update operation.

  Returns:
    TRUE if the object needs to be deleted FALSE otherwise

### setDirty

    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.

### setId

    public void setId(long newId)
               throws M4Exception

  Overrides the super-method just to set the dirty-flag

  Specified by:
    `setId` in interface `M4Object`
  Overrides:
    `setId` in class `M4Object`
  Parameters:
    `newId` - The new id for this M4 object.
  Throws:
    `M4Exception`
  See Also:
    `M4Object.setId(long)`

### setName

    public void setName(java.lang.String n)

  Overrides the super-method just to set the dirty-flag

  Specified by:
    `setName` in interface `M4Object`
  Overrides:
    `setName` in class `M4Object`
  Parameters:
    `n` - The new name.
  See Also:
    `M4Object.setName(String)`

### getObjectsInNamespace

    protected abstract java.util.Collection getObjectsInNamespace(java.lang.Class typeOfObjects)
                                                           throws M4Exception

  This method returns the objects of the specified type that form a namespace in the scope of this M4Data object. For example, a Concept's namespace for the type BaseAttribute is the Collection of all BaseAttributes for this Concept. Many M4Data objects never have a namespace, they return `null`. If a namespace could exist but doesn't, an empty Collection is returned.

  Parameters:
    `typeOfObjects` - the type of objects that form the namespace
  Returns:
    a Collection of objects of type `typeOfObjects`, or `null`.
  Throws:
    `M4Exception`

### getValidName

    public java.lang.String getValidName(java.lang.String name,
                                         java.lang.Class typeOfNamedObject)
                                  throws M4Exception

  Throws:
    `M4Exception`
  See Also:
    `edu.udo.cs.miningmart.m4.M4Data#getValidName(String)`

### getValidName

    protected java.lang.String getValidName(java.lang.String name,
                                            java.lang.Class typeOfNamedObject,
                                            M4Data exception)
                                     throws M4Exception

  Throws:
    `M4Exception`

### getUniqueName

    protected java.lang.String getUniqueName(java.lang.String name,
                                             java.util.Collection nameCollection)

### deleteSoon

    public void deleteSoon()
                    throws M4Exception

  The method to delete all references of an `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.

  Throws:
    `M4Exception`

### removeAllM4References

    protected abstract void removeAllM4References()
                                           throws M4Exception

  This method needs to be implemented by all `M4Data` objects. It has to remove all references to other `M4Object`s.

  Throws:
    `M4Exception`

### getObjectsReferencingMe

    public java.util.Collection getObjectsReferencingMe(java.lang.Class theClass)
                                                 throws M4Exception

  This is a service method for container objects loading their `M4Data` objects. This method is called with the type of contained objects as the parameter.

  Parameters:
    `theClass` - the class of the embedded objects
  Returns:
    a `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.
  Throws:
    `M4Exception`

### getObjectsReferencingMe

    public java.util.Collection getObjectsReferencingMe(java.lang.Class theClass,
                                                        java.lang.String foreignKey)
                                                 throws M4Exception

  This is a service method for container objects loading their `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).

  Parameters:
    `theClass` - the class object of objects to be returned
    `foreignKey` - the name of the foreign key attribute in the database realising the references to objects of the type of m4d
  Returns:
    the `Collection` of objects referencing `this` object
  Throws:
    `M4Exception`
  See Also:
    `getObjectsReferencing(M4Data)`

### genericSetter

    public void genericSetter(java.lang.String nameOfSetter,
                              java.lang.Class parameterClassOfSetter,
                              java.lang.Object objectToSet)
                       throws M4Exception

  This method is used by the autoLoad facility for `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.

  Parameters:
    `nameOfSetter` - the name of the setter method is to be specified here
    `parameterClassOfSetter` - the class object of the target method's only parameter
    `objectToSet` - the object that is set using the setter specified by the other two parameters
  Throws:
    `M4Exception` - if no method with the given name or signature exists, or if an `InvocationTargetException` or `IllegalAccessException` occurs.

### genericGetter

    public java.lang.Object genericGetter(java.lang.String nameOfGetter)
                                   throws M4Exception

  This method is used by the generic store method for `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.

  Parameters:
    `nameOfGetter` - the name of the getter method is to be specified here
  Returns:
    the object returned by activating the getter
  Throws:
    `M4Exception` - if no method expecting no parameters with the given name exists, or if an `InvocationTargetException` or `IllegalAccessException` occurs.

### getDocumentation

    public java.lang.String getDocumentation()
                                      throws M4Exception

  Returns the description String for this M4 object.

  Returns:
    a description String, or `null` if none exists
  Throws:
    `M4Exception`

### setDocumentation

    public void setDocumentation(java.lang.String text)
                          throws M4Exception

  Sets the description String for this M4 object.

  Parameters:
    `text` - The description String to set
  Throws:
    `M4Exception`

### primitiveGetDocObject

    public Docu primitiveGetDocObject()

### primitiveSetDocObject

    public void primitiveSetDocObject(Docu doc)

### removeDocObject

    protected void removeDocObject()
                            throws M4Exception

  Throws:
    `M4Exception`

### storeLocal

    protected void storeLocal()
                       throws M4Exception

  This method is called after the generic storing and can be overridden to store related objects to cross-tables etc.

  Throws:
    `M4Exception`

### deleteLocal

    protected void deleteLocal()
                        throws M4Exception

  This method is called after the generic delete and can be overridden to delete related objects stored in cross-tables etc.

  Throws:
    `M4Exception`

### updateObjectsFromTable

    public static java.util.Collection updateObjectsFromTable(java.lang.String dbTableName)
                                                       throws M4Exception

  Helper method of DB.updateDatabase(): For the specified table this method calls the instance methods of the corresponding dirty `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.

  Returns:
    a `Collection` of the objects to be deleted later on.
  Throws:
    `M4Exception`

### removeSetFromDb

    public static void removeSetFromDb(java.util.Collection objectsToDelete)
                                throws M4Exception

  Helper method of DB.updateDatabase(): Calls the instance method of objects to remove themself from the database for all objects in the specified collection.

  Throws:
    `M4Exception`

### removeFromDb

    public void removeFromDb()
                      throws M4Exception

  This method removes the tuple representing this object from the database and from the M4 cache. It may only be called in the context of `DB.updateDatabase()`!

  Throws:
    `M4Exception`

### hasDeleteStatus

    public boolean hasDeleteStatus()
                            throws M4Exception

  Method added by T. Euler 18th July 2005. Provides the information whether an object is to be deleted soon by checking its M4 references; if any are null that should not be null according to the M4 schema, TRUE is returned. This is the same procedure as in storeByUpdate().

  Returns:
  Throws:
    `M4Exception`

### getXmlVersion

    public java.lang.String getXmlVersion()

  See Also:
    `XmlInfo.getXmlVersion()`

### getXmlIdTag

    public java.lang.String getXmlIdTag()

  See Also:
    `XmlInfo.getXmlIdTag()`

### getObjectTag

    public java.lang.String getObjectTag()

  See Also:
    `XmlInfo.getXmlIdTag()`

### getDependentObjects

    public java.util.Collection getDependentObjects()
                                             throws M4Exception

  This method is part of the XML-serialization and needs to be implemented by all `M4Data` sub-classes that need to be serialized.

  Returns:
    a `Collection` of all `M4Data` Java objects holding a foreign key reference to `this` object. This method must never return `null`.
  Throws:
    `M4Exception`

### exportLocal

    public java.util.Collection exportLocal(java.io.Writer out,
                                            java.util.Collection dependent)
                                     throws M4Exception,
                                            java.io.IOException

  This method is called during exporting objects. It should be overridden by classes that have local changes to the generic loading and storing of fields. Any additional field should be returned as an XML-`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!

  Parameters:
    `out` - a `Writer` to be passed to `export` methods of embedded objects
    `dependent` - a `Collection` to be passed to `export` methods of embedded objects
  Returns:
    a `Collection` of XML-`String`s specifying the additional attributes of this object
  Throws:
    `M4Exception`
    `java.io.IOException`

### importLocal

    public void importLocal(java.lang.String tag,
                            java.lang.String embedded)
                     throws XmlException,
                            M4Exception

  Method for importing local fields (recognized by unknown tags) from XML.

  Parameters:
    `tag` - the tag indicating the local field to be imported
    `embedded` - the `String` between the opening and closing tag
  Throws:
    `XmlException`
    `M4Exception`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2005