You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by David Solis <ds...@legosoft.com.mx> on 2003/02/20 05:54:05 UTC
Tapestry 2.4 and Cayenne
As Howard and Craig suggested, I implememented a Tapestry extension
named CayenneValuePersister subclass of DefaultValuePersister which
registers ImmutableValueCopier as the value copier for interface
DataObject.
Here the code:
-------------------------------------------------
/*
* $Id: CayenneValuePersister.java,v 1.4 2003/02/20 02:12:00 dsolis Exp
$
* LegoSoft, Feb 19, 2003
* Copyright (C) 2001-2003 LegoSoft
*/
package com.ixe.isis.util;
import net.sf.tapestry.record.DefaultValuePersister;
import net.sf.tapestry.record.ImmutableValueCopier;
import net.sf.tapestry.IRequestCycle;
import org.objectstyle.cayenne.DataObject;
/**
* In order to assure the uniqueness of Cayenne DataObject within a
DataContext/ObjectStore,
* this class registers ImmutableValueCopier as the value copier for
interface DataObject.
*
* It is necessary to add the extension to application spec, i.e.
* <pre>
* <extension name="net.sf.tapestry.value-persister"
class="com.ixe.isis.util.CayenneValuePersister"/>
* </pre>
*
* @author David Solis
* @version $Revision: 1.4 $ $Date: 2003/02/20 02:12:00 $
*/
public class CayenneValuePersister extends DefaultValuePersister {
public void initialize(IRequestCycle cycle) {
registerValueCopier(DataObject.class, new
ImmutableValueCopier());
super.initialize(cycle);
}
}
-------------------------------------------------
Regards
David