Model
Keywords: uk.ac.ic.doc.automed.reps.Model,Model class

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

## uk.ac.ic.doc.automed.reps
Class Model

    java.lang.Object
      |
      +--uk.ac.ic.doc.automed.reps.Model

public class Model
extends java.lang.Object

The Model class

Author:
  Michael Boyd (mboyd@doc.ic.ac.uk), Nerissa Tong (nnyt98@doc.ic.ac.uk)
See Also:
  `Construct`

Method Summary
`Construct` | `createConstruct(java.lang.String cName, int cClass, boolean isRoot)` Creates a new construct and add to the model.
`static Model` | `createModel(java.lang.String modelName)` Creates a new model with the given name.
`static boolean` | `exists(int MID)`
`static boolean` | `exists(java.lang.String modelName)`
`void` | `exportConstructs(java.io.OutputStream os)`
`void` | `exportConstructs(java.io.PrintWriter pw)`
`java.awt.Color` | `getBackgroundColor()` Return the default background colour to be used from drawing `SchemaObject`s of this `Model`.
`Construct` | `getConstruct(java.lang.String name)` Returns the named construct in the model or throws an AutoMedException if the construct name doesn't exist in the model.
`Construct[]` | `getConstructs()` Returns an array of all the constructs in the model.
`java.awt.Color` | `getForegroundColor()` Return the default foreground colour to be used from drawing `SchemaObject`s of this `Model`.
`int` | `getMID()` Returns the repository identifer of the model.
`static Model` | `getModel(int MID)` Returns a reference to the `Model` with the given MID.
`static Model` | `getModel(java.lang.String name)` Returns a reference to the `Model` with the given modelName.
`java.lang.String` | `getModelDescription()` Returns a description of the model, each construct along with their schemes is listed in a way suitable for printing.
`java.lang.String` | `getModelDescription(boolean full)` Returns a description of the model, each construct along with its schemes are listed in a way suitable for printing.
`static Model[]` | `getModels()` Returns an array of all models.
`java.lang.String` | `getName()` Returns the name of the model.
`java.awt.Color` | `getTextColor()` Return the default text colour to be used from drawing `SchemaObject`s of this `Model`.
`void` | `importConstructs(java.io.InputStream is)`
`static Model` | `read(java.io.InputStream is)`
`static Model` | `read(java.io.InputStream is, java.lang.String name)`
`static void` | `reloadModels()` This method empties the cached model data and then reloads it from the MDR as if the class had just been loaded.
`void` | `remove()` Removes the Model from the repository.
`protected void` | `removeConstructFromMap(java.lang.String name)` THIS METHOD DOESN'T DO ANYTHING AT THE MOMENT Sets the content of a particular position of the model's constructs list.
`static void` | `removeModel(java.lang.String modelName)` Removes the Model with the given modelName.
`void` | `retract()` Removes the Model from the repository, together with all associated information --- in particular all Constructs belonging to the model are removed, and hence all SchemaObjects, and hence all Transformations on those objects.
`void` | `setBackgroundColor(java.awt.Color c)` Set the default background colour to be used from drawing `SchemaObject`s of this `Model`.
`void` | `setForegroundColor(java.awt.Color c)` Set the default foreground colour to be used from drawing `SchemaObject`s of this `Model`.
`void` | `setName(java.lang.String modelName)` Sets the model's name.
`void` | `setTextColor(java.awt.Color c)` Set the default text colour to be used from drawing `SchemaObject`s of this `Model`.
`void` | `write(java.io.OutputStream os)`
`void` | `write(java.io.PrintWriter pw)`

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

Method Detail

### reloadModels

    public static void reloadModels()

  This method empties the cached model data and then reloads it from the MDR as if the class had just been loaded. If you change the contents of the MDR directly rather than through the reps API but wish to then use the reps API in the same JVM instance then you should call this method to synchronize the reps API data with the MDR

### createModel

    public static Model createModel(java.lang.String modelName)
                             throws IntegrityException

  Creates a new model with the given name.

  Parameters:
    `modelName` - name of the model.
  Throws:
    `IntegrityException` - if model already exists

### removeModel

    public static void removeModel(java.lang.String modelName)
                            throws IntegrityException

  Removes the Model with the given modelName.

  Parameters:
    `modelName` - name of the model to be removed.
  Throws:
    `IntegrityException` - if model does not exist

### remove

    public void remove()
                throws IntegrityException

  Removes the Model from the repository.

  Throws:
    `IntegrityException`

### retract

    public void retract()

  Removes the Model from the repository, together with all associated information --- in particular all Constructs belonging to the model are removed, and hence all SchemaObjects, and hence all Transformations on those objects.

### getModels

    public static Model[] getModels()

  Returns an array of all models.

  Returns:
    an array of all models.

### exists

    public static boolean exists(java.lang.String modelName)

### exists

    public static boolean exists(int MID)

### getModel

    public static Model getModel(java.lang.String name)
                          throws NotFoundException

  Returns a reference to the `Model` with the given modelName.

  Returns:
    the reference to the model with the given modelName
    `NotFoundException`

