Well, here's where the whole thing ended up. Now, to put in all the fields and business methods.
Note: Identifier is an interface, UUID is an implementation of said interface.


--------
The identifiable interface

package com.messagegate.foundation;

import com.messagegate.foundation.id.Identifier;

/**
*
*
* @author
* <br>
* <dl><dt><b>Date:</b><dd>May 11, 2004</dd></dl>
*/
public interface Identifiable {
   public Identifier getUniqueId();
   public void setUniqueId(Identifier newId);
}



The abstract VO class

package com.messagegate.foundation.persist;

import com.messagegate.foundation.Identifiable;
import com.messagegate.foundation.id.Identifier;
import com.messagegate.foundation.id.IdentifierFactory;


/**
* Base class for persistable domain objects. Helps map the Identifiers into strings for CMP,
* DAOs and other xdoclet generated classes
*
* @author bobc
* <br>
* <dl><dt><b>Date:</b><dd>May 10, 2004</dd></dl>
*/
public abstract class DomainObject implements Identifiable {
/**
* set the unique identifier - proxy for setId(String)
*
* @param Identifier
*/
public void setUniqueId(Identifier newId) {
setId(newId.getId());
}
/**
* get the unique identifer - construct on the fly from the id.
*
*/
public Identifier getUniqueId() {
return IdentifierFactory.createUniqueIdentifier(getId());
}
public abstract void setId(String newId);
public abstract String getId();
}





The public interface for the Value Object


package com.messagegate.mms.message;

import com.messagegate.foundation.Identifiable;

/**
* Public interface for a Message Value Object
*
* @author bobc
* <br>
* <dl><dt><b>Date:</b><dd>May 11, 2004</dd></dl>
*/
public interface MessageVO extends Identifiable {
public String getMessageFile();
public void setMessageFile(String newMessage);


}


Finally, the Entity Bean /* -- (c) 2004 MessageGate.com All rights reserved --- */

package com.messagegate.mms.message.ejb;

import javax.ejb.EntityBean;

import com.messagegate.foundation.id.Identifier;
import com.messagegate.foundation.id.IdentifierFactory;
import com.messagegate.foundation.id.UUID;
import com.messagegate.mms.message.MessageVO;
import com.messagegate.util.BeanUtil;


/**
* @ejb.bean name="Message"
* jndi-name="MessageBean"
* type="CMP"
* schema="mms"
* cmp-version="2.x"
* pk-field="id"
*
*
* @ejb.persistence
* table-name="MESSAGE"
*
* @ejb.pk class="com.messagegate.foundation.id.UUID" generate="false"
*
* @ejb.finder
* query="SELECT OBJECT(a) FROM mms as a" * signature="java.util.Collection findAll()"
*
* @ejb.value-object
* name="Message"
* extends="com.messagegate.foundation.persist.DomainObject"
* implements="com.messagegate.mms.message.MessageVO"
* match="*"
*
* **/


public abstract class MessageBean implements EntityBean, MessageVO {

/**
* The ejbCreate method.
*
* @ejb.create-method
*/
public com.messagegate.foundation.id.UUID ejbCreate() throws javax.ejb.CreateException {
UUID uuid = (UUID)IdentifierFactory.createUniqueIdentifier();
this.setId(uuid.getId());
return null;
}
/**
* The ejbCreate method.
*
* @ejb.create-method
*/
public com.messagegate.foundation.id.UUID ejbCreate(MessageVO message) throws javax.ejb.CreateException {
// use reflection on common interface to synchronize data
BeanUtil.synchronizeData(this, message, MessageVO.class);
return null;
}



/**
* The container invokes this method immediately after it calls ejbCreate.
*
*/
public void ejbPostCreate() throws javax.ejb.CreateException {
}
public com.messagegate.foundation.id.UUID getPrimaryKey() {
com.messagegate.foundation.id.UUID pk = new com.messagegate.foundation.id.UUID(getId());
return pk;
}



// interface methods so we can use reflection to copy values
public Identifier getUniqueId() {
return IdentifierFactory.createUniqueIdentifier(getId());
}
public void setUniqueId(Identifier id) {
setId(id.getId());
}
/**
* Returns the id
* @return the id
*
* @ejb.persistent-field
* @ejb.persistence
* column-name="ID"
* sql-type="CHAR(32)"
* @ejb.pk-field
* @ejb.interface-method
*
*/
public abstract String getId();


/**
* Sets the id
*
* @param java.lang.String the new id value
*
* @ejb.interface-method
*/
public abstract void setId(String id);
/**
* Returns the messageFile
* @return the messageFile
*
* @ejb.persistent-field
* @ejb.persistence
* column-name="MESSAGE_FILE"
* sql-type="VARCHAR(256)"
* @ejb.interface-method
*
*/
public abstract java.lang.String getMessageFile();


   /**
   * Sets the messageFile
   *
   * @param java.lang.String the new messageFile value
   *
   * @ejb.interface-method
   */
   public abstract void setMessageFile(java.lang.String newMessageFile);


}











------------------------------------------------------- This SF.Net email is sponsored by Sleepycat Software Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO. http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3 _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to