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

http://datanucleus-appengine.googlecode.com/ · Java · 319 lines · 221 code · 83 blank · 15 comment · 0 complexity · dafb6111bbdac6a2363811cbc897ebc7 MD5 · raw file

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