biz.hammurapi.sql
Class SimpleRelationship

java.lang.Object
  extended by biz.hammurapi.sql.SimpleRelationship
All Implemented Interfaces:
ColumnChangeListener, Relationship

public class SimpleRelationship
extends java.lang.Object
implements Relationship, ColumnChangeListener

Base class for composite relationships where subitems exist only as part of the whole and removal of item from relationship is equivalent to deletion of the item.

Author:
Pavel Vlasov

Field Summary
protected  java.util.Collection deleted
           
protected  java.util.Collection inserted
           
protected  java.lang.String tableName
           
 
Constructor Summary
SimpleRelationship(DatabaseObject owner, java.lang.Class itemClass, java.lang.String tableName, java.lang.String[][] keyInfo, boolean isLazy)
           
 
Method Summary
 void add(DatabaseObject item)
           
 java.lang.Class getItemType()
           
 boolean isLazy()
           
 boolean isModified()
           
 void load(SQLProcessor processor, java.util.Collection receiver)
           
 void onChange(Column column)
           
 void remove(IDatabaseObject item)
           
 void setMaster(java.util.Collection master)
          Callback method to propagate updates
 void store(SQLProcessor processor)
           
 void update(SQLProcessor processor, IDatabaseObject subItem)
          Updates modified relationship items.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inserted

protected java.util.Collection inserted

deleted

protected java.util.Collection deleted

tableName

protected java.lang.String tableName
Constructor Detail

SimpleRelationship

public SimpleRelationship(DatabaseObject owner,
                          java.lang.Class itemClass,
                          java.lang.String tableName,
                          java.lang.String[][] keyInfo,
                          boolean isLazy)
Parameters:
owner - Relationship owner.
tableName - Table where child item are stored.
keyInfo - Mapping of owner's primary key columns to child foreign key columns.
isLazy - indicates whether relationship is lazy.
Method Detail

isLazy

public boolean isLazy()
Specified by:
isLazy in interface Relationship

store

public void store(SQLProcessor processor)
           throws java.sql.SQLException
Specified by:
store in interface Relationship
Throws:
java.sql.SQLException

add

public void add(DatabaseObject item)
Specified by:
add in interface Relationship

remove

public void remove(IDatabaseObject item)
Specified by:
remove in interface Relationship

load

public void load(SQLProcessor processor,
                 java.util.Collection receiver)
          throws java.sql.SQLException
Specified by:
load in interface Relationship
Throws:
java.sql.SQLException

isModified

public boolean isModified()
Specified by:
isModified in interface Relationship

update

public void update(SQLProcessor processor,
                   IDatabaseObject subItem)
            throws java.sql.SQLException
Description copied from interface: Relationship
Updates modified relationship items.

Specified by:
update in interface Relationship
Throws:
java.sql.SQLException

getItemType

public java.lang.Class getItemType()
Specified by:
getItemType in interface Relationship

onChange

public void onChange(Column column)
Specified by:
onChange in interface ColumnChangeListener

setMaster

public void setMaster(java.util.Collection master)
Description copied from interface: Relationship
Callback method to propagate updates

Specified by:
setMaster in interface Relationship


Copyright © 2003 Hammurapi Group. All Rights Reserved.