Message:

  A new issue has been created in JIRA.

---------------------------------------------------------------------
View the issue:

  http://opensource.atlassian.com/projects/xdoclet/secure/ViewIssue.jspa?key=XDT-387


Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XDT-387
    Summary: better management of add,remove,update of Collections on value-objects
       Type: Improvement

     Status: Assigned
   Priority: Minor

 Time Spent: Unknown
   Estimate: 0 minutes

    Project: XDoclet
  Component: EJB Module
   Versions:
             1.2 Beta 2

   Assignee: xdoclet-devel (Use for new issues)
   Reporter: john m flinchbaugh

    Created: Mon, 17 Mar 2003 11:54 AM
    Updated: Mon, 17 Mar 2003 11:54 AM
Environment: debian unstable linux 2.5.64, blackdown j2sdk 1.4.1-01, jboss 3.0.6

Description:
the collection remove* methods make sure to clear the removed object from updated* or 
added* collections, but the update* and add* methods don't do the same for the 
removed* collection, so a previously removed element could also be in the added 
collection.  since removed in processed after added in the generated CMP class, the 
removal takes precedence over the addition of the element.
vo.removeMyObject(o);
vo.addMyObject(o);
results in it's ultimate removal from the collection.

add* and update* methods should check for the object in the removed* collection and 
eliminate it if it's there, so that the above code will result ultimately in the 
addition (or preservation in many cases) of the object in the collection.

i propose this patch to the valueobject.xdt:
*** 
../xdoclet-src/modules/ejb/src/xdoclet/modules/ejb/entity/resources/valueobject.xdt 
Tue Dec  3 04:16:26 2002
--- ejb/valueobject.xdt Mon Mar 17 11:59:59 2003
***************
*** 197,202 ****
--- 197,204 ----
          this.<XDtEjbValueObj:currentAggregateName/>s.add(added);
          if ( ! this.added<XDtEjbValueObj:currentAggregateName/>s.contains(added))
                 this.added<XDtEjbValueObj:currentAggregateName/>s.add(added);
+         if (this.removed<XDtEjbValueObj:currentAggregateName/>s.contains(added))
+          this.removed<XDtEjbValueObj:currentAggregateName/>s.remove(added);
     }
  
     public void 
remove<XDtEjbValueObj:currentAggregateName/>(<XDtEjbValueObj:currentAggregateType/> 
removed)
***************
*** 213,218 ****
--- 215,222 ----
     {
          if ( !this.updated<XDtEjbValueObj:currentAggregateName/>s.contains(updated) 
&& !this.added<XDtEjbValueObj:currentAggregateName/>s.contains(updated))
                 this.updated<XDtEjbValueObj:currentAggregateName/>s.add(updated);
+         if (this.removed<XDtEjbValueObj:currentAggregateName/>s.contains(updated))
+                this.removed<XDtEjbValueObj:currentAggregateName/>s.remove(updated);
     }
  
     public void clean<XDtEjbValueObj:currentAggregateName/>(){



---------------------------------------------------------------------
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/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:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to