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 M4Object

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

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

Direct Known Subclasses:
  M4Data

    public abstract class M4Object

extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable, M4Object

The super class for all M4 objects. All M4 objects have a unique ID and a reference to the DB object that is used in the current compiler thread. Thus there are setter and getter methods for them in this class.

Version:
  $Id: M4Object.java,v 1.4 2006/09/27 15:00:00 euler Exp $
Author:
  Timm Euler
See Also:
  `M4Data`, `Operator`, Serialized Form

Field Summary
`protected long` | `myId`
`protected java.lang.String` | `myName`

Constructor Summary
`M4Object(DB db)`

Method Summary
`int` | `compareTo(java.lang.Object anM4Object)`
`void` | `doPrint(java.lang.Exception ex)` Method to be used by all subclasses to print exception messages to the screen or log file.
`void` | `doPrint(java.util.logging.Level verbosity, java.lang.String printString)` Method to be used by all subclasses to print messages to the screen or log file.
`boolean` | `equals(java.lang.Object obj)` Two `M4Object`s are defined to be equal, if they refer to the same object.
`java.lang.String` | `executeBusinessSingleValueSqlRead(java.lang.String query)`
`java.lang.Long` | `executeBusinessSingleValueSqlReadL(java.lang.String query)`
`java.sql.ResultSet` | `executeBusinessSqlRead(java.lang.String query)` Method to comfortably read from the business database.
`void` | `executeBusinessSqlWrite(java.lang.String query)` Method to comfortably write to the business database.
`java.lang.String` | `executeM4SingleValueSqlRead(java.lang.String query)`
`java.lang.Long` | `executeM4SingleValueSqlReadL(java.lang.String query)`
`java.sql.ResultSet` | `executeM4SqlRead(java.lang.String query)` Method to comfortably read from the M4 database.
`void` | `executeM4SqlWrite(java.lang.String query)` Method to comfortably write to the M4 database.
`Print` | `getCasePrintObject()`
`long` | `getId()` Get the Id.
`DB` | `getM4Db()` Get the DB object.
`M4Object` | `getM4ObjectFromCache(long Id)` This method returns the object with the given Id if it is in the Cache.
`java.lang.String` | `getName()` Get the name of this M4 object.
`long` | `getNextM4SequenceValue()`
`boolean` | `isNew()` Check if this object was newly created by the user, or if it is already in the database.
`M4Object` | `load(long id)` Load the M4 object with the given ID.
`abstract void` | `print()` Print this M4 object's parameters.
`void` | `putM4ObjectToCache(M4Object m4o)` This method stores an M4 object in the Cache, using its ID as the key for the underlying data structure.
`abstract void` | `readFromDb()` Must be implemented by all subclasses.
`java.lang.String` | `replaceSpacesInName(java.lang.String name)` Service method for M4Object names that are also used as DB names.
`void` | `setId(long newId)` Only use this method if you know what you are doing.
`void` | `setName(java.lang.String n)` Set the name of this M4 object.
`void` | `setNotNew()` Allows to set the "isNew" flag to FALSE.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### myName

    protected java.lang.String myName

### myId

    protected long myId

Constructor Detail

### M4Object

    public M4Object(DB db)

Method Detail

### getCasePrintObject

    public Print getCasePrintObject()

  Specified by:
    `getCasePrintObject` in interface `M4Object`

### load

    public M4Object load(long id)
                  throws M4Exception

  Description copied from interface: `M4Object`
  Load the M4 object with the given ID.

  Specified by:
    `load` in interface `M4Object`
  Throws:
    `M4Exception`

### readFromDb

    public abstract void readFromDb()
                             throws M4Exception

  Must be implemented by all subclasses.

  Throws:
    `M4Exception`

### print

    public abstract void print()

  Print this M4 object's parameters. Must be implemented by all subclasses.

  Specified by:
    `print` in interface `M4Object`

### getId

    public long getId()

  Get the Id.

  Specified by:
    `getId` in interface `M4Object`
  Returns:
    This M4 object's ID.

### setId

    public void setId(long newId)
               throws M4Exception

  Only use this method if you know what you are doing.

  Specified by:
    `setId` in interface `M4Object`
  Parameters:
    `newId` - The new id for this M4 object.
  Throws:
    `M4Exception`

### getM4Db

    public DB getM4Db()

  Get the DB object.

  Specified by:
    `getM4Db` in interface `M4Object`
  Returns:
    The DB object that this M4 object was given last.
  See Also:
    `edu.udo.cs.miningmart.m4.core.utils.DB`

### doPrint

    public void doPrint(java.util.logging.Level verbosity,
                        java.lang.String printString)

  Method to be used by all subclasses to print messages to the screen or log file.

  Specified by:
    `doPrint` in interface `M4Object`
  Parameters:
    `verbosity` - A verbosity level. Use one of the public static variables of the class `Print`.
    `printString` - The string with the message.
  See Also:
    `edu.udo.cs.miningmart.m4.core.utils.Print`

### doPrint

    public void doPrint(java.lang.Exception ex)

  Method to be used by all subclasses to print exception messages to the screen or log file.

  Specified by:
    `doPrint` in interface `M4Object`
  Parameters:
    `ex` - An exception object. Its message string will be printed.

### setName

    public void setName(java.lang.String n)

  Set the name of this M4 object.

  Specified by:
    `setName` in interface `M4Object`
  Parameters:
    `n` - The new name.

### replaceSpacesInName

    public java.lang.String replaceSpacesInName(java.lang.String name)

  Service method for M4Object names that are also used as DB names.

  Specified by:
    `replaceSpacesInName` in interface `M4Object`
  Parameters:
    `name` - the original name for an M4 object (or `null`)
  Returns:
    the specified name with all spaces replaced by underscores (or `null`)

