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

http://datanucleus-appengine.googlecode.com/ · Java · 82 lines · 49 code · 15 blank · 18 comment · 0 complexity · a30d519e7b1295ac950a2612d2973f90 MD5 · raw file

  1. /**********************************************************************
  2. Copyright (c) 2009 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 java.util.ArrayList;
  15. import java.util.List;
  16. import javax.jdo.annotations.Element;
  17. import javax.jdo.annotations.Extension;
  18. import javax.jdo.annotations.IdGeneratorStrategy;
  19. import javax.jdo.annotations.IdentityType;
  20. import javax.jdo.annotations.Order;
  21. import javax.jdo.annotations.PersistenceCapable;
  22. import javax.jdo.annotations.Persistent;
  23. import javax.jdo.annotations.PrimaryKey;
  24. /**
  25. * @author Max Ross <maxr@google.com>
  26. */
  27. @PersistenceCapable(identityType = IdentityType.APPLICATION)
  28. public class HasOneToManyListWithOrderByJDO implements HasOneToManyWithOrderByJDO {
  29. @PrimaryKey
  30. @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  31. private Long id;
  32. @Element(dependent = "true")
  33. @Order(extensions = @Extension(vendorName = "datanucleus", key="list-ordering", value="origin DESC, dest ASC"))
  34. private List<Flight> flightsByOrigAndDest = new ArrayList<Flight>();
  35. @Element(dependent = "true")
  36. @Order(extensions = @Extension(vendorName = "datanucleus", key="list-ordering", value="id DESC, origin ASC"))
  37. private List<Flight> flightsByIdAndOrig = new ArrayList<Flight>();
  38. @Element(dependent = "true")
  39. @Order(extensions = @Extension(vendorName = "datanucleus", key="list-ordering", value="origin DESC, id ASC"))
  40. private List<Flight> flightsByOrigAndId = new ArrayList<Flight>();
  41. @Order(mappedBy="index")
  42. private List<HasExplicitIndexColumnJDO> hasIndexColumn = new ArrayList<HasExplicitIndexColumnJDO>();
  43. @Element(dependent = "true")
  44. @Order(extensions = @Extension(vendorName = "datanucleus", key="list-ordering", value="key ASC"))
  45. List<HasPkWithOverriddenColumnJDO> hasOverridenPk = new ArrayList<HasPkWithOverriddenColumnJDO>();
  46. public Long getId() {
  47. return id;
  48. }
  49. public List<Flight> getFlightsByOrigAndDest() {
  50. return flightsByOrigAndDest;
  51. }
  52. public List<Flight> getFlightsByIdAndOrig() {
  53. return flightsByIdAndOrig;
  54. }
  55. public List<Flight> getFlightsByOrigAndId() {
  56. return flightsByOrigAndId;
  57. }
  58. public List<HasExplicitIndexColumnJDO> getHasIndexColumn() {
  59. return hasIndexColumn;
  60. }
  61. public List<HasPkWithOverriddenColumnJDO> getHasPkWithOverridenColumns() {
  62. return hasOverridenPk;
  63. }
  64. }