PageRenderTime 42ms CodeModel.GetById 34ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 1ms

/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
 14package com.nimbits.client.model.connection;
 15
 16import com.extjs.gxt.ui.client.data.BaseModelData;
 17import com.nimbits.client.model.email.EmailAddress;
 18
 19import java.io.Serializable;
 20import java.util.Date;
 21
 22
 23public class ConnectionRequestModel extends BaseModelData implements Serializable, Connection {
 24    private Long key;
 25    private Long requestorID;
 26    private EmailAddress requestorEmail;
 27    private EmailAddress targetEmail;
 28    private Date requestDate;
 29    private Date approvedDate;
 30    private String uuid;
 31    private Boolean approved;
 32    private Boolean rejected;
 33    private static final long serialVersionUID = 1L;
 34
 35    public ConnectionRequestModel() {
 36    }
 37
 38    public ConnectionRequestModel(final long requestorID,
 39                                  final EmailAddress requestorEmail,
 40                                  final EmailAddress targetEmail,
 41                                  final String uuid) {
 42        this.requestorID = requestorID;
 43        this.targetEmail = targetEmail;
 44        this.requestorEmail = requestorEmail;
 45        this.requestDate = new Date();
 46        this.approved = false;
 47        this.rejected = false;
 48        this.uuid = uuid;
 49
 50    }
 51
 52    public ConnectionRequestModel(Connection c) {
 53        this.requestorID = c.getRequestorID();
 54        this.targetEmail = c.getTargetEmail();
 55        this.requestorEmail = c.getRequestorEmail();
 56        this.requestDate = c.getRequestDate();
 57        this.approved = c.getApproved();
 58        this.rejected = c.getRejected();
 59        this.uuid = c.getUUID();
 60    }
 61
 62    @Override
 63    public long getRequestorID() {
 64        return requestorID;
 65    }
 66
 67    @Override
 68    public void setRequestorID(final long requestorID) {
 69        this.requestorID = requestorID;
 70    }
 71
 72    @Override
 73    public EmailAddress getTargetEmail() {
 74        return targetEmail;
 75    }
 76
 77    @Override
 78    public void setTargetEmail(EmailAddress targetEmail) {
 79        this.targetEmail = targetEmail;
 80    }
 81
 82    @Override
 83    public Date getRequestDate() {
 84
 85        return new Date(this.requestDate.getTime());
 86    }
 87
 88    @Override
 89    public void setRequestDate(Date requestDate) {
 90        this.requestDate = new Date(requestDate.getTime());
 91    }
 92
 93    @Override
 94    public Date getApprovedDate() {
 95
 96        return new Date(this.approvedDate.getTime());
 97    }
 98
 99    @Override
100    public void setApprovedDate(Date approvedDate) {
101        this.approvedDate = new Date(approvedDate.getTime());
102    }
103
104    @Override
105    public String getUUID() {
106        return uuid;
107    }
108
109    @Override
110    public void setUUID(String uUID) {
111        uuid = uUID;
112    }
113
114    @Override
115    public Boolean getApproved() {
116        return approved;
117    }
118
119    @Override
120    public void setApproved(boolean approved) {
121        this.approved = approved;
122    }
123
124    @Override
125    public Long getKey() {
126        return key;
127    }
128
129    @Override
130    public void setRequestorEmail(EmailAddress requestorEmail) {
131        this.requestorEmail = requestorEmail;
132    }
133
134    @Override
135    public EmailAddress getRequestorEmail() {
136        return requestorEmail;
137    }
138
139    @Override
140    public void setRejected(boolean rejected) {
141        this.rejected = rejected;
142    }
143
144    @Override
145    public Boolean getRejected() {
146        if (rejected == null) {
147            rejected = false;
148        }
149        return rejected;
150    }
151
152
153}