View Javadoc
1   /*
2    * Copyright 2005-2006 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.ole.coa.service.impl;
17  
18  import java.util.HashMap;
19  import java.util.Map;
20  
21  import org.kuali.ole.coa.businessobject.SubObjectCode;
22  import org.kuali.ole.coa.service.SubObjectCodeService;
23  import org.kuali.ole.sys.OLEPropertyConstants;
24  import org.kuali.ole.sys.context.SpringContext;
25  import org.kuali.ole.sys.service.NonTransactional;
26  import org.kuali.ole.sys.service.UniversityDateService;
27  import org.kuali.rice.krad.service.BusinessObjectService;
28  
29  /**
30   * This class is the service implementation for the SubObjectCode structure. This is the default implementation that gets delivered
31   * with Kuali.
32   */
33  
34  @NonTransactional
35  public class SubObjectCodeServiceImpl implements SubObjectCodeService {
36      private UniversityDateService universityDateService;
37  
38      /**
39       * @see org.kuali.ole.coa.service.SubObjectCodeService#getByPrimaryId(java.lang.Integer, java.lang.String,
40       *      java.lang.String, java.lang.String, java.lang.String)
41       */
42      public SubObjectCode getByPrimaryId(Integer universityFiscalYear, String chartOfAccountsCode, String accountNumber, String financialObjectCode, String financialSubObjectCode) {
43          
44          Map<String, Object> keys = new HashMap<String, Object>();
45          keys.put(OLEPropertyConstants.UNIVERSITY_FISCAL_YEAR, universityFiscalYear);
46          keys.put(OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE, chartOfAccountsCode);
47          keys.put(OLEPropertyConstants.ACCOUNT_NUMBER, accountNumber);
48          keys.put(OLEPropertyConstants.FINANCIAL_OBJECT_CODE, financialObjectCode);
49          keys.put(OLEPropertyConstants.FINANCIAL_SUB_OBJECT_CODE, financialSubObjectCode);
50          return (SubObjectCode)SpringContext.getBean(BusinessObjectService.class).findByPrimaryKey(SubObjectCode.class, keys);
51      }
52  
53      /**
54       * @see org.kuali.ole.coa.service.SubObjectCodeService#getByPrimaryIdForCurrentYear(java.lang.String, java.lang.String,
55       *      java.lang.String, java.lang.String)
56       */
57      public SubObjectCode getByPrimaryIdForCurrentYear(String chartOfAccountsCode, String accountNumber, String financialObjectCode, String financialSubObjectCode) {
58          return this.getByPrimaryId(universityDateService.getCurrentFiscalYear(), chartOfAccountsCode, accountNumber, financialObjectCode, financialSubObjectCode);
59      }
60  
61      /**
62       * 
63       * This method injects UniversityDateService
64       * @param universityDateService
65       */
66      public void setUniversityDateService(UniversityDateService universityDateService) {
67          this.universityDateService = universityDateService;
68      }
69  }