001 /**
002 * Copyright 2004-2013 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.hr.time.clocklog;
017
018 import java.sql.Timestamp;
019
020 import javax.persistence.Transient;
021
022 import org.kuali.hr.job.Job;
023 import org.kuali.hr.time.task.Task;
024 import org.kuali.hr.time.util.TkConstants;
025 import org.kuali.hr.time.workarea.WorkArea;
026 import org.kuali.rice.kim.api.identity.Person;
027 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
028
029 public class ClockLog extends PersistableBusinessObjectBase {
030
031 private static final long serialVersionUID = -6928657854016622568L;
032
033 private String tkClockLogId;
034 private String principalId;
035 private Long jobNumber;
036 private Long workArea;
037 private Long task;
038 private Timestamp clockTimestamp;
039 private String clockTimestampTimezone;
040 private String clockAction;
041 private String ipAddress;
042 private String userPrincipalId;
043 private Timestamp timestamp;
044 private boolean unapprovedIP = false;
045 @Transient
046 private String documentId;
047
048 private String missedPunchDocumentId;
049
050 private Job job;
051 private WorkArea workAreaObj;
052 private Task taskObj;
053
054 private Person principal;
055
056 public Job getJob() {
057 return job;
058 }
059
060 public void setJob(Job job) {
061 this.job = job;
062 }
063
064 public String getPrincipalId() {
065 return principalId;
066 }
067
068 public void setPrincipalId(String principalId) {
069 this.principalId = principalId;
070 }
071
072 public Long getJobNumber() {
073 return jobNumber;
074 }
075
076 public void setJobNumber(Long jobNumber) {
077 this.jobNumber = jobNumber;
078 }
079
080 public Timestamp getClockTimestamp() {
081 return clockTimestamp;
082 }
083
084 public void setClockTimestamp(Timestamp clockTimestamp) {
085 this.clockTimestamp = clockTimestamp;
086 }
087
088 public String getClockAction() {
089 return clockAction;
090 }
091
092 public void setClockAction(String clockAction) {
093 this.clockAction = clockAction;
094 }
095
096 public String getIpAddress() {
097 return ipAddress;
098 }
099
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 }