PageRenderTime 32ms CodeModel.GetById 0ms RepoModel.GetById 1ms app.codeStats 0ms

/src/com/jieshuhuiyou/entity/notifications/ReturnBookNotification.java

https://bitbucket.org/psjay/ants-bookbase
Java | 68 lines | 45 code | 16 blank | 7 comment | 3 complexity | 877c0083f905ad95d1dea07b1f00b0c7 MD5 | raw file
  1. package com.jieshuhuiyou.entity.notifications;
  2. import com.alibaba.fastjson.annotation.JSONCreator;
  3. import com.alibaba.fastjson.annotation.JSONField;
  4. import com.jieshuhuiyou.entity.Borrow;
  5. import com.jieshuhuiyou.entity.Notification.Type;
  6. import com.jieshuhuiyou.entity.User;
  7. /**
  8. * ????
  9. * @author PSJay
  10. *
  11. */
  12. public class ReturnBookNotification extends AbstractNotification {
  13. private Borrow borrow;
  14. private User operator;
  15. private boolean operateByBorrower;
  16. @JSONCreator
  17. public ReturnBookNotification(@JSONField(name = "borrow") Borrow borrow
  18. , @JSONField(name = "operator") User operator) {
  19. this.borrow = borrow;
  20. this.operator = operator;
  21. }
  22. @Override
  23. public String toHTML() {
  24. // TODO Auto-generated method stub
  25. return null;
  26. }
  27. @Override
  28. public User getOwner() {
  29. if(operator == null || operator.equals(borrow.getSharing().getUser())) {
  30. return borrow.getSharing().getUser();
  31. }
  32. operateByBorrower = true;
  33. return borrow.getUser();
  34. }
  35. @Override
  36. public Type getType() {
  37. return Type.RETURN_BOOK;
  38. }
  39. // setters and getters
  40. public Borrow getBorrow() {
  41. return borrow;
  42. }
  43. public void setBorrow(Borrow borrow) {
  44. this.borrow = borrow;
  45. }
  46. public boolean isOperateByBorrower() {
  47. return operateByBorrower;
  48. }
  49. public void setOperateByBorrower(boolean operateByBorrower) {
  50. this.operateByBorrower = operateByBorrower;
  51. }
  52. }