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

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

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

revision 689 by bourges.laurent, Wed Jul 9 21:49:27 2008 UTC revision 690 by bourges.laurent, Thu Jul 10 15:27:40 2008 UTC
# Line 445  Line 445 
445        /**        /**
446         * Creates a new <xsl:value-of select="$className"/> for the given Container Entity. &lt;br&gt;         * Creates a new <xsl:value-of select="$className"/> for the given Container Entity. &lt;br&gt;
447         *         *
448         * The Parent Container CAN NOT BE NULL, so call EntityManager.persist(parent) first !         * The Parent Container CAN NOT BE NULL
449         *         *
450         * @param pContainer the parent container CAN NOT BE NULL, so call EntityManager.persist(parent) first !         * @param pContainer the parent container CAN NOT BE NULL
451         */         */
452        public <xsl:value-of select="$className"/>(final <xsl:value-of select="$type"/> pContainer) {        public <xsl:value-of select="$className"/>(final <xsl:value-of select="$type"/> pContainer) {
453          super();          super();
# Line 476  Line 476 
476           * Sets the Container Entity == 'Parent' ONLY           * Sets the Container Entity == 'Parent' ONLY
477           * @param pContainer the parent container           * @param pContainer the parent container
478           */           */
479          public void setContainerField(final <xsl:value-of select="$type"/> pContainer) {          private void setContainerField(final <xsl:value-of select="$type"/> pContainer) {
480            this.container = pContainer;            this.container = pContainer;
481          }          }
482    
483          /**          /**
484           * Sets the Container Entity == 'Parent' and adds this to the appropriate collection on the container.           * Sets the Container Entity == 'Parent' and adds this to the appropriate collection on the container.
485           *           *
486           * The Parent Container CAN NOT BE NULL, so call EntityManager.persist(parent) first !           * @param pContainer the parent container CAN NOT BE NULL
          *  TODO decide on whether the Id must have been set.  
          *       Should (it?) be possible to deal with classes outside of JPA context?  
          * @param pContainer the parent container CAN NOT BE NULL, so call EntityManager.persist(parent) first !  
487           *           *
488           * @throws IllegalStateException if pContainer == null or pContainer.getId() is undefined !           * @throws IllegalStateException if pContainer is null !
489           */           */
490          protected void setContainer(final <xsl:value-of select="$type"/> pContainer) {          protected void setContainer(final <xsl:value-of select="$type"/> pContainer) {
491            // TODO : its primary key can be null ? : call em.persist(container) first !            if (pContainer == null) {
           if (pContainer == null) /* || pContainer.getId() == null) */  
           {  
492              throw new IllegalStateException("The parent container can not be null !");              throw new IllegalStateException("The parent container can not be null !");
493            }            }
494            setContainerField(pContainer);            setContainerField(pContainer);
495            pContainer.add<xsl:value-of select="$collection"/>(this);            pContainer.add<xsl:value-of select="$collection"/>(this);
496          }          }
497    
498            /**
499             * Returns the Rank in the collection
500             * @return rank
501             */
502            public int getRank() {
503              return this.rank;
504            }
505    
506            /**
507             * Sets the Rank
508             * @param pRank rank in the parent collection
509             */
510            protected void setRank(final int pRank) {
511              this.rank = pRank;
512            }
513        </xsl:if>        </xsl:if>
514    
515        <xsl:if test="$hasExtends = 0">        <xsl:if test="$hasExtends = 0">
# Line 546  Line 557 
557            if (PROPERTY_CONTAINER.equals(propertyName)) {            if (PROPERTY_CONTAINER.equals(propertyName)) {
558              return getContainer();              return getContainer();
559            }            }
560              if (PROPERTY_RANK.equals(propertyName)) {
561                return Integer.valueOf(getRank());
562              }
563          </xsl:if>          </xsl:if>
564    
565          <!-- TODO collection support ? -->          <!-- TODO collection support ? -->
# Line 586  Line 600 
600              setContainerField((<xsl:value-of select="$type"/>) value);              setContainerField((<xsl:value-of select="$type"/>) value);
601              return true;              return true;
602            }            }
603              if (PROPERTY_RANK.equals(propertyName)) {
604                setRank(((Integer)value).intValue());
605                return true;
606              }
607          </xsl:if>          </xsl:if>
608    
609          <!-- TODO collection support ? -->          <!-- TODO collection support ? -->

Legend:
Removed from v.689  
changed lines
  Added in v.690

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