Message: A new issue has been created in JIRA.
--------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/xdoclet/browse/XDT-1308 Here is an overview of the issue: --------------------------------------------------------------------- Key: XDT-1308 Summary: Conditional update utility for Value Objects Type: New Feature Status: Open Priority: Trivial Original Estimate: 0 minutes Time Spent: Unknown Remaining: 0 minutes Project: XDoclet Components: EJB Module Versions: 1.2.2 Assignee: xdoclet-devel (Use for new issues) Reporter: Luiz-Otavio Zorzella Created: Tue, 22 Mar 2005 3:46 PM Updated: Tue, 22 Mar 2005 3:46 PM Description: The patch below implements a very useful addition to the generated Value Objects. By making use of the hasBeenSet flags, it creates a method that conditionally updates the current Value Object based on changed values from another Value Object. The patch includes a JavaDoc for the method, and it does not alter or add any @ejb tag, and it does not change any generated method or field -- it simply adds one new method, so it's quite safe. Zorzella ************************************************************** Index: valueobject.xdt =================================================================== RCS file: /cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/entity/resources/valueobject.xdt,v retrieving revision 1.23 diff -u -r1.23 valueobject.xdt --- valueobject.xdt 9 Jul 2003 13:45:10 -0000 1.23 +++ valueobject.xdt 22 Mar 2005 21:34:11 -0000 @@ -85,6 +85,20 @@ </XDtEjbPk:ifDoesntHavePrimkeyField> } + /** + * Updates this instance of the value object with the values from another + * of same type. Only fields that have the dirty flag (hasBeenSet) set to + * true in the other value object are updated in this object. Aggregates + * are not updated at all. + */ + public void updateWithModifiedFieldsOf (<XDtClass:classOf><XDtEjbValueObj:valueObjectClass/></XDtClass:classOf> otherValue) { + <XDtEjbPersistent:forAllPersistentFields superclasses="true" valueobject="<XDtEjbValueObj:valueObjectMatch/>"> + if (otherValue.<XDtMethod:propertyName/>HasBeenSet ()) + <XDtMethod:setterMethod/> (otherValue.<XDtMethod:getterMethod/> ()); + + </XDtEjbPersistent:forAllPersistentFields> + } + public <XDtEjbPk:pkClass/> getPrimaryKey() { return pk; --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/xdoclet/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira ------------------------------------------------------- This SF.net email is sponsored by: 2005 Windows Mobile Application Contest Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones for the chance to win $25,000 and application distribution. Enter today at http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click _______________________________________________ xdoclet-devel mailing list xdoclet-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xdoclet-devel