Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.99 KB | None | 0 0
  1. @Document(collection="todos")
  2. public class Todo {
  3. @Id
  4. private String id;
  5.  
  6. @NotBlank
  7. @Size(max=250)
  8. @Indexed(unique=true)
  9. private String title;
  10.  
  11. private Boolean completed = false;
  12.  
  13. private Date createdAt = new Date();
  14.  
  15. public Todo() {
  16. super();
  17. }
  18.  
  19. public Todo(String title) {
  20. this.title = title;
  21. }
  22.  
  23. public String getId() {
  24. return id;
  25. }
  26.  
  27. public void setId(String id) {
  28. this.id = id;
  29. }
  30.  
  31. public String getTitle() {
  32. return title;
  33. }
  34.  
  35. public void setTitle(String title) {
  36. this.title = title;
  37. }
  38.  
  39. public Boolean getCompleted() {
  40. return completed;
  41. }
  42.  
  43. public void setCompleted(Boolean completed) {
  44. this.completed = completed;
  45. }
  46.  
  47. public Date getCreatedAt() {
  48. return createdAt;
  49. }
  50.  
  51. public void setCreatedAt(Date createdAt) {
  52. this.createdAt = createdAt;
  53. }
  54.  
  55. @Override
  56. public String toString() {
  57. return String.format(
  58. "Todo[id=%s, title='%s', completed='%s']",
  59. id, title, completed);
  60. }
  61. }
  62.  
  63. @Repository
  64. public interface TodoRepository extends MongoRepository<Todo, String> {
  65. public List<Todo> findAll();
  66. public Todo findOne(String id);
  67. public Todo save(Todo todo);
  68. public void delete(Todo todo);
  69. }
  70.  
  71. @Document(collection = "courses")
  72. public class Courses {
  73. @Id
  74. private String id;
  75. private String name;
  76. private String lecturer;
  77. private String picture;
  78. private String video;
  79. private String description;
  80. private String enroled;
  81.  
  82. public Courses(){}
  83.  
  84. public Courses(String name, String lecturer, String picture, String video, String description,String enroled) {
  85. this.name = name;
  86. this.lecturer = lecturer;
  87. this.picture = picture;
  88. this.video = video;
  89. this.description = description;
  90. this.enroled = enroled;
  91. }
  92.  
  93. public String getId() {
  94. return id;
  95. }
  96. public void setId(String id) {
  97. this.id = id;
  98. }
  99. public String getName() {
  100. return name;
  101. }
  102. public void setName(String name) {
  103. this.name = name;
  104. }
  105. public String getLecturer() {
  106. return lecturer;
  107. }
  108. public void setLecturer(String lecturer) {
  109. this.lecturer = lecturer;
  110. }
  111. public String getPicture() {
  112. return picture;
  113. }
  114. public void setPicture(String picture) {
  115. this.picture = picture;
  116. }
  117. public String getVideo() {
  118. return video;
  119. }
  120. public void setVideo(String video) {
  121. this.video = video;
  122. }
  123. public String getDescription() {
  124. return description;
  125. }
  126. public void setDescription(String description) {
  127. this.description = description;
  128. }
  129. public String getEnroled() {
  130. return enroled;
  131. }
  132. public void setEnroled(String enroled) {
  133. this.enroled = enroled;
  134. }
  135.  
  136. @Override
  137. public String toString() {
  138. return "Courses{" +
  139. "id='" + id + "'" +
  140. ", name='" + name + "'" +
  141. ", lecturer='" + lecturer + "'" +
  142. ", description='" + description + "'" +
  143. '}';
  144. }
  145. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement