User: vharcq  
  Date: 02/02/22 15:25:15

  Modified:    core/resources/xdoclet/ejb valueobject.j
  Log:
  Handling of Collections changes (add/remove/update) inside a value object
  Test case for that to not going mad a second time ;)
  
  Revision  Changes    Path
  1.6       +33 -9     xdoclet/core/resources/xdoclet/ejb/valueobject.j
  
  Index: valueobject.j
  ===================================================================
  RCS file: /cvsroot/xdoclet/xdoclet/core/resources/xdoclet/ejb/valueobject.j,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -w -r1.5 -r1.6
  --- valueobject.j     21 Feb 2002 23:09:30 -0000      1.5
  +++ valueobject.j     22 Feb 2002 23:25:15 -0000      1.6
  @@ -128,25 +128,49 @@
   
      public void 
add<XDtEjbValueObj:currentAggregateName/>(<XDtEjbValueObj:currentAggregateType/> added)
      {
  +      if ( this.removed<XDtEjbValueObj:currentAggregateName/>s.contains(added) )
  +      {
  +         this.removed<XDtEjbValueObj:currentAggregateName/>s.remove(added);
  +         this.<XDtEjbValueObj:currentAggregateName/>s.add(added);
  +      }
  +      else if ( ! this.<XDtEjbValueObj:currentAggregateName/>s.contains(added) )
  +      {
         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);
  +      }
  +      else throw new IllegalStateException("The value object do already contain 
object to add");
      }
   
      public void 
remove<XDtEjbValueObj:currentAggregateName/>(<XDtEjbValueObj:currentAggregateType/> 
removed)
      {
  +      if ( this.<XDtEjbValueObj:currentAggregateName/>s.contains(removed) )
  +      {
         this.<XDtEjbValueObj:currentAggregateName/>s.remove(removed);
  -      this.removed<XDtEjbValueObj:currentAggregateName/>s.add(removed);
         if (this.added<XDtEjbValueObj:currentAggregateName/>s.contains(removed))
            this.added<XDtEjbValueObj:currentAggregateName/>s.remove(removed);
  +         else if ( ! 
this.removed<XDtEjbValueObj:currentAggregateName/>s.contains(removed) )
  +            this.removed<XDtEjbValueObj:currentAggregateName/>s.add(removed);
         if (this.updated<XDtEjbValueObj:currentAggregateName/>s.contains(removed))
            this.updated<XDtEjbValueObj:currentAggregateName/>s.remove(removed);
      }
  +      else if ( this.added<XDtEjbValueObj:currentAggregateName/>s.contains(removed) 
)
  +      {
  +         this.added<XDtEjbValueObj:currentAggregateName/>s.remove(removed);
  +      }
  +      else throw new IllegalStateException("The value object does not contain 
object to remove");
  +   }
   
      public void 
update<XDtEjbValueObj:currentAggregateName/>(<XDtEjbValueObj:currentAggregateType/> 
updated)
      {
  -      if ( ! this.updated<XDtEjbValueObj:currentAggregateName/>s.contains(updated))
  +      if ( this.<XDtEjbValueObj:currentAggregateName/>s.contains(updated) )
  +      {
  +         if ( ! 
this.updated<XDtEjbValueObj:currentAggregateName/>s.contains(updated)
  +              && ! 
this.added<XDtEjbValueObj:currentAggregateName/>s.contains(updated) )
            this.updated<XDtEjbValueObj:currentAggregateName/>s.add(updated);
  +      }
  +      else throw new IllegalStateException("The value object does not contain 
object to update");
      }
   
      public void clean<XDtEjbValueObj:currentAggregateName/>(){
  
  
  

_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to