View Javadoc

1   /**
2    * Copyright 2011 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  
16  package org.kuali.mobility.push.entity;
17  
18  import java.io.Serializable;
19  import java.sql.Timestamp;
20  
21  import javax.persistence.Column;
22  import javax.persistence.Entity;
23  import javax.persistence.GeneratedValue;
24  import javax.persistence.GenerationType;
25  import javax.persistence.Id;
26  import javax.persistence.NamedQueries;
27  import javax.persistence.NamedQuery;
28  import javax.persistence.Table;
29  import javax.persistence.Version;
30  
31  /**
32   * A class representing a Push Notification message.
33   * 
34   * @author Kuali Mobility Team (mobility.dev@kuali.org)
35   * @since 2.0.0
36   */
37  
38  
39  @Entity
40  @Table(name="KME_PSH_SNDR_T")
41  public class Sender implements Serializable {
42  
43  	private static final long serialVersionUID = 1594899851834068598L;
44  	
45  	/**
46  	 * ID for this <code>Sender</code> instance.
47  	 */
48  	@Id
49  	@GeneratedValue(strategy = GenerationType.TABLE)
50      @Column(name="ID")
51      private Long id;	
52  	
53  	/**
54  	 * Name of the sender. Normal text.  
55  	 */
56      @Column(name="NM")
57      private String name;    
58      
59  	/**
60  	 * Hidden denotes whether the sender is visible in the user's Opt-in/Opt-out preferences page.  
61  	 */
62      @Column(name="HDN")
63      private boolean hidden;	
64      
65  	/**
66  	 * shortname of the sender. No whitespace. 
67  	 */
68      @Column(name="SNM")
69      private String shortName;    
70  
71  	/**
72  	 * Description of the sender.  
73  	 */
74      @Column(name="DSCRP")
75      private String description;
76  
77  	/**
78  	 * Username of the person 
79  	 */
80      @Column(name="USR")
81      private String username;
82  
83  	/**
84  	 * Sender Key is used for verification of a given sender it is required when submitting a http POST.
85  	 * Typically a 20 character alphanumeric. 
86  	 */
87      @Column(name="SENDER_KEY")
88      private String senderKey;
89      
90  	/**
91  	 * The timestamp of the last update for this <code>Device</code> details.
92  	 */
93      @Column(name="PST_TS")
94      private Timestamp postedTimestamp;    
95         
96  	/**
97  	 * Version number for this <code>Device</code> record
98  	 */
99      @Version
100     @Column(name="VER_NBR")
101     private Long versionNumber;
102 
103 	/**
104 	 * Creates a new instance of a <code>Sender</code>
105 	 */
106     public Sender(){}
107 
108 	/**
109 	 * Gets the ID for this <code>Sender</code>
110 	 * @return ID for this <code>Sender</code>
111 	 */
112 	public Long getId() {
113 		return id;
114 	}
115 
116 	/**
117 	 * Sets the id
118 	 * @param id The URL
119 	 */
120 	public void setId(Long id) {
121 		this.id = id;
122 	}
123 
124 	/**
125 	 * Gets the Name for this <code>Sender</code>
126 	 * @return Name for this <code>Sender</code>
127 	 */
128 	public String getName() {
129 		return name;
130 	}
131 
132 	/**
133 	 * Sets the Name
134 	 * @param name The Name
135 	 */
136 	public void setName(String name) {
137 		this.name = name;
138 	}
139 
140 	/**
141 	 * Gets the boolean for hidden for this <code>Sender</code>
142 	 * @return hidden for this <code>Sender</code>
143 	 */
144 	public boolean isHidden() {
145 		return hidden;
146 	}
147 
148 	/**
149 	 * Sets the hidden
150 	 * @param hidden The Hidden
151 	 */
152 	public void setHidden(boolean hidden) {
153 		this.hidden = hidden;
154 	}
155 
156 	/**
157 	 * Gets the shortName for this <code>Sender</code>
158 	 * @return shortName for this <code>Sender</code>
159 	 */
160 	public String getShortName() {
161 		return shortName;
162 	}
163 
164 	/**
165 	 * Sets the ShortName
166 	 * @param shortName The ShortName
167 	 */
168 	public void setShortName(String shortName) {
169 		this.shortName = shortName;
170 	}
171 
172 	/**
173 	 * Gets the description for this <code>Sender</code>
174 	 * @return description for this <code>Sender</code>
175 	 */
176 	public String getDescription() {
177 		return description;
178 	}
179 
180 	/**
181 	 * Sets the Description
182 	 * @param description The Description
183 	 */
184 	public void setDescription(String description) {
185 		this.description = description;
186 	}
187 
188 	/**
189 	 * Gets the username for this <code>Sender</code>
190 	 * @return username for this <code>Sender</code>
191 	 */	
192 	public String getUsername() {
193 		return username;
194 	}
195 
196 	/**
197 	 * Sets the Username
198 	 * @param username The Username
199 	 */
200 	public void setUsername(String username) {
201 		this.username = username;
202 	}
203 
204 	/**
205 	 * Gets the senderKey for this <code>Sender</code>
206 	 * @return senderKey for this <code>Sender</code>
207 	 */
208 	public String getSenderKey() {
209 		return senderKey;
210 	}
211 
212 	/**
213 	 * Sets the SenderKey
214 	 * @param senderKey The SenderKey
215 	 */
216 	public void setSenderKey(String senderKey) {
217 		this.senderKey = senderKey;
218 	}
219 
220 	/**
221 	 * Gets the postedTimestamp for this <code>Sender</code>
222 	 * @return postedTimestamp for this <code>Sender</code>
223 	 */
224 	public Timestamp getPostedTimestamp() {
225 		return postedTimestamp;
226 	}
227 
228 	/**
229 	 * Sets the PostedTimestamp
230 	 * @param postedTiemstamp The PostedTimestamp
231 	 */
232 	public void setPostedTimestamp(Timestamp postedTimestamp) {
233 		this.postedTimestamp = postedTimestamp;
234 	}
235 
236 	/**
237 	 * Gets the versionNumber for this <code>Sender</code>
238 	 * @return versionNumber for this <code>Sender</code>
239 	 */
240 	public Long getVersionNumber() {
241 		return versionNumber;
242 	}
243 
244 	/**
245 	 * Sets the VersionNumber
246 	 * @param versionNumber The VersionNumber
247 	 */
248 	public void setVersionNumber(Long versionNumber) {
249 		this.versionNumber = versionNumber;
250 	}
251 
252 	/*
253 	 * (non-Javadoc)
254 	 * @see java.lang.Object#toString()
255 	 */
256 	@Override
257 	public String toString() {
258 		return "\nSender Object:" + 
259 				"\nid=" + id + 
260 				"\nname=" + name + 
261 				"\nshortName=" + shortName + 
262 				"\nhidden=" + (hidden?"true":"false") + 
263 				"\ndescription=" + description + 
264 				"\nusername=" + username + 
265 				"\nsenderKey=" + senderKey + 
266 				"\npostedTimestamp="+ postedTimestamp + "\n";
267 	}
268     
269 	
270     
271 }