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  		this.setBeginTimestamp(lb.getBeginTimestamp());
58  		this.setEndTimestamp(lb.getEndTimestamp());
59  	}
60  	
61  	
62  	public String getLmLeaveBlockHistoryId() {
63  		return lmLeaveBlockHistoryId;
64  	}
65  
66  	public void setLmLeaveBlockHistoryId(String lmLeaveBlockHistoryId) {
67  		this.lmLeaveBlockHistoryId = lmLeaveBlockHistoryId;
68  	}
69  
70  	public String getAction() {
71  		return action;
72  	}
73  
74  	public void setAction(String action) {
75  		this.action = action;
76  	}
77  
78  	public String getPrincipalIdDeleted() {
79  		return principalIdDeleted;
80  	}
81  
82  	public void setPrincipalIdDeleted(String principalIdDeleted) {
83  		this.principalIdDeleted = principalIdDeleted;
84  	}
85  
86  	public Timestamp getTimestampDeleted() {
87  		return timestampDeleted;
88  	}
89  
90  	public void setTimestampDeleted(Timestamp timestampDeleted) {
91  		this.timestampDeleted = timestampDeleted;
92  	}
93  
94  	public String getAssignmentTitle() {
95  		StringBuilder b = new StringBuilder();
96  		LeaveBlock lb = TkServiceLocator.getLeaveBlockService().getLeaveBlock(super.getLmLeaveBlockId());
97  		if(lb != null){
98  			if (lb.getWorkArea() != null) {
99  				WorkArea wa = TkServiceLocator.getWorkAreaService().getWorkArea(
100 					lb.getWorkArea(), TKUtils.getCurrentDate());
101 				if (wa != null) {
102 					b.append(wa.getDescription());
103 				}
104 				Task task = TkServiceLocator.getTaskService().getTask(
105 						this.getTask(), this.getLeaveDate());
106 				if (task != null) {
107 					// do not display task description if the task is the default
108 					// one
109 					// default task is created in getTask() of TaskService
110 					if (!task.getDescription()
111 						.equals(TkConstants.TASK_DEFAULT_DESP)) {
112 						b.append("-" + task.getDescription());
113 					}
114 				}
115 			}
116 		}
117 		return b.toString();
118 	}
119 
120 }