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.ar.businessobject.defaultvalue; 017 018 import java.util.HashMap; 019 import java.util.Map; 020 021 import org.kuali.kfs.module.ar.ArConstants; 022 import org.kuali.kfs.module.ar.businessobject.SystemInformation; 023 import org.kuali.kfs.sys.businessobject.ChartOrgHolder; 024 import org.kuali.kfs.sys.context.SpringContext; 025 import org.kuali.kfs.sys.service.FinancialSystemUserService; 026 import org.kuali.kfs.sys.service.UniversityDateService; 027 import org.kuali.rice.kns.service.BusinessObjectService; 028 import org.kuali.rice.kns.util.GlobalVariables; 029 030 public class SystemInformationValueFinderBase { 031 032 protected SystemInformation systemInformation; 033 034 /** 035 * Constructs a SystemInformationValueFinderBase. Sets the SystemInformation BO based on current 036 * year, current users chart of account code, and current users organization code 037 */ 038 public SystemInformationValueFinderBase(){ 039 040 ChartOrgHolder chartUser = SpringContext.getBean(FinancialSystemUserService.class).getPrimaryOrganization(GlobalVariables.getUserSession().getPerson(), ArConstants.AR_NAMESPACE_CODE); 041 042 Map criteria = new HashMap(); 043 criteria.put("universityFiscalYear", SpringContext.getBean(UniversityDateService.class).getCurrentFiscalYear()); 044 criteria.put("processingChartOfAccountCode", chartUser.getChartOfAccountsCode()); 045 criteria.put("processingOrganizationCode", chartUser.getOrganizationCode()); 046 systemInformation = (SystemInformation)SpringContext.getBean(BusinessObjectService.class).findByPrimaryKey(SystemInformation.class, criteria); 047 } 048 } 049