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.lm.leaveblock;
17  
18  import java.sql.Timestamp;
19  
20  import org.kuali.hr.time.service.base.TkServiceLocator;
21  import org.kuali.hr.time.task.Task;
22  import org.kuali.hr.time.util.TKUtils;
23  import org.kuali.hr.time.util.TkConstants;
24  import org.kuali.hr.time.workarea.WorkArea;
25  
26  public class LeaveBlockHistory extends LeaveBlock {
27  
28  	/**
29  	 * 
30  	 */
31  	private static final long serialVersionUID = 1L;
32  	private String lmLeaveBlockHistoryId;
33  	private String action;
34  	private String principalIdDeleted;
35  	private Timestamp timestampDeleted;
36  	
37  	public LeaveBlockHistory() {
38  	}
39  
40  	public LeaveBlockHistory(LeaveBlock lb) {
41  		this.setLmLeaveBlockId(lb.getLmLeaveBlockId());
42  		this.setDocumentId(lb.getDocumentId());
43  		this.setAccrualCategory(lb.getAccrualCategory());
44  		this.setAccrualGenerated(lb.getAccrualGenerated());
45  		this.setApplyToYtdUsed(lb.getApplyToYtdUsed());
46  		this.setDescription(lb.getDescription());
47  		this.setLeaveAmount(lb.getLeaveAmount());
48  		this.setEarnCode(lb.getEarnCode());
49  		this.setLeaveDate(lb.getLeaveDate());
50  		this.setPrincipalId(lb.getPrincipalId());
51  //		this.setPrincipalIdModified(lb.getPrincipalIdModified());
52  		this.setRequestStatus(lb.getRequestStatus());
53  		this.setTimestamp(lb.getTimestamp());
54  		this.setTkAssignmentId(lb.getTkAssignmentId());
55  		this.setScheduleTimeOffId(lb.getScheduleTimeOffId());
56  		this.setLeaveBlockType(lb.getLeaveBlockType());
57  		
58  	}
59  	
60  	
61  	public String getLmLeaveBlockHistoryId() {
62  		return lmLeaveBlockHistoryId;
63  	}
64  
65  	public void setLmLeaveBlockHistoryId(String lmLeaveBlockHistoryId) {
66  		this.lmLeaveBlockHistoryId = lmLeaveBlockHistoryId;
67  	}
68  
69  	public String getAction() {
70  		return action;
71  	}
72  
73  	public void setAction(String action) {
74  		this.action = action;
75  	}
76  
77  	public String getPrincipalIdDeleted() {
78  		return principalIdDeleted;
79  	}
80  
81  	public void setPrincipalIdDeleted(String principalIdDeleted) {
82  		this.principalIdDeleted = principalIdDeleted;
83  	}
84  
85  	public Timestamp getTimestampDeleted() {
86  		return timestampDeleted;
87  	}
88  
89  	public void setTimestampDeleted(Timestamp timestampDeleted) {
90  		this.timestampDeleted = timestampDeleted;
91  	}
92  
93  	public String getAssignmentTitle() {
94  		StringBuilder b = new StringBuilder();
95  		LeaveBlock lb = TkServiceLocator.getLeaveBlockService().getLeaveBlock(super.getLmLeaveBlockId());
96  		if(lb != null){
97  			if (lb.getWorkArea() != null) {
98  				WorkArea wa = TkServiceLocator.getWorkAreaService().getWorkArea(
99  					lb.getWorkArea(), TKUtils.getCurrentDate());
100 				if (wa != null) {
101 					b.append(wa.getDescription());
102 				}
103 				Task task = TkServiceLocator.getTaskService().getTask(
104 						this.getTask(), this.getLeaveDate());
105 				if (task != null) {
106 					// do not display task description if the task is the default
107 					// one
108 					// default task is created in getTask() of TaskService
109 					if (!task.getDescription()
110 						.equals(TkConstants.TASK_DEFAULT_DESP)) {
111 						b.append("-" + task.getDescription());
112 					}
113 				}
114 			}
115 		}
116 		return b.toString();
117 	}
118 
119 }