/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. 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.datanucleus.test.HasPolymorphicRelationsJDO.HasOneToManyJDO;
  15. import com.google.appengine.datanucleus.test.HasPolymorphicRelationsJDO.HasOneToManyLongPkJDO;
  16. import com.google.appengine.datanucleus.test.HasPolymorphicRelationsJDO.HasOneToManyUnencodedStringPkJDO;
  17. import com.google.appengine.datanucleus.test.HasPolymorphicRelationsSetJDO.HasOneToManyLongPkSet;
  18. import com.google.appengine.datanucleus.test.HasPolymorphicRelationsSetJDO.HasOneToManySet;
  19. import com.google.appengine.datanucleus.test.HasPolymorphicRelationsSetJDO.HasOneToManyUnencodedStringPkSet;
  20. import javax.jdo.annotations.Discriminator;
  21. import javax.jdo.annotations.DiscriminatorStrategy;
  22. import javax.jdo.annotations.Extension;
  23. import javax.jdo.annotations.IdGeneratorStrategy;
  24. import javax.jdo.annotations.Inheritance;
  25. import javax.jdo.annotations.InheritanceStrategy;
  26. import javax.jdo.annotations.PersistenceCapable;
  27. import javax.jdo.annotations.Persistent;
  28. import javax.jdo.annotations.PrimaryKey;
  29. public class BidirectionalSuperclassTableChildSetJDO {
  30. @PersistenceCapable(detachable = "true")
  31. @Discriminator(column = "DISCRIMINATOR")
  32. public static class BidirTop implements BidirectionalSuperclassTableChildJDO.BidirTop {
  33. @PrimaryKey
  34. @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  35. @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value="true")
  36. private String id;
  37. private String childVal;
  38. @Persistent
  39. private HasOneToManySet parent;
  40. public void setChildVal(String childVal) {
  41. this.childVal = childVal;
  42. }
  43. public String getChildVal() {
  44. return childVal;
  45. }
  46. public void setParent(HasOneToManyJDO parent) {
  47. this.parent = (HasOneToManySet)parent;
  48. }
  49. public HasOneToManyJDO getParent() {
  50. return this.parent;
  51. }
  52. public String getId() {
  53. return id;
  54. }
  55. public int getPropertyCount() {
  56. return 2; // childVal, DISCRIMINATOR
  57. }
  58. }
  59. @PersistenceCapable(detachable = "true")
  60. public static class BidirMiddle extends BidirTop implements BidirectionalSuperclassTableChildJDO.BidirMiddle {
  61. private Long middleChildVal;
  62. public Long getMiddleChildVal() {
  63. return middleChildVal;
  64. }
  65. public void setMiddleChildVal(Long middleChildVal) {
  66. this.middleChildVal = middleChildVal;
  67. }
  68. public int getPropertyCount() {
  69. return 3; // childVal, middleChildVal, DISCRIMINATOR
  70. }
  71. }
  72. @PersistenceCapable(detachable = "true")
  73. public static class BidirBottom extends BidirMiddle implements BidirectionalSuperclassTableChildJDO.BidirBottom {
  74. private Double bottomChildVal;
  75. public Double getBottomChildVal() {
  76. return bottomChildVal;
  77. }
  78. public void setBottomChildVal(Double bottomChildVal) {
  79. this.bottomChildVal = bottomChildVal;
  80. }
  81. public int getPropertyCount() {
  82. return 4; // childVal, middleChildVal, bottomChildVal, DISCRIMINATOR
  83. }
  84. }
  85. @PersistenceCapable(detachable = "true")
  86. @Discriminator(column = "DISCRIMINATOR")
  87. public static class BidirTopLongPk implements BidirectionalSuperclassTableChildJDO.BidirTopLongPk {
  88. @PrimaryKey
  89. @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  90. @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value="true")
  91. private String id;
  92. private String childVal;
  93. @Persistent
  94. private HasOneToManyLongPkSet parent;
  95. public void setChildVal(String childVal) {
  96. this.childVal = childVal;
  97. }
  98. public String getChildVal() {
  99. return childVal;
  100. }
  101. public void setParent(HasOneToManyLongPkJDO parent) {
  102. this.parent = (HasOneToManyLongPkSet)parent;
  103. }
  104. public HasOneToManyLongPkJDO getParent() {
  105. return this.parent;
  106. }
  107. public String getId() {
  108. return id;
  109. }
  110. }
  111. @PersistenceCapable(detachable = "true")
  112. public static class BidirMiddleLongPk extends BidirTopLongPk implements BidirectionalSuperclassTableChildJDO.BidirMiddleLongPk {
  113. }
  114. @PersistenceCapable(detachable = "true")
  115. public static class BidirBottomLongPk extends BidirMiddleLongPk implements BidirectionalSuperclassTableChildJDO.BidirBottomLongPk {
  116. }
  117. @PersistenceCapable(detachable = "true")
  118. @Inheritance(strategy = InheritanceStrategy.NEW_TABLE)
  119. @Discriminator(strategy = DiscriminatorStrategy.VALUE_MAP, value = "T")
  120. public static class BidirTopUnencodedStringPkJDO implements BidirectionalSuperclassTableChildJDO.BidirTopUnencodedStringPkJDO {
  121. @PrimaryKey
  122. @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  123. @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value="true")
  124. private String id;
  125. private String childVal;
  126. @Persistent
  127. private HasOneToManyUnencodedStringPkSet parent;
  128. public void setChildVal(String childVal) {
  129. this.childVal = childVal;
  130. }
  131. public String getChildVal() {
  132. return childVal;
  133. }
  134. public void setParent(HasOneToManyUnencodedStringPkJDO parent) {
  135. this.parent = (HasOneToManyUnencodedStringPkSet)parent;
  136. }
  137. public HasOneToManyUnencodedStringPkJDO getParent() {
  138. return this.parent;
  139. }
  140. public String getId() {
  141. return id;
  142. }
  143. }
  144. @PersistenceCapable(detachable = "true")
  145. @Inheritance(strategy = InheritanceStrategy.SUPERCLASS_TABLE)
  146. @Discriminator(value = "M")
  147. public static class BidirMiddleUnencodedStringPk extends BidirTopUnencodedStringPkJDO implements BidirectionalSuperclassTableChildJDO.BidirMiddleUnencodedStringPkJDO {
  148. }
  149. @PersistenceCapable(detachable = "true")
  150. @Inheritance(strategy = InheritanceStrategy.SUPERCLASS_TABLE)
  151. @Discriminator(value = "B")
  152. public static class BidirBottomUnencodedStringPk extends BidirMiddleUnencodedStringPk implements BidirectionalSuperclassTableChildJDO.BidirBottomUnencodedStringPkJDO {
  153. }
  154. }