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.coa.service.impl; 017 018 import java.util.List; 019 020 import org.apache.log4j.Logger; 021 import org.kuali.kfs.coa.businessobject.SubAccount; 022 import org.kuali.kfs.coa.dataaccess.SubAccountDao; 023 import org.kuali.kfs.coa.service.SubAccountService; 024 import org.kuali.kfs.sys.service.NonTransactional; 025 import org.kuali.rice.kns.util.spring.Cached; 026 027 /** 028 * This class is the service implementation for the SubAccount structure. This is the default implementation that gets delivered 029 * with Kuali. 030 */ 031 032 @NonTransactional 033 public class SubAccountServiceImpl implements SubAccountService { 034 private static final Logger LOG = Logger.getLogger(SubAccountServiceImpl.class); 035 036 private SubAccountDao subAccountDao; 037 038 /** 039 * @see org.kuali.kfs.coa.service.SubAccountService#getByPrimaryId(java.lang.String, java.lang.String, java.lang.String) 040 */ 041 public SubAccount getByPrimaryId(String chartOfAccountsCode, String accountNumber, String subAccountNumber) { 042 return subAccountDao.getByPrimaryId(chartOfAccountsCode, accountNumber, subAccountNumber); 043 } 044 045 /** 046 * Method is used by KualiAccountAttribute to enable caching of accounts for routing. 047 * 048 * @see org.kuali.kfs.coa.service.impl.SubAccountServiceImpl#getByPrimaryId(String, String, String) 049 */ 050 @Cached 051 public SubAccount getByPrimaryIdWithCaching(String chartOfAccountsCode, String accountNumber, String subAccountNumber) { 052 return subAccountDao.getByPrimaryId(chartOfAccountsCode, accountNumber, subAccountNumber); 053 } 054 055 /** 056 * Retrieves SubAccount objects associated with the given chart-org-subAccount code combination 057 * 058 * @param chartOfAccountsCode - 'Reports To' Chart of Accounts Code 059 * @param organizationCode - 'Reports To' Organization Code 060 * @param subAccountNumber - Sub Account Number 061 * @return a list of SubAccount objects 062 */ 063 public List getSubAccountsByReportsToOrganization(String chartOfAccountsCode, String organizationCode, String subAccountNumber) { 064 return subAccountDao.getSubAccountsByReportsToOrganization(chartOfAccountsCode, organizationCode, subAccountNumber); 065 } 066 067 /** 068 * @return SubAccountDao 069 */ 070 public SubAccountDao getSubAccountDao() { 071 return subAccountDao; 072 } 073 074 /** 075 * @param subAccountDao 076 */ 077 public void setSubAccountDao(SubAccountDao subAccountDao) { 078 this.subAccountDao = subAccountDao; 079 } 080 }