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