View Javadoc
1   package org.kuali.ole.alert.bo;
2   
3   import org.apache.commons.lang.StringUtils;
4   import org.kuali.ole.OLEConstants;
5   import org.kuali.rice.core.api.config.property.ConfigContext;
6   import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
7   
8   import javax.persistence.Transient;
9   import java.sql.Date;
10  
11  /**
12   * Created by maheswarang on 11/4/14.
13   */
14  public class AlertBo extends PersistableBusinessObjectBase {
15  
16      private String alertId;
17  
18      private String documentId;
19  
20      private Date alertDate;
21  
22      private String alertNote;
23  
24      private Date alertCreateDate;
25  
26      private Date alertModifiedDate;
27  
28      private String alertInitiatorId;
29  
30      private String alertModifierId;
31  
32      private boolean alertStatus;
33  
34      private String receivingUserId;
35  
36      private String receivingGroupId;
37  
38      private String receivingRoleId;
39  
40      private boolean editFlag = false;
41  
42      private String alertApproverId;
43  
44      private Date alertApprovedDate;
45  
46      private String action;
47  
48      private String status;
49  
50      private String receivingUserName;
51  
52      private String alertInitiatorName;
53  
54      private String alertModifierName;
55  
56      private String receivingGroupName;
57  
58      private String receivingRoleName;
59  
60      private String alertInterval;
61  
62      private boolean repeatable;
63  
64      private String alertSelector;
65  
66      private String alertDetails;
67  
68      private String linkUrl;
69  
70      public String getDocumentId() {
71          return documentId;
72      }
73  
74      public void setDocumentId(String documentId) {
75          this.documentId = documentId;
76      }
77  
78      public boolean isAlertStatus() {
79          return alertStatus;
80      }
81  
82      public void setAlertStatus(boolean alertStatus) {
83          this.alertStatus = alertStatus;
84      }
85  
86      public String getReceivingUserId() {
87          return receivingUserId;
88      }
89  
90      public void setReceivingUserId(String receivingUserId) {
91          this.receivingUserId = receivingUserId;
92      }
93  
94      public String getReceivingGroupId() {
95          return receivingGroupId;
96      }
97  
98      public void setReceivingGroupId(String receivingGroupId) {
99          this.receivingGroupId = receivingGroupId;
100     }
101 
102     public String getAlertId() {
103         return alertId;
104     }
105 
106     public void setAlertId(String alertId) {
107         this.alertId = alertId;
108     }
109 
110     public Date getAlertDate() {
111         return alertDate;
112     }
113 
114     public void setAlertDate(Date alertDate) {
115         this.alertDate = alertDate;
116     }
117 
118     public String getAlertNote() {
119         return alertNote;
120     }
121 
122     public void setAlertNote(String alertNote) {
123         this.alertNote = alertNote;
124     }
125 
126     public Date getAlertCreateDate() {
127         return alertCreateDate;
128     }
129 
130     public void setAlertCreateDate(Date alertCreateDate) {
131         this.alertCreateDate = alertCreateDate;
132     }
133 
134     public Date getAlertModifiedDate() {
135         return alertModifiedDate;
136     }
137 
138     public void setAlertModifiedDate(Date alertModifiedDate) {
139         this.alertModifiedDate = alertModifiedDate;
140     }
141 
142     public String getAlertInitiatorId() {
143         return alertInitiatorId;
144     }
145 
146     public void setAlertInitiatorId(String alertInitiatorId) {
147         this.alertInitiatorId = alertInitiatorId;
148     }
149 
150     public String getAlertModifierId() {
151         return alertModifierId;
152     }
153 
154     public void setAlertModifierId(String alertModifierId) {
155         this.alertModifierId = alertModifierId;
156     }
157 
158     public boolean isEditFlag() {
159         return editFlag;
160     }
161 
162     public void setEditFlag(boolean editFlag) {
163         this.editFlag = editFlag;
164     }
165 
166     public String getAction() {
167         return action;
168     }
169 
170     public void setAction(String action) {
171         this.action = action;
172     }
173 
174     public String getStatus() {
175         return status;
176     }
177 
178     public void setStatus(String status) {
179         this.status = status;
180     }
181 
182     public String getAlertApproverId() {
183         return alertApproverId;
184     }
185 
186     public void setAlertApproverId(String alertApproverId) {
187         this.alertApproverId = alertApproverId;
188     }
189 
190     public Date getAlertApprovedDate() {
191         return alertApprovedDate;
192     }
193 
194     public void setAlertApprovedDate(Date alertApprovedDate) {
195         this.alertApprovedDate = alertApprovedDate;
196     }
197 
198     public String getReceivingUserName() {
199         return receivingUserName;
200     }
201 
202     public void setReceivingUserName(String receivingUserName) {
203         this.receivingUserName = receivingUserName;
204     }
205 
206     public String getAlertInitiatorName() {
207         return alertInitiatorName;
208     }
209 
210     public void setAlertInitiatorName(String alertInitiatorName) {
211         this.alertInitiatorName = alertInitiatorName;
212     }
213 
214     public String getAlertModifierName() {
215         return alertModifierName;
216     }
217 
218     public void setAlertModifierName(String alertModifierName) {
219         this.alertModifierName = alertModifierName;
220     }
221 
222     public String getReceivingGroupName() {
223         return receivingGroupName;
224     }
225 
226     public void setReceivingGroupName(String receivingGroupName) {
227         this.receivingGroupName = receivingGroupName;
228     }
229 
230     public String getAlertInterval() {
231         return alertInterval;
232     }
233 
234     public void setAlertInterval(String alertInterval) {
235         this.alertInterval = alertInterval;
236     }
237 
238     public boolean isRepeatable() {
239         return repeatable;
240     }
241 
242     public void setRepeatable(boolean repeatable) {
243         this.repeatable = repeatable;
244     }
245 
246     public String getReceivingRoleId() {
247         return receivingRoleId;
248     }
249 
250     public void setReceivingRoleId(String receivingRoleId) {
251         this.receivingRoleId = receivingRoleId;
252     }
253 
254     public String getReceivingRoleName() {
255         return receivingRoleName;
256     }
257 
258     public void setReceivingRoleName(String receivingRoleName) {
259         this.receivingRoleName = receivingRoleName;
260     }
261 
262     public String getAlertSelector() {
263         if(StringUtils.isBlank(alertSelector)) {
264             if(StringUtils.isNotBlank(receivingRoleId)){
265                 alertSelector = OLEConstants.SELECTOR_ROLE;
266             }
267             else if(StringUtils.isNotBlank(receivingGroupId)){
268                 alertSelector = OLEConstants.SELECTOR_GROUP;
269             }
270             else if(StringUtils.isNotBlank(receivingUserId)){
271                 alertSelector = OLEConstants.SELECTOR_PERSON;
272             }
273         }
274         return alertSelector;
275     }
276 
277     public void setAlertSelector(String alertSelector) {
278         this.alertSelector = alertSelector;
279     }
280 
281     public String getAlertDetails() {
282         return alertDetails;
283     }
284 
285     public void setAlertDetails(String alertDetails) {
286         this.alertDetails = alertDetails;
287     }
288 
289     public String getLinkUrl() {
290         if(getAlertSelector().equalsIgnoreCase(OLEConstants.SELECTOR_ROLE)) {
291             linkUrl = ConfigContext.getCurrentContextConfig().getProperty("kim.url") + OLEConstants.ALERT_ROLE_URL + receivingRoleId;
292         } else if(getAlertSelector().equalsIgnoreCase(OLEConstants.SELECTOR_GROUP)) {
293             linkUrl = ConfigContext.getCurrentContextConfig().getProperty("kim.url") + OLEConstants.ALERT_GROUP_URL + receivingGroupId;
294         } else if(getAlertSelector().equalsIgnoreCase(OLEConstants.SELECTOR_PERSON)) {
295             linkUrl = ConfigContext.getCurrentContextConfig().getProperty("kim.url") + OLEConstants.ALERT_PERSON_URL + receivingUserId;
296         }
297         return linkUrl;
298     }
299 
300     public void setLinkUrl(String linkUrl) {
301         this.linkUrl = linkUrl;
302     }
303 }