### getModel

    public static Model getModel(int MID)
                          throws NotFoundException

  Returns a reference to the `Model` with the given MID.

  Parameters:
    `MID` - numeric identifier of the model.
  Returns:
    the reference to the model with the given MID, or null if the model can not be found in the repository
    `NotFoundException`

### createConstruct

    public Construct createConstruct(java.lang.String cName,
                                     int cClass,
                                     boolean isRoot)

  Creates a new construct and add to the model.

  Parameters:
    `cName` - name of the construct.
    `cClass` - class of the construct (one of `CONSTRUCT_CLASS_NODAL`, `CONSTRUCT_CLASS_LINK`, `CONSTRUCT_CLASS_LINK_NODAL`, and `CONSTRUCT_CLASS_CONSTRAINT`, see `Constants`).
    `isRoot` - set to `true` if the construct is a construct type of its underlying data model; `false` otherwise.
  Returns:
    reference to the new construct.

### getName

    public java.lang.String getName()

  Returns the name of the model.

  Returns:
    name of the model.

### getMID

    public int getMID()

  Returns the repository identifer of the model.

  Returns:
    mid of the model.

### getConstruct

    public Construct getConstruct(java.lang.String name)
                           throws NotFoundException

  Returns the named construct in the model or throws an AutoMedException if the construct name doesn't exist in the model.

  Throws:
    `NotFoundException` - if the named construct doesn't exist in the model.

### getConstructs

    public Construct[] getConstructs()

  Returns an array of all the constructs in the model.

  Returns:
    an array of all the constructs in the model.

### setName

    public void setName(java.lang.String modelName)
                 throws MDRException,
                        java.sql.SQLException,
                        DSRException,
                        java.io.IOException

  Sets the model's name.

  Parameters:
    `modelName` - new name of model.
  Throws:
    `MDRException`
    `java.sql.SQLException`
    `DSRException`
    `java.io.IOException`

### removeConstructFromMap

    protected void removeConstructFromMap(java.lang.String name)
                                   throws IntegrityException

  THIS METHOD DOESN'T DO ANYTHING AT THE MOMENT Sets the content of a particular position of the model's constructs list.

    `IntegrityException`

### getModelDescription

    public java.lang.String getModelDescription()

  Returns a description of the model, each construct along with their schemes is listed in a way suitable for printing. This calls `getModelDescription(boolean)` passing it false to get the shorter description.

### getModelDescription

    public java.lang.String getModelDescription(boolean full)

  Returns a description of the model, each construct along with its schemes are listed in a way suitable for printing. If a full description is asked for, constructs are expanded to their full description when they appear in another construct's scheme. When false, just the name of the construct is used in the schemes in which it appears.

  Parameters:
    `full` - If true, expand construct descriptions in scheme

### importConstructs

    public void importConstructs(java.io.InputStream is)
                          throws java.io.IOException,
                                 AutoRepException,
                                 AutoMedException,
                                 java.sql.SQLException

    `java.io.IOException`
    `AutoRepException`
    `AutoMedException`
    `java.sql.SQLException`

### exportConstructs

    public void exportConstructs(java.io.OutputStream os)

### exportConstructs

    public void exportConstructs(java.io.PrintWriter pw)

### read

    public static Model read(java.io.InputStream is)
                      throws java.io.IOException,
                             AutoRepException,
                             AutoMedException,
                             java.sql.SQLException

    `java.io.IOException`
    `AutoRepException`
    `AutoMedException`
    `java.sql.SQLException`

### read

    public static Model read(java.io.InputStream is,
                             java.lang.String name)
                      throws java.io.IOException,
                             AutoRepException,
                             AutoMedException,
                             java.sql.SQLException

    `java.io.IOException`
    `AutoRepException`
    `AutoMedException`
    `java.sql.SQLException`

### write

    public void write(java.io.OutputStream os)

### write

    public void write(java.io.PrintWriter pw)

### getForegroundColor

    public java.awt.Color getForegroundColor()

  Return the default foreground colour to be used from drawing `SchemaObject`s of this `Model`.

  Returns:
    A `Color`, or null if no default colour is set for this `Model`

### setForegroundColor

    public void setForegroundColor(java.awt.Color c)

  Set the default foreground colour to be used from drawing `SchemaObject`s of this `Model`.

### getBackgroundColor

    public java.awt.Color getBackgroundColor()

  Return the default background colour to be used from drawing `SchemaObject`s of this `Model`.

  Returns:
    A `Color`, or null if no default colour is set for this `Model`

### setBackgroundColor

    public void setBackgroundColor(java.awt.Color c)

  Set the default background colour to be used from drawing `SchemaObject`s of this `Model`.

### getTextColor

    public java.awt.Color getTextColor()

  Return the default text colour to be used from drawing `SchemaObject`s of this `Model`.

  Returns:
    A `Color`, or null if no default colour is set for this `Model`

### setTextColor

    public void setTextColor(java.awt.Color c)

  Set the default text colour to be used from drawing `SchemaObject`s of this `Model`.

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