### getName

    public java.lang.String getName()

  Get the name of this M4 object.

  Specified by:
    `getName` in interface `M4Object`
  Returns:
    The M4 name

### isNew

    public boolean isNew()

  Check if this object was newly created by the user, or if it is already in the database.

  Specified by:
    `isNew` in interface `M4Object`
  Returns:
    TRUE if this is a newly created object. FALSE if it is already in the database.

### setNotNew

    public void setNotNew()

  Allows to set the "isNew" flag to FALSE. Use with care.

  Specified by:
    `setNotNew` in interface `M4Object`

### getM4ObjectFromCache

    public M4Object getM4ObjectFromCache(long Id)

  This method returns the object with the given Id if it is in the Cache.

  Specified by:
    `getM4ObjectFromCache` in interface `M4Object`
  Parameters:
    `Id` - The unique M4 Id of the object to be loaded.
  Returns:
    An M4Object if an object with the given Id is in the Cache; `null` otherwise.

### putM4ObjectToCache

    public void putM4ObjectToCache(M4Object m4o)
                            throws M4Exception

  This method stores an M4 object in the Cache, using its ID as the key for the underlying data structure.

  Specified by:
    `putM4ObjectToCache` in interface `M4Object`
  Parameters:
    `An` - M4Object to be stored in the Cache.
  Throws:
    `M4CompilerError` - if the object is `null` or has an ID of 0.
    `M4Exception`

### executeM4SqlWrite

    public void executeM4SqlWrite(java.lang.String query)
                           throws M4Exception

  Method to comfortably write to the M4 database.

  Specified by:
    `executeM4SqlWrite` in interface `M4Object`
  Parameters:
    `query` - an SQL query to be executed. This has to be a write operation to the M4 database, or an SQL string to execute a procedure in the M4 schema.
  Throws:
    `M4Exception`

### executeBusinessSqlWrite

    public void executeBusinessSqlWrite(java.lang.String query)
                                 throws M4Exception

  Method to comfortably write to the business database.

  Specified by:
    `executeBusinessSqlWrite` in interface `M4Object`
  Parameters:
    `query` - an SQL query to be executed. This has to be a write operation to the business database, or an SQL string to execute a procedure in the business schema.
  Throws:
    `M4Exception`

### executeM4SqlRead

    public java.sql.ResultSet executeM4SqlRead(java.lang.String query)
                                        throws M4Exception

  Method to comfortably read from the M4 database. The caller has to close the returned `ResultSet` after usage!

  Specified by:
    `executeM4SqlRead` in interface `M4Object`
  Parameters:
    `query` - an SQL query to be executed. This has to be a read operation on the M4 database.
  Returns:
    the corresponding `ResultSet`
  Throws:
    `M4Exception`

### executeBusinessSqlRead

    public java.sql.ResultSet executeBusinessSqlRead(java.lang.String query)
                                              throws M4Exception

  Method to comfortably read from the business database. The caller has to close the returned `ResultSet` after usage!

  Specified by:
    `executeBusinessSqlRead` in interface `M4Object`
  Parameters:
    `query` - an SQL query to be executed. This has to be a read operation on the business database.
  Returns:
    the corresponding `ResultSet`
  Throws:
    `M4Exception`

### executeM4SingleValueSqlReadL

    public java.lang.Long executeM4SingleValueSqlReadL(java.lang.String query)
                                                throws M4Exception

  Specified by:
    `executeM4SingleValueSqlReadL` in interface `M4Object`
  Throws:
    `M4Exception`
  See Also:
    `In contrast to that method, this method creates and then closes its own `Statement`.`

### executeBusinessSingleValueSqlReadL

    public java.lang.Long executeBusinessSingleValueSqlReadL(java.lang.String query)
                                                      throws M4Exception

  Specified by:
    `executeBusinessSingleValueSqlReadL` in interface `M4Object`
  Throws:
    `M4Exception`
  See Also:
    `In contrast to that method, this method creates and then closes its own `Statement`.`

### executeM4SingleValueSqlRead

    public java.lang.String executeM4SingleValueSqlRead(java.lang.String query)
                                                 throws M4Exception

  Specified by:
    `executeM4SingleValueSqlRead` in interface `M4Object`
  Throws:
    `M4Exception`
  See Also:
    `In contrast to that method, this method creates and then closes its own `Statement`.`

### executeBusinessSingleValueSqlRead

    public java.lang.String executeBusinessSingleValueSqlRead(java.lang.String query)
                                                       throws M4Exception

  Specified by:
    `executeBusinessSingleValueSqlRead` in interface `M4Object`
  Throws:
    `M4Exception`
  See Also:
    `In contrast to that method, this method creates and then closes its own `Statement`.`

### getNextM4SequenceValue

    public long getNextM4SequenceValue()
                                throws M4Exception

  Specified by:
    `getNextM4SequenceValue` in interface `M4Object`
  Returns:
    the value returned by the sequence installed in the M4 schema.
  Throws:
    `M4CompilerError` - if for some reason the sequence does not return a value
    `M4Exception`

### equals

    public boolean equals(java.lang.Object obj)

  Two `M4Object`s are defined to be equal, if they refer to the same object. This is true, if their ID is the same.

  Specified by:
    `equals` in interface `M4Object`
  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `obj` - an `Object` to compare this object with.
  Returns:
    `true` iff obj is an `M4Object` with the same ID, or if both IDs are 0 then also with the same name.

### compareTo

    public int compareTo(java.lang.Object anM4Object)
                  throws java.lang.ClassCastException

  Specified by:
    `compareTo` in interface `java.lang.Comparable`
  Throws:
    `java.lang.ClassCastException`

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