org.melati.poem
Class StandardIntegrityFix

Package class diagram package StandardIntegrityFix
java.lang.Object
  extended by org.melati.poem.StandardIntegrityFix
All Implemented Interfaces:
IntegrityFix

public abstract class StandardIntegrityFix
extends Object
implements IntegrityFix

A class which defines the three standard integrity fixes of delete, clear and prevent.

These correspond to the SQL ON DELETE CASCADE, ON DELETE SET NULL and ON DELETE NO ACTION.


Nested Class Summary
static class StandardIntegrityFix.NameUnrecognisedException
          Thrown when an invalid StandardIntegrityFix is specified, by a typing mistake in the DSD for example.
 
Field Summary
static StandardIntegrityFix clear
          Clear (make null) field in referring object.
static StandardIntegrityFix delete
          Delete referred objects.
static StandardIntegrityFix prevent
          Disallow the deletion.
 
Method Summary
static int count()
           
static StandardIntegrityFix forIndex(int i)
          Get a fix by its index.
 Integer getIndex()
           
 String getName()
          Integrity fixes are set in the DSD by name.
static StandardIntegrityFix named(String name)
          Find by name.
abstract  Enumeration referencesTo(Persistent referee, Column column, Enumeration refs, Map referenceFixOfColumn)
          Each StandardIntegrityFix differs from another by the way they implement referencesTo(org.melati.poem.Persistent, org.melati.poem.Column, java.util.Enumeration, java.util.Map).
 String toString()
          Return the name and index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

delete

public static final StandardIntegrityFix delete
Delete referred objects.


clear

public static final StandardIntegrityFix clear
Clear (make null) field in referring object.


prevent

public static final StandardIntegrityFix prevent
Disallow the deletion.

Method Detail

getName

public String getName()
Description copied from interface: IntegrityFix
Integrity fixes are set in the DSD by name.

Specified by:
getName in interface IntegrityFix
Returns:
the name

getIndex

public Integer getIndex()
Returns:
the index.

referencesTo

public abstract Enumeration referencesTo(Persistent referee,
                                         Column column,
                                         Enumeration refs,
                                         Map referenceFixOfColumn)
Each StandardIntegrityFix differs from another by the way they implement referencesTo(org.melati.poem.Persistent, org.melati.poem.Column, java.util.Enumeration, java.util.Map). delete deletes all references to this Persistent.
clear sets the references to null.
prevent returns the references, which prevokes an exception

Specified by:
referencesTo in interface IntegrityFix
Parameters:
referee - the Persistent we are deleting
column - the Column of the reference to Persistent we are deleting, used in clear
refs - an Enumeration of the objects which contain a reference to the Persistent we are deleting, each is deleted, cleared or returned respectively
referenceFixOfColumn - a Map keyed on Column giving the associated IntegrityFix, passed in to the Persistent referer to delete itself
Returns:
an Enumeration of the remaining referers, which if not empty will prevent deletion
See Also:
Persistent.delete(Map)

forIndex

public static StandardIntegrityFix forIndex(int i)
Get a fix by its index.

Parameters:
i - the index
Returns:
the fix at that index

count

public static int count()
Returns:
the number of fixes

named

public static StandardIntegrityFix named(String name)
Find by name.

Parameters:
name - the name
Returns:
the named fix

toString

public String toString()
Return the name and index.

Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 2000-2010 PanEris. All Rights Reserved.