001 /* 002 * Copyright 2011 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.kfs.module.ld.businessobject; 017 018 import java.math.BigDecimal; 019 import java.util.LinkedHashMap; 020 021 import org.kuali.kfs.integration.ld.LaborLedgerExpenseTransferTargetAccountingLine; 022 import org.kuali.kfs.integration.ld.LaborLedgerObject; 023 import org.kuali.kfs.sys.KFSPropertyConstants; 024 import org.kuali.kfs.sys.businessobject.TargetAccountingLine; 025 026 /** 027 * Labor business object for special case <code>{@link TargetAccountingLine}</code> type for 028 * <code>{@link org.kuali.module.labor.document.ExpenseTransferDocument}</code> 029 */ 030 public class ExpenseTransferTargetAccountingLine extends TargetAccountingLine implements ExpenseTransferAccountingLine, LaborLedgerExpenseTransferTargetAccountingLine, Comparable<ExpenseTransferTargetAccountingLine> { 031 private String positionNumber; 032 private BigDecimal payrollTotalHours; 033 private Integer payrollEndDateFiscalYear; 034 private String payrollEndDateFiscalPeriodCode; 035 private String emplid; 036 private LaborObject laborObject; 037 038 /** 039 * Constructs a ExpenseTransferTargetAccountingLine.java. 040 */ 041 public ExpenseTransferTargetAccountingLine() { 042 super(); 043 payrollTotalHours = new BigDecimal(0); 044 } 045 046 /** 047 * Gets the positionNumber. 048 * 049 * @return Returns the positionNumber 050 */ 051 public String getPositionNumber() { 052 return positionNumber; 053 } 054 055 /** 056 * Sets the positionNumber. 057 * 058 * @param positionNumber The positionNumber to set. 059 */ 060 public void setPositionNumber(String positionNumber) { 061 this.positionNumber = positionNumber; 062 } 063 064 /** 065 * Gets the payrollTotalHours. 066 * 067 * @return Returns the payrollTotalHours 068 */ 069 public BigDecimal getPayrollTotalHours() { 070 return payrollTotalHours; 071 } 072 073 /** 074 * Sets the payrollTotalHours. 075 * 076 * @param payrollTotalHours The payrollTotalHours to set. 077 */ 078 public void setPayrollTotalHours(BigDecimal payrollTotalHours) { 079 this.payrollTotalHours = payrollTotalHours; 080 } 081 082 /** 083 * Gets the payrollEndDateFiscalYear. 084 * 085 * @return Returns the payrollEndDateFiscalYear 086 */ 087 public Integer getPayrollEndDateFiscalYear() { 088 return payrollEndDateFiscalYear; 089 } 090 091 /** 092 * Sets the payrollEndDateFiscalYear. 093 * 094 * @param payrollEndDateFiscalYear The payrollEndDateFiscalYear to set. 095 */ 096 public void setPayrollEndDateFiscalYear(Integer payrollEndDateFiscalYear) { 097 this.payrollEndDateFiscalYear = payrollEndDateFiscalYear; 098 } 099 100 /** 101 * Gets the payrollEndDateFiscalPeriodCode. 102 * 103 * @return Returns the payrollEndDateFiscalPeriodCode 104 */ 105 public String getPayrollEndDateFiscalPeriodCode() { 106 return payrollEndDateFiscalPeriodCode; 107 } 108 109 /** 110 * Sets the payrollEndDateFiscalPeriodCode. 111 * 112 * @param payrollEndDateFiscalPeriodCode The payrollEndDateFiscalPeriodCode to set. 113 */ 114 public void setPayrollEndDateFiscalPeriodCode(String payrollEndDateFiscalPeriodCode) { 115 this.payrollEndDateFiscalPeriodCode = payrollEndDateFiscalPeriodCode; 116 } 117 118 /** 119 * Gets the emplid. 120 * 121 * @return Returns the emplid 122 */ 123 public String getEmplid() { 124 return emplid; 125 } 126 127 /** 128 * Sets the emplid. 129 * 130 * @param emplid The emplid to set. 131 */ 132 public void setEmplid(String emplid) { 133 this.emplid = emplid; 134 } 135 136 /** 137 * Gets the laborObject. 138 * 139 * @return Returns the laborObject. 140 */ 141 public LaborObject getLaborObject() { 142 return laborObject; 143 } 144 145 /** 146 * Sets the laborObject. 147 * 148 * @param laborObject The laborObject to set. 149 */ 150 @Deprecated 151 public void setLaborObject(LaborObject laborObject) { 152 this.laborObject = laborObject; 153 } 154 155 /** 156 * @see org.kuali.kfs.bo.LaborLedgerExpenseTransferAccoutingLine#getLaborLedgerObject() 157 */ 158 public LaborLedgerObject getLaborLedgerObject() { 159 return this.laborObject; 160 } 161 162 /** 163 * @see org.kuali.kfs.bo.LaborLedgerExpenseTransferAccoutingLine#setLaborLedgerObject(org.kuali.kfs.bo.LaborLedgerObject) 164 */ 165 @Deprecated 166 public void setLaborLedgerObject(LaborLedgerObject laborLedgerObject) { 167 this.laborObject = (LaborObject) laborLedgerObject; 168 } 169 170 /** 171 * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper() 172 */ 173 @SuppressWarnings("unchecked") 174 protected LinkedHashMap toStringMapper() { 175 LinkedHashMap m = new LinkedHashMap(); 176 m.put(KFSPropertyConstants.DOCUMENT_NUMBER, this.getDocumentNumber()); 177 if (this.getSequenceNumber() != null) { 178 m.put("sequenceNumber", this.getSequenceNumber().toString()); 179 } 180 181 return m; 182 } 183 184 /** 185 * Used to for sorting <code>{@link ExpenseTransferAccountingLine}</code> instances within a java 186 * <code>{@link java.util.Collection}</code> by payrollEndDateFisdalYear and payrollEndDateFiscalPeriodCode 187 * 188 * @see java.lang.Comparable#compareTo(T) 189 */ 190 public int compareTo(ExpenseTransferTargetAccountingLine o) { 191 if (o == null) 192 throw new NullPointerException("ExpenseTransferAccountingLine is null"); 193 int retval = 0; 194 retval = getPayrollEndDateFiscalYear().compareTo(o.getPayrollEndDateFiscalYear()); 195 196 if (retval == 0) { 197 retval = new Integer(getPayrollEndDateFiscalPeriodCode()).compareTo(new Integer(o.getPayrollEndDateFiscalPeriodCode())); 198 } 199 200 return retval; 201 } 202 203 /** 204 * Used to copy a particular transaction line into another This method... 205 * 206 * @param from 207 */ 208 public void copyFrom(ExpenseTransferAccountingLine from) { 209 super.copyFrom(from); 210 this.setPayrollTotalHours(from.getPayrollTotalHours()); 211 this.setPositionNumber(from.getPositionNumber()); 212 this.setPayrollEndDateFiscalYear(from.getPayrollEndDateFiscalYear()); 213 this.setPayrollEndDateFiscalPeriodCode(from.getPayrollEndDateFiscalPeriodCode()); 214 this.setEmplid(from.getEmplid()); 215 } 216 }