/v3.2/nimbits-tds/src/com/nimbits/client/model/connection/ConnectionRequestModel.java

http://nimbits-server.googlecode.com/ · Java · 153 lines · 111 code · 30 blank · 12 comment · 2 complexity · 39f3c53791014805c912aeea969408f8 MD5 · raw file

  1. /*
  2. * Copyright (c) 2010 Tonic Solutions LLC.
  3. *
  4. * http://www.nimbits.com
  5. *
  6. *
  7. * Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
  8. *
  9. * http://www.gnu.org/licenses/gpl.html
  10. *
  11. * Unless required by applicable law or agreed to in writing, software distributed under the license is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
  12. */
  13. package com.nimbits.client.model.connection;
  14. import com.extjs.gxt.ui.client.data.BaseModelData;
  15. import com.nimbits.client.model.email.EmailAddress;
  16. import java.io.Serializable;
  17. import java.util.Date;
  18. public class ConnectionRequestModel extends BaseModelData implements Serializable, Connection {
  19. private Long key;
  20. private Long requestorID;
  21. private EmailAddress requestorEmail;
  22. private EmailAddress targetEmail;
  23. private Date requestDate;
  24. private Date approvedDate;
  25. private String uuid;
  26. private Boolean approved;
  27. private Boolean rejected;
  28. private static final long serialVersionUID = 1L;
  29. public ConnectionRequestModel() {
  30. }
  31. public ConnectionRequestModel(final long requestorID,
  32. final EmailAddress requestorEmail,
  33. final EmailAddress targetEmail,
  34. final String uuid) {
  35. this.requestorID = requestorID;
  36. this.targetEmail = targetEmail;
  37. this.requestorEmail = requestorEmail;
  38. this.requestDate = new Date();
  39. this.approved = false;
  40. this.rejected = false;
  41. this.uuid = uuid;
  42. }
  43. public ConnectionRequestModel(Connection c) {
  44. this.requestorID = c.getRequestorID();
  45. this.targetEmail = c.getTargetEmail();
  46. this.requestorEmail = c.getRequestorEmail();
  47. this.requestDate = c.getRequestDate();
  48. this.approved = c.getApproved();
  49. this.rejected = c.getRejected();
  50. this.uuid = c.getUUID();
  51. }
  52. @Override
  53. public long getRequestorID() {
  54. return requestorID;
  55. }
  56. @Override
  57. public void setRequestorID(final long requestorID) {
  58. this.requestorID = requestorID;
  59. }
  60. @Override
  61. public EmailAddress getTargetEmail() {
  62. return targetEmail;
  63. }
  64. @Override
  65. public void setTargetEmail(EmailAddress targetEmail) {
  66. this.targetEmail = targetEmail;
  67. }
  68. @Override
  69. public Date getRequestDate() {
  70. return new Date(this.requestDate.getTime());
  71. }
  72. @Override
  73. public void setRequestDate(Date requestDate) {
  74. this.requestDate = new Date(requestDate.getTime());
  75. }
  76. @Override
  77. public Date getApprovedDate() {
  78. return new Date(this.approvedDate.getTime());
  79. }
  80. @Override
  81. public void setApprovedDate(Date approvedDate) {
  82. this.approvedDate = new Date(approvedDate.getTime());
  83. }
  84. @Override
  85. public String getUUID() {
  86. return uuid;
  87. }
  88. @Override
  89. public void setUUID(String uUID) {
  90. uuid = uUID;
  91. }
  92. @Override
  93. public Boolean getApproved() {
  94. return approved;
  95. }
  96. @Override
  97. public void setApproved(boolean approved) {
  98. this.approved = approved;
  99. }
  100. @Override
  101. public Long getKey() {
  102. return key;
  103. }
  104. @Override
  105. public void setRequestorEmail(EmailAddress requestorEmail) {
  106. this.requestorEmail = requestorEmail;
  107. }
  108. @Override
  109. public EmailAddress getRequestorEmail() {
  110. return requestorEmail;
  111. }
  112. @Override
  113. public void setRejected(boolean rejected) {
  114. this.rejected = rejected;
  115. }
  116. @Override
  117. public Boolean getRejected() {
  118. if (rejected == null) {
  119. rejected = false;
  120. }
  121. return rejected;
  122. }
  123. }