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
017 package org.kuali.kfs.module.bc.businessobject;
018
019 import java.text.MessageFormat;
020 import java.util.List;
021
022 import org.kuali.kfs.module.bc.document.service.SalarySettingService;
023 import org.kuali.kfs.sys.context.SpringContext;
024 import org.kuali.rice.kns.util.TypedArrayList;
025
026
027 public class SalarySettingExpansion extends PendingBudgetConstructionGeneralLedger implements PendingBudgetConstructionAppointmentFundingAware {
028
029 private List<PendingBudgetConstructionAppointmentFunding> pendingBudgetConstructionAppointmentFunding;
030
031 /**
032 * Constructs a SalarySettingExpansion.java.
033 */
034 public SalarySettingExpansion() {
035 super();
036
037 pendingBudgetConstructionAppointmentFunding = new TypedArrayList(PendingBudgetConstructionAppointmentFunding.class);
038 }
039
040 /**
041 * Gets the pendingBudgetConstructionAppointmentFunding attribute.
042 *
043 * @return Returns the pendingBudgetConstructionAppointmentFunding.
044 */
045 public List<PendingBudgetConstructionAppointmentFunding> getPendingBudgetConstructionAppointmentFunding() {
046 return pendingBudgetConstructionAppointmentFunding;
047 }
048
049 /**
050 * Sets the pendingBudgetConstructionAppointmentFunding attribute value.
051 *
052 * @param pendingBudgetConstructionAppointmentFunding The pendingBudgetConstructionAppointmentFunding to set.
053 */
054 @Deprecated
055 public void setPendingBudgetConstructionAppointmentFunding(List<PendingBudgetConstructionAppointmentFunding> pendingBudgetConstructionAppointmentFunding) {
056 this.pendingBudgetConstructionAppointmentFunding = pendingBudgetConstructionAppointmentFunding;
057 }
058
059 /**
060 * determine whehter the salary is paid at hourly rate
061 *
062 * @return true if the salary is paid at hourly rate; otherwise, false
063 */
064 public boolean isHourlyPaid() {
065 Integer fiscalYear = this.getUniversityFiscalYear();
066 String chartOfAccountsCode = this.getChartOfAccountsCode();
067 String objectCode = this.getFinancialObjectCode();
068
069 return SpringContext.getBean(SalarySettingService.class).isHourlyPaidObject(fiscalYear, chartOfAccountsCode, objectCode);
070 }
071
072 /**
073 * build the given salary expansion key string
074 */
075 public String getSalarySettingExpansionString() {
076 String pattern = "{0};{1};{2};{3};{4}";
077
078 return MessageFormat.format(pattern, this.getChartOfAccountsCode(), this.getAccountNumber(), this.getSubAccountNumber(), this.getFinancialObjectCode(), this.getFinancialSubObjectCode());
079 }
080
081 /**
082 * @see org.kuali.rice.kns.bo.PersistableBusinessObjectBase#buildListOfDeletionAwareLists()
083 */
084 @Override
085 public List buildListOfDeletionAwareLists() {
086 // return super.buildListOfDeletionAwareLists();
087 List managedLists = super.buildListOfDeletionAwareLists();
088 managedLists.add(this.getPendingBudgetConstructionAppointmentFunding());
089 return managedLists;
090 }
091 }