/src/main/java/com/google/ie/business/domain/Tag.java

http://thoughtsite.googlecode.com/ · Java · 134 lines · 69 code · 20 blank · 45 comment · 0 complexity · 583d996b29402b5b82e2408788d6f746 MD5 · raw file

  1. /* Copyright 2010 Google Inc.
  2. *
  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. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS.
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License
  14. */
  15. package com.google.ie.business.domain;
  16. import org.compass.annotations.Searchable;
  17. import org.compass.annotations.SearchableId;
  18. import org.compass.annotations.SearchableProperty;
  19. import java.io.Serializable;
  20. import java.util.Date;
  21. import javax.jdo.annotations.Extension;
  22. import javax.jdo.annotations.IdGeneratorStrategy;
  23. import javax.jdo.annotations.IdentityType;
  24. import javax.jdo.annotations.PersistenceCapable;
  25. import javax.jdo.annotations.Persistent;
  26. import javax.jdo.annotations.PrimaryKey;
  27. @PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
  28. @Searchable(alias = "Tag")
  29. public class Tag implements Serializable, Comparable<Tag> {
  30. /** A unique identifier for the class */
  31. private static final long serialVersionUID = 6800326271810454423L;
  32. public static final String FIELD_WEIGHTAGE = "weightage";
  33. @PrimaryKey
  34. @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  35. @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
  36. @SearchableId
  37. private String key;
  38. @Persistent
  39. @SearchableProperty
  40. private String title;
  41. @Persistent
  42. @SearchableProperty
  43. private int weightage;
  44. @Persistent
  45. private Date createdOn;
  46. @Persistent
  47. private Date updatedOn;
  48. public Tag() {
  49. }
  50. /**
  51. * @return the title
  52. */
  53. public String getTitle() {
  54. return title;
  55. }
  56. /**
  57. * @param title the title to set
  58. */
  59. public void setTitle(String title) {
  60. this.title = title;
  61. }
  62. /**
  63. * @return the weightage
  64. */
  65. public int getWeightage() {
  66. return weightage;
  67. }
  68. /**
  69. * @param weightage the weightage to set
  70. */
  71. public void setWeightage(int weightage) {
  72. this.weightage = weightage;
  73. }
  74. /**
  75. * @return the createdOn
  76. */
  77. public Date getCreatedOn() {
  78. return createdOn;
  79. }
  80. /**
  81. * @param createdOn the createdOn to set
  82. */
  83. public void setCreatedOn(Date createdOn) {
  84. this.createdOn = createdOn;
  85. }
  86. /**
  87. * @return the updatedOn
  88. */
  89. public Date getUpdatedOn() {
  90. return updatedOn;
  91. }
  92. /**
  93. * @param updatedOn the updatedOn to set
  94. */
  95. public void setUpdatedOn(Date updatedOn) {
  96. this.updatedOn = updatedOn;
  97. }
  98. /**
  99. * @param key the key to set
  100. */
  101. public void setKey(String key) {
  102. this.key = key;
  103. }
  104. /**
  105. * @return the key
  106. */
  107. public String getKey() {
  108. return key;
  109. }
  110. @Override
  111. public int compareTo(Tag o) {
  112. return this.weightage - o.weightage;
  113. }
  114. }