PageRenderTime 26ms CodeModel.GetById 12ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/com/google/appengine/datanucleus/test/BidirectionalSuperclassTableChildSetJDO.java

http://datanucleus-appengine.googlecode.com/
Java | 205 lines | 142 code | 48 blank | 15 comment | 0 complexity | f7433907e784f1c73fa5bfce196c8835 MD5 | raw file
  1/**********************************************************************
  2 Copyright (c) 2011 Google Inc.
  3
  4 Licensed under the Apache License, Version 2.0 (the "License");
  5 you may not use this file except in compliance with the License.
  6 You may obtain a copy of the License at
  7
  8 http://www.apache.org/licenses/LICENSE-2.0
  9
 10 Unless required by applicable law or agreed to in writing, software
 11 distributed under the License is distributed on an "AS IS" BASIS,
 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13 See the License for the specific language governing permissions and
 14 limitations under the License.
 15 **********************************************************************/
 16package com.google.appengine.datanucleus.test;
 17
 18import com.google.appengine.datanucleus.test.HasPolymorphicRelationsJDO.HasOneToManyJDO;
 19import com.google.appengine.datanucleus.test.HasPolymorphicRelationsJDO.HasOneToManyLongPkJDO;
 20import com.google.appengine.datanucleus.test.HasPolymorphicRelationsJDO.HasOneToManyUnencodedStringPkJDO;
 21import com.google.appengine.datanucleus.test.HasPolymorphicRelationsSetJDO.HasOneToManyLongPkSet;
 22import com.google.appengine.datanucleus.test.HasPolymorphicRelationsSetJDO.HasOneToManySet;
 23import com.google.appengine.datanucleus.test.HasPolymorphicRelationsSetJDO.HasOneToManyUnencodedStringPkSet;
 24
 25import javax.jdo.annotations.Discriminator;
 26import javax.jdo.annotations.DiscriminatorStrategy;
 27import javax.jdo.annotations.Extension;
 28import javax.jdo.annotations.IdGeneratorStrategy;
 29import javax.jdo.annotations.Inheritance;
 30import javax.jdo.annotations.InheritanceStrategy;
 31import javax.jdo.annotations.PersistenceCapable;
 32import javax.jdo.annotations.Persistent;
 33import javax.jdo.annotations.PrimaryKey;
 34
 35public class BidirectionalSuperclassTableChildSetJDO {
 36  
 37  @PersistenceCapable(detachable = "true")
 38  @Discriminator(column = "DISCRIMINATOR")
 39  public static class BidirTop implements BidirectionalSuperclassTableChildJDO.BidirTop {
 40
 41    @PrimaryKey
 42    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
 43    @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value="true")
 44    private String id;
 45
 46    private String childVal;
 47    
 48    @Persistent
 49    private HasOneToManySet parent;
 50    
 51    public void setChildVal(String childVal) {
 52      this.childVal = childVal;
 53    }
 54
 55    public String getChildVal() {
 56      return childVal;
 57    }
 58
 59    public void setParent(HasOneToManyJDO parent) {
 60      this.parent = (HasOneToManySet)parent;
 61    }
 62
 63    public HasOneToManyJDO getParent() {
 64      return this.parent;
 65    }
 66
 67    public String getId() {
 68      return id;
 69    }
 70
 71    public int getPropertyCount() {
 72      return 2; // childVal, DISCRIMINATOR
 73    }
 74    
 75  }
 76  
 77  @PersistenceCapable(detachable = "true")
 78  public static class BidirMiddle extends BidirTop implements BidirectionalSuperclassTableChildJDO.BidirMiddle {
 79    private Long middleChildVal;
 80
 81    public Long getMiddleChildVal() {
 82      return middleChildVal;
 83    }
 84
 85    public void setMiddleChildVal(Long middleChildVal) {
 86      this.middleChildVal = middleChildVal;
 87    }
 88    
 89    public int getPropertyCount() {
 90      return 3; // childVal, middleChildVal, DISCRIMINATOR
 91    }
 92
 93  }
 94  
 95  @PersistenceCapable(detachable = "true")
 96  public static class BidirBottom extends BidirMiddle implements BidirectionalSuperclassTableChildJDO.BidirBottom {
 97    private Double bottomChildVal;
 98
 99    public Double getBottomChildVal() {
100      return bottomChildVal;
101    }
102
103    public void setBottomChildVal(Double bottomChildVal) {
104      this.bottomChildVal = bottomChildVal;
105    }
106
107    public int getPropertyCount() {
108      return 4; // childVal, middleChildVal, bottomChildVal, DISCRIMINATOR
109    }
110  }
111  
112
113  @PersistenceCapable(detachable = "true")
114  @Discriminator(column = "DISCRIMINATOR")
115  public static class BidirTopLongPk implements BidirectionalSuperclassTableChildJDO.BidirTopLongPk {
116
117    @PrimaryKey
118    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
119    @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value="true")
120    private String id;
121
122    private String childVal;
123    
124    @Persistent
125    private HasOneToManyLongPkSet parent;
126    
127    public void setChildVal(String childVal) {
128      this.childVal = childVal;
129    }
130
131    public String getChildVal() {
132      return childVal;
133    }
134
135    public void setParent(HasOneToManyLongPkJDO parent) {
136      this.parent = (HasOneToManyLongPkSet)parent;
137    }
138
139    public HasOneToManyLongPkJDO getParent() {
140      return this.parent;
141    }
142
143    public String getId() {
144      return id;
145    }
146    
147  }
148  
149  @PersistenceCapable(detachable = "true")
150  public static class BidirMiddleLongPk extends BidirTopLongPk implements BidirectionalSuperclassTableChildJDO.BidirMiddleLongPk {
151  }
152  
153  @PersistenceCapable(detachable = "true")
154  public static class BidirBottomLongPk extends BidirMiddleLongPk implements BidirectionalSuperclassTableChildJDO.BidirBottomLongPk {
155  }
156  
157  @PersistenceCapable(detachable = "true")
158  @Inheritance(strategy = InheritanceStrategy.NEW_TABLE)
159  @Discriminator(strategy = DiscriminatorStrategy.VALUE_MAP, value = "T")
160  public static class BidirTopUnencodedStringPkJDO implements BidirectionalSuperclassTableChildJDO.BidirTopUnencodedStringPkJDO {
161
162    @PrimaryKey
163    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
164    @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value="true")
165    private String id;
166
167    private String childVal;
168    
169    @Persistent
170    private HasOneToManyUnencodedStringPkSet parent;
171    
172    public void setChildVal(String childVal) {
173      this.childVal = childVal;
174    }
175
176    public String getChildVal() {
177      return childVal;
178    }
179
180    public void setParent(HasOneToManyUnencodedStringPkJDO parent) {
181      this.parent = (HasOneToManyUnencodedStringPkSet)parent;
182    }
183
184    public HasOneToManyUnencodedStringPkJDO getParent() {
185      return this.parent;
186    }
187
188    public String getId() {
189      return id;
190    }
191    
192  }
193  
194  @PersistenceCapable(detachable = "true")
195  @Inheritance(strategy = InheritanceStrategy.SUPERCLASS_TABLE)
196  @Discriminator(value = "M")
197  public static class BidirMiddleUnencodedStringPk extends BidirTopUnencodedStringPkJDO implements BidirectionalSuperclassTableChildJDO.BidirMiddleUnencodedStringPkJDO {
198  }
199
200  @PersistenceCapable(detachable = "true")
201  @Inheritance(strategy = InheritanceStrategy.SUPERCLASS_TABLE)
202  @Discriminator(value = "B")
203  public static class BidirBottomUnencodedStringPk extends BidirMiddleUnencodedStringPk implements BidirectionalSuperclassTableChildJDO.BidirBottomUnencodedStringPkJDO {
204  }
205}