/[volute]/trunk/projects/theory/snapdm/res/jpa.xsl
ViewVC logotype

Diff of /trunk/projects/theory/snapdm/res/jpa.xsl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 522 by gerard.lemson, Fri May 16 05:35:37 2008 UTC revision 523 by bourges.laurent, Mon May 19 16:41:03 2008 UTC
# Line 183  Line 183 
183        </xsl:otherwise>        </xsl:otherwise>
184      </xsl:choose>      </xsl:choose>
185    </xsl:template>    </xsl:template>
186    
187    <xsl:template match="reference" mode="JPAAnnotation_identity">    <xsl:template match="reference" mode="JPAAnnotation_identity">
188    @Transient    @Transient
189    </xsl:template>    </xsl:template>
190            
191    
192    
# Line 238  Line 238 
238     */     */
239    @Override    @Override
240    public boolean equals(final Object object, final boolean isDeep) {    public boolean equals(final Object object, final boolean isDeep) {
241      // first : identity comparison :      /* identity, nullable, class and identifiers checks */
242      if (this == object) {      if( !(super.equals(object, isDeep)))
       return true;  
     }  
   
                 if (!(object instanceof <xsl:value-of select="$name"/>)) {  
                         return false;  
                 }  
                 if( !(super.equals(object, isDeep)))  
243                    return false;                    return false;
244                                        
245                  final <xsl:value-of select="$name"/> other = (<xsl:value-of select="$name"/>) object;      /* do check values (attributes / references / collections) */  
246      <xsl:choose>      <xsl:choose>
247      <xsl:when test="./name() = 'objectType'">        <xsl:when test="name() = 'dataType'">
248                  if (this.id != other.id      if (true) {
249                                  &amp;&amp; (this.id == null || !this.id.equals(other.id))) {        </xsl:when>
250                          return false;        <xsl:otherwise>
251                  }      if (isDeep) {
252                  else {        </xsl:otherwise>
253                                  /* This should be a state error, as JPA should not be able to accommodate      </xsl:choose>
254                    two objecttYpe instances with the same ID, but which are not ==      
255                    For the same reason we should not need further testing (attributes etc)        final <xsl:value-of select="$name"/> other = (<xsl:value-of select="$name"/>) object;
256                    on objectTypes. */        <xsl:for-each select="attribute">
257                  }        if (this.<xsl:value-of select="name"/> != other.<xsl:value-of select="name"/>
258                  </xsl:when>            &amp;&amp; (this.<xsl:value-of select="name"/> == null || !this.<xsl:value-of select="name"/>.equals(other.<xsl:value-of select="name"/>))) {
259                  <xsl:otherwise> <!-- dataType -->          return false;
260                    <xsl:for-each select="attribute">        }
                 if (this.<xsl:value-of select="name"/> != other.<xsl:value-of select="name"/>  
                                 &amp;&amp; (this.<xsl:value-of select="name"/> == null || !this.<xsl:value-of select="name"/>.equals(other.<xsl:value-of select="name"/>))) {  
                         return false;  
                 }  
261                    </xsl:for-each>                    </xsl:for-each>
262                  </xsl:otherwise>      }
                 </xsl:choose>  
263                                    
264                  return true;                  return true;
265          }          }

Legend:
Removed from v.522  
changed lines
  Added in v.523

msdemlei@ari.uni-heidelberg.de
ViewVC Help
Powered by ViewVC 1.1.26