Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.RuntimeCollective.webapps.bean
Interface Duplicable  view Duplicable download Duplicable.java

All Superinterfaces:
EntityBean, java.io.Serializable
All Known Subinterfaces:
Versioned
All Known Implementing Classes:
VersionedExtension

public interface Duplicable
extends EntityBean

Interface to implement if you want an EntityBean to be duplicable, that is, to make it possible to duplicate a bean into a new one, with the same properties, but a new id.

Version:
$Id: Duplicable.java,v 1.5 2003/09/30 15:13:09 joe Exp $

Field Summary
static java.lang.String DATABASE_TABLE
          Not sure we need this, but EBS complains otherwise
 
Fields inherited from interface com.RuntimeCollective.webapps.bean.EntityBean
INTERFACE_BEAN, NULL_ID
 
Method Summary
 Duplicable customiseDuplicate(Duplicable duplicate)
          A method to customise (and save) a "raw" Duplicate, usually not called directly, but used by makeDuplicate(int).
 Duplicable makeDuplicate()
          The method to call when you want to create (and save) the duplicate of an object.
 Duplicable makeDuplicate(int duplicateId)
          The method to call when you want to create (and save) the duplicate of an object, while expliciting the id you want for the duplicate.
 
Methods inherited from interface com.RuntimeCollective.webapps.bean.EntityBean
delete, getId, save, setId
 

Field Detail

DATABASE_TABLE

public static final java.lang.String DATABASE_TABLE
Not sure we need this, but EBS complains otherwise

See Also:
Constant Field Values
Method Detail

makeDuplicate

public Duplicable makeDuplicate()
The method to call when you want to create (and save) the duplicate of an object.

This will call makeDuplicate(int) with a fresh new id.


makeDuplicate

public Duplicable makeDuplicate(int duplicateId)
The method to call when you want to create (and save) the duplicate of an object, while expliciting the id you want for the duplicate.

To use with care, as obviously the bean using that id will be overwritten. It is "recommended" that the overwritten bean be of the same type as the object being duplicated.

Implementation-wise, this method will make a raw duplicate (ie clone itself by changing its own id), and then call the customiseDuplicate() method where class-specific code should reside.


customiseDuplicate

public Duplicable customiseDuplicate(Duplicable duplicate)
A method to customise (and save) a "raw" Duplicate, usually not called directly, but used by makeDuplicate(int).

This method will do additional processing of a "raw" Duplicate. This is most useful for class-specific logic, such as creating Duplicates of composed objects, and assigning those Duplicates to the "raw" Duplicate.

When subclassing a Duplicable class, you should override this method only, without changing the makeDuplicate methods.