View Javadoc
1   /**
2    * Copyright 2004-2014 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.kpme.tklm.time.missedpunch;
17  
18  import java.sql.Timestamp;
19  import java.util.ArrayList;
20  import java.util.Date;
21  import java.util.List;
22  
23  import org.kuali.kpme.core.api.assignment.Assignment;
24  import org.kuali.kpme.core.api.groupkey.HrGroupKey;
25  import org.kuali.kpme.core.department.DepartmentBo;
26  import org.kuali.kpme.core.groupkey.HrGroupKeyBo;
27  import org.kuali.kpme.core.job.JobBo;
28  import org.kuali.kpme.core.service.HrServiceLocator;
29  import org.kuali.kpme.core.task.TaskBo;
30  import org.kuali.kpme.core.workarea.WorkAreaBo;
31  import org.kuali.kpme.tklm.api.time.missedpunch.MissedPunchDocumentContract;
32  import org.kuali.rice.krad.document.TransactionalDocumentBase;
33  
34  public class MissedPunchDocument extends TransactionalDocumentBase implements MissedPunchDocumentContract {
35  
36  	private static final long serialVersionUID = -8759488155644037099L;
37  	
38  	private String tkMissedPunchId;
39  	
40  	private MissedPunchBo missedPunch = new MissedPunchBo();
41  
42      private transient HrGroupKeyBo groupKey;
43      private transient JobBo jobObj;
44      private transient WorkAreaBo workAreaObj;
45      private transient DepartmentBo departmentObj;
46      private transient TaskBo taskObj;
47  	public String getTkMissedPunchId() {
48  		return tkMissedPunchId;
49  	}
50  
51  	public void setTkMissedPunchId(String tkMissedPunchId) {
52  		this.tkMissedPunchId = tkMissedPunchId;
53  	}
54  
55  	public MissedPunchBo getMissedPunch() {
56  		return missedPunch;
57  	}
58  
59  	public void setMissedPunch(MissedPunchBo missedPunch) {
60  		this.missedPunch = missedPunch;
61  	}
62  
63  
64      //helper methods!!!!
65      public String getPrincipalId() {
66          return missedPunch.getPrincipalId();
67      }
68  
69      public String getTimesheetDocumentId() {
70          return missedPunch.getTimesheetDocumentId();
71      }
72  
73      public Long getJobNumber() {
74          return missedPunch.getJobNumber();
75      }
76  
77      public Long getWorkArea() {
78          return missedPunch.getWorkArea();
79      }
80  
81      public Long getTask() {
82          return missedPunch.getTask();
83      }
84  
85      public String getGroupKeyCode() {
86          return  missedPunch.getGroupKeyCode();
87      }
88  
89  
90  
91      public Date getActionDateTime() {
92          return null;
93      }
94  
95      public String getClockAction() {
96          return missedPunch.getClockAction();
97      }
98  
99      public String getTkClockLogId() {
100         return missedPunch.getTkClockLogId();
101     }
102 
103     public Timestamp getTimestamp() {
104         return missedPunch.getTimestamp();
105     }
106 
107     public String getDepartment() {
108         return missedPunch.getDepartment();
109     }
110 
111     /*public Date getRelativeEffectiveDate() {
112         return missedPunch.getRelativeEffectiveDate();
113     }*/
114 
115     public HrGroupKeyBo getGroupKey() {
116         return groupKey;
117     }
118     public TaskBo getTaskObj() {
119         return taskObj;
120     }
121 
122     public JobBo getJobObj() {
123         return jobObj;
124     }
125 
126     public WorkAreaBo getWorkAreaObj() {
127         return workAreaObj;
128     }
129 
130     public DepartmentBo getDepartmentObj() {
131         return departmentObj;
132     }
133     
134     @Override
135     public List<Assignment> getAssignments() {
136     	List<Assignment> assignments = new ArrayList<Assignment>();
137     	if( (getMissedPunch() != null) && (getMissedPunch().getActionFullDateTime() != null) ){
138     		assignments =  HrServiceLocator.getAssignmentService().getAssignments(getPrincipalId(), 
139     													getMissedPunch().getActionFullDateTime().toLocalDate());
140     	}
141         return assignments; 
142     }
143 }