View Javadoc
1   package org.kuali.ole.alert.bo;
2   
3   import org.kuali.ole.alert.bo.AlertDocument;
4   import org.kuali.ole.alert.bo.AlertEvent;
5   import org.kuali.rice.kim.api.services.KimApiServiceLocator;
6   import org.kuali.rice.kim.framework.type.KimTypeService;
7   import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
8   
9   import java.sql.Date;
10  
11  /**
12   * Created by maheswarang on 8/12/14.
13   */
14  public class AlertConditionAndReceiverInformation extends PersistableBusinessObjectBase {
15  
16      private String alertConditionId;
17  
18      private String groupId;
19  
20      private String roleId;
21  
22      private String principalId;
23  
24      private String alertEventId;
25  
26      private String alertEventName;
27  
28      private String alertNote;
29  
30      private boolean email;
31  
32      private boolean alert;
33  
34      /*private Date alertDate;*/
35  
36      private String alertInterval;
37  
38      private String alertDocumentId;
39  
40      private AlertDocument alertDocument;
41  
42      private AlertEvent alertEvent;
43  
44      private String principalName;
45  
46      private String groupName;
47  
48      private String roleName;
49  
50  
51      public String getAlertConditionId() {
52          return alertConditionId;
53      }
54  
55      public void setAlertConditionId(String alertConditionId) {
56          this.alertConditionId = alertConditionId;
57      }
58  
59      public String getGroupId() {
60          return groupId;
61      }
62  
63      public void setGroupId(String groupId) {
64          this.groupId = groupId;
65      }
66  
67      public String getRoleId() {
68          return roleId;
69      }
70  
71      public void setRoleId(String roleId) {
72          this.roleId = roleId;
73      }
74  
75      public String getPrincipalId() {
76          return principalId;
77      }
78  
79      public void setPrincipalId(String principalId) {
80          this.principalId = principalId;
81      }
82  
83      public String getAlertNote() {
84          return alertNote;
85      }
86  
87      public void setAlertNote(String alertNote) {
88          this.alertNote = alertNote;
89      }
90  
91      public String getAlertEventName() {
92          if(alertEventName == null && alertEvent!=null){
93              alertEventName = alertEvent.getAlertEventName();
94          }
95          return alertEventName;
96      }
97  
98      public void setAlertEventName(String alertEventName) {
99          this.alertEventName = alertEventName;
100     }
101 
102     public boolean isEmail() {
103         return email;
104     }
105 
106     public void setEmail(boolean email) {
107         this.email = email;
108     }
109 
110     public boolean isAlert() {
111         return alert;
112     }
113 
114     public void setAlert(boolean alert) {
115         this.alert = alert;
116     }
117 
118 /*    public Date getAlertDate() {
119         return alertDate;
120     }
121 
122     public void setAlertDate(Date alertDate) {
123         this.alertDate = alertDate;
124     }*/
125 
126     public String getAlertInterval() {
127         return alertInterval;
128     }
129 
130     public void setAlertInterval(String alertInterval) {
131         this.alertInterval = alertInterval;
132     }
133 
134     public String getAlertDocumentId() {
135         return alertDocumentId;
136     }
137 
138     public void setAlertDocumentId(String alertDocumentId) {
139         this.alertDocumentId = alertDocumentId;
140     }
141 
142     public AlertDocument getAlertDocument() {
143         return alertDocument;
144     }
145 
146     public void setAlertDocument(AlertDocument alertDocument) {
147         this.alertDocument = alertDocument;
148     }
149 
150     public String getAlertEventId() {
151         return alertEventId;
152     }
153 
154     public void setAlertEventId(String alertEventId) {
155         this.alertEventId = alertEventId;
156     }
157 
158     public AlertEvent getAlertEvent() {
159         return alertEvent;
160     }
161 
162     public void setAlertEvent(AlertEvent alertEvent) {
163         this.alertEvent = alertEvent;
164     }
165 
166     public String getPrincipalName() {
167         if((principalName == null || (principalName!=null && principalName.trim().isEmpty())) && (principalId!=null && !principalId.trim().isEmpty())){
168             try{
169             principalName= KimApiServiceLocator.getPersonService().getPerson(principalId).getPrincipalName();
170             }catch(Exception e){
171                 e.printStackTrace();
172             }
173             }
174         return principalName;
175     }
176 
177     public void setPrincipalName(String principalName) {
178         this.principalName = principalName;
179     }
180 
181     public String getGroupName() {
182         if((groupName == null || (groupName!=null && groupName.trim().isEmpty())) && (groupId!=null && !groupId.trim().isEmpty())){
183            try{
184             groupName = KimApiServiceLocator.getGroupService().getGroup(groupId).getName();
185            }catch(Exception e){
186                e.printStackTrace();
187            }
188         }
189         return groupName;
190     }
191 
192     public void setGroupName(String groupName) {
193         this.groupName = groupName;
194     }
195 
196     public String getRoleName() {
197         if((roleName == null || (roleName!=null && roleName.trim().isEmpty())) && (roleId!=null && !roleId.trim().isEmpty())){
198             try{
199                 roleName = KimApiServiceLocator.getRoleService().getRole(roleId).getName();
200             }catch(Exception e){
201                 e.printStackTrace();
202             }
203         }
204         return roleName;
205     }
206 
207     public void setRoleName(String roleName) {
208         this.roleName = roleName;
209     }
210 }