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 documentId;
035 private String principalId;
036 private Long jobNumber;
037 private Long workArea;
038 private Long task;
039 private Timestamp clockTimestamp;
040 private String clockTimestampTimezone;
041 private String clockAction;
042 private String ipAddress;
043 private String userPrincipalId;
044 private Timestamp timestamp;
045 private boolean unapprovedIP = false;
046
047 @Transient
048 private String missedPunchDocumentId;
049
050 private transient Job job;
051 private transient WorkArea workAreaObj;
052 private transient Task taskObj;
053
054 private transient Person principal;
055
056 public String getTkClockLogId() {
057 return tkClockLogId;
058 }
059
060 public void setTkClockLogId(String tkClockLogId) {
061 this.tkClockLogId = tkClockLogId;
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 String getDocumentId() {
073 return documentId;
074 }
075
076 public void setDocumentId(String documentId) {
077 this.documentId = documentId;
078 }
079
080 public Long getJobNumber() {
081 return jobNumber;
082 }
083
084 public void setJobNumber(Long jobNumber) {
085 this.jobNumber = jobNumber;
086 }
087
088 public Timestamp getClockTimestamp() {
089 return clockTimestamp;
090 }
091
092 public void setClockTimestamp(Timestamp clockTimestamp) {
093 this.clockTimestamp = clockTimestamp;
094 }
095
096 public String getClockAction() {
097 return clockAction;
098 }
099
100 public void setClockAction(String clockAction) {
101 this.clockAction = clockAction;
102 }
103
104 public String getIpAddress() {
105 return ipAddress;
106 }
107
108 public void setIpAddress(String ipAddress) {
109 this.ipAddress = ipAddress;
110 }
111
112 public String getUserPrincipalId() {
113 return userPrincipalId;
114 }
115
116 public void setUserPrincipalId(String userPrincipalId) {
117 this.userPrincipalId = userPrincipalId;
118 }
119
120 public Timestamp getTimestamp() {
121 return timestamp;
122 }
123
124 public void setTimestamp(Timestamp timestamp) {
125 this.timestamp = timestamp;
126 }
127
128 public String getClockTimestampTimezone() {
129 return clockTimestampTimezone;
130 }
131
132 public void setClockTimestampTimezone(String clockTimestampTimezone) {
133 this.clockTimestampTimezone = clockTimestampTimezone;
134 }
135
136 /**
137 * TODO: Fix this - may need to return multiple actions, depending on how we want the system to work.
138 * @return
139 */
140 public String getNextValidClockAction() {
141 String ret;
142
143 if (this.getClockAction().equals(TkConstants.CLOCK_IN)) {
144 ret = TkConstants.CLOCK_OUT;
145 } else if (this.getClockAction().equals(TkConstants.CLOCK_OUT)) {
146 ret = TkConstants.CLOCK_IN;
147 } else if (this.getClockAction().equals(TkConstants.LUNCH_IN)) {
148 ret = TkConstants.LUNCH_OUT;
149 } else if (this.getClockAction().equals(TkConstants.LUNCH_OUT)) {
150 ret = TkConstants.LUNCH_IN;
151 } else {
152 ret = TkConstants.CLOCK_IN;
153 }
154
155 return ret;
156 }
157
158 public Job getJob() {
159 return job;
160 }
161
162 public void setJob(Job job) {
163 this.job = job;
164 }
165
166 public WorkArea getWorkAreaObj() {
167 return workAreaObj;
168 }
169
170 public void setWorkAreaObj(WorkArea workAreaObj) {
171 this.workAreaObj = workAreaObj;
172 }
173
174 public Task getTaskObj() {
175 return taskObj;
176 }
177
178 public void setTaskObj(Task taskObj) {
179 this.taskObj = taskObj;
180 }
181
182 public void setWorkArea(Long workArea) {
183 this.workArea = workArea;
184 }
185
186 public void setTask(Long task) {
187 this.task = task;
188 }
189 public Long getWorkArea() {
190 return workArea;
191 }
192 public Long getTask() {
193 return task;
194 }
195
196 public Person getPrincipal() {
197 return principal;
198 }
199
200 public void setPrincipal(Person principal) {
201 this.principal = principal;
202 }
203
204 public String getMissedPunchDocumentId() {
205 return missedPunchDocumentId;
206 }
207
208 public void setMissedPunchDocumentId(String missedPunchDocumentId) {
209 this.missedPunchDocumentId = missedPunchDocumentId;
210 }
211
212 public boolean getUnapprovedIP() {
213 return unapprovedIP;
214 }
215
216 public void setUnapprovedIP(boolean unapprovedIP) {
217 this.unapprovedIP = unapprovedIP;
218 }
219
220 }