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.lm.leaveblock;
017
018 import java.sql.Timestamp;
019
020 import org.kuali.hr.time.service.base.TkServiceLocator;
021 import org.kuali.hr.time.task.Task;
022 import org.kuali.hr.time.util.TKUtils;
023 import org.kuali.hr.time.util.TkConstants;
024 import org.kuali.hr.time.workarea.WorkArea;
025
026 public class LeaveBlockHistory extends LeaveBlock {
027
028 /**
029 *
030 */
031 private static final long serialVersionUID = 1L;
032 private String lmLeaveBlockHistoryId;
033 private String action;
034 private String principalIdDeleted;
035 private Timestamp timestampDeleted;
036
037 public LeaveBlockHistory() {
038 }
039
040 public LeaveBlockHistory(LeaveBlock lb) {
041 this.setLmLeaveBlockId(lb.getLmLeaveBlockId());
042 this.setDocumentId(lb.getDocumentId());
043 this.setAccrualCategory(lb.getAccrualCategory());
044 this.setAccrualGenerated(lb.getAccrualGenerated());
045 this.setApplyToYtdUsed(lb.getApplyToYtdUsed());
046 this.setDescription(lb.getDescription());
047 this.setLeaveAmount(lb.getLeaveAmount());
048 this.setEarnCode(lb.getEarnCode());
049 this.setLeaveDate(lb.getLeaveDate());
050 this.setPrincipalId(lb.getPrincipalId());
051 // this.setPrincipalIdModified(lb.getPrincipalIdModified());
052 this.setRequestStatus(lb.getRequestStatus());
053 this.setTimestamp(lb.getTimestamp());
054 this.setTkAssignmentId(lb.getTkAssignmentId());
055 this.setScheduleTimeOffId(lb.getScheduleTimeOffId());
056 this.setLeaveBlockType(lb.getLeaveBlockType());
057
058 }
059
060
061 public String getLmLeaveBlockHistoryId() {
062 return lmLeaveBlockHistoryId;
063 }
064
065 public void setLmLeaveBlockHistoryId(String lmLeaveBlockHistoryId) {
066 this.lmLeaveBlockHistoryId = lmLeaveBlockHistoryId;
067 }
068
069 public String getAction() {
070 return action;
071 }
072
073 public void setAction(String action) {
074 this.action = action;
075 }
076
077 public String getPrincipalIdDeleted() {
078 return principalIdDeleted;
079 }
080
081 public void setPrincipalIdDeleted(String principalIdDeleted) {
082 this.principalIdDeleted = principalIdDeleted;
083 }
084
085 public Timestamp getTimestampDeleted() {
086 return timestampDeleted;
087 }
088
089 public void setTimestampDeleted(Timestamp timestampDeleted) {
090 this.timestampDeleted = timestampDeleted;
091 }
092
093 public String getAssignmentTitle() {
094 StringBuilder b = new StringBuilder();
095 LeaveBlock lb = TkServiceLocator.getLeaveBlockService().getLeaveBlock(super.getLmLeaveBlockId());
096 if(lb != null){
097 if (lb.getWorkArea() != null) {
098 WorkArea wa = TkServiceLocator.getWorkAreaService().getWorkArea(
099 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 }