View Javadoc

1   /**
2    * Copyright 2004-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.hr.time.clocklog;
17  
18  import java.sql.Timestamp;
19  
20  import javax.persistence.Transient;
21  
22  import org.kuali.hr.job.Job;
23  import org.kuali.hr.time.task.Task;
24  import org.kuali.hr.time.util.TkConstants;
25  import org.kuali.hr.time.workarea.WorkArea;
26  import org.kuali.rice.kim.api.identity.Person;
27  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
28  
29  public class ClockLog extends PersistableBusinessObjectBase {
30  
31  	private static final long serialVersionUID = -6928657854016622568L;
32  	
33  	private String tkClockLogId;
34      private String principalId;
35      private Long jobNumber;
36      private Long workArea;
37      private Long task;
38      private Timestamp clockTimestamp;
39      private String clockTimestampTimezone;
40      private String clockAction;
41      private String ipAddress;
42      private String userPrincipalId;
43      private Timestamp timestamp;
44      private boolean unapprovedIP = false;
45      @Transient
46      private String documentId;
47      
48      private String missedPunchDocumentId;
49  
50      private Job job;
51      private WorkArea workAreaObj;
52      private Task taskObj;
53  
54      private Person principal;
55  
56  	public Job getJob() {
57  		return job;
58  	}
59  
60  	public void setJob(Job job) {
61  		this.job = job;
62  	}
63  
64  	public String getPrincipalId() {
65          return principalId;
66      }
67  
68      public void setPrincipalId(String principalId) {
69          this.principalId = principalId;
70      }
71  
72      public Long getJobNumber() {
73          return jobNumber;
74      }
75  
76      public void setJobNumber(Long jobNumber) {
77          this.jobNumber = jobNumber;
78      }
79  
80      public Timestamp getClockTimestamp() {
81          return clockTimestamp;
82      }
83  
84      public void setClockTimestamp(Timestamp clockTimestamp) {
85          this.clockTimestamp = clockTimestamp;
86      }
87  
88      public String getClockAction() {
89          return clockAction;
90      }
91  
92      public void setClockAction(String clockAction) {
93          this.clockAction = clockAction;
94      }
95  
96      public String getIpAddress() {
97          return ipAddress;
98      }
99  
100     public void setIpAddress(String ipAddress) {
101         this.ipAddress = ipAddress;
102     }
103 
104     public String getUserPrincipalId() {
105         return userPrincipalId;
106     }
107 
108     public void setUserPrincipalId(String userPrincipalId) {
109         this.userPrincipalId = userPrincipalId;
110     }
111 
112     public Timestamp getTimestamp() {
113         return timestamp;
114     }
115 
116     public void setTimestamp(Timestamp timestamp) {
117         this.timestamp = timestamp;
118     }
119 
120     public String getClockTimestampTimezone() {
121         return clockTimestampTimezone;
122     }
123 
124     public void setClockTimestampTimezone(String clockTimestampTimezone) {
125         this.clockTimestampTimezone = clockTimestampTimezone;
126     }
127 
128     /**
129      * TODO: Fix this - may need to return multiple actions, depending on how we want the system to work.
130      * @return
131      */
132     public String getNextValidClockAction() {
133 	String ret;
134 
135 	if (this.getClockAction().equals(TkConstants.CLOCK_IN)) {
136 	    ret = TkConstants.CLOCK_OUT;
137 	} else if (this.getClockAction().equals(TkConstants.CLOCK_OUT)) {
138 	    ret = TkConstants.CLOCK_IN;
139 	} else if (this.getClockAction().equals(TkConstants.LUNCH_IN)) {
140 	    ret = TkConstants.LUNCH_OUT;
141 	} else if (this.getClockAction().equals(TkConstants.LUNCH_OUT)) {
142 	    ret = TkConstants.LUNCH_IN;
143 	} else {
144 	    ret = TkConstants.CLOCK_IN;
145 	}
146 
147 	return ret;
148     }
149 
150 	public String getTkClockLogId() {
151 		return tkClockLogId;
152 	}
153 
154 	public void setTkClockLogId(String tkClockLogId) {
155 		this.tkClockLogId = tkClockLogId;
156 	}
157 
158 	public WorkArea getWorkAreaObj() {
159 		return workAreaObj;
160 	}
161 
162 	public void setWorkAreaObj(WorkArea workAreaObj) {
163 		this.workAreaObj = workAreaObj;
164 	}
165 
166 	public Task getTaskObj() {
167 		return taskObj;
168 	}
169 
170 	public void setTaskObj(Task taskObj) {
171 		this.taskObj = taskObj;
172 	}
173 
174 	public void setWorkArea(Long workArea) {
175 		this.workArea = workArea;
176 	}
177 
178 	public void setTask(Long task) {
179 		this.task = task;
180 	}
181 	public Long getWorkArea() {
182 		return workArea;
183 	}
184 	public Long getTask() {
185 		return task;
186 	}
187 
188 	public Person getPrincipal() {
189 		return principal;
190 	}
191 
192 	public void setPrincipal(Person principal) {
193 		this.principal = principal;
194 	}
195 
196 	public String getMissedPunchDocumentId() {
197 		return missedPunchDocumentId;
198 	}
199 
200 	public void setMissedPunchDocumentId(String missedPunchDocumentId) {
201 		this.missedPunchDocumentId = missedPunchDocumentId;
202 	}
203 
204 	public boolean getUnapprovedIP() {
205 		return unapprovedIP;
206 	}
207 
208 	public void setUnapprovedIP(boolean unapprovedIP) {
209 		this.unapprovedIP = unapprovedIP;
210 	}
211 
212 	public String getDocumentId() {
213 		return documentId;
214 	}
215 
216 	public void setDocumentId(String documentId) {
217 		this.documentId = documentId;
218 	}
219 	
220 }