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.sys; 017 018 import java.io.File; 019 import java.util.ArrayList; 020 import java.util.List; 021 022 import org.kuali.kfs.sys.batch.dataaccess.FiscalYearMaker; 023 import org.kuali.rice.kns.bo.ModuleConfiguration; 024 025 /** 026 * Slim subclass to enforce class hierarchy not enforced by the parent class' contract. 027 */ 028 public class FinancialSystemModuleConfiguration extends ModuleConfiguration { 029 protected List<FiscalYearMaker> fiscalYearMakers; 030 protected List<String> batchFileDirectories; 031 032 /** 033 * Constructs a FinancialSystemModuleConfiguration.java. 034 */ 035 public FinancialSystemModuleConfiguration() { 036 super(); 037 038 fiscalYearMakers = new ArrayList<FiscalYearMaker>(); 039 batchFileDirectories = new ArrayList<String>(); 040 } 041 042 /** 043 * Gets the fiscalYearMakers attribute. 044 * 045 * @return Returns the fiscalYearMakers. 046 */ 047 public List<FiscalYearMaker> getFiscalYearMakers() { 048 return fiscalYearMakers; 049 } 050 051 /** 052 * Sets the fiscalYearMakers attribute value. 053 * 054 * @param fiscalYearMakers The fiscalYearMakers to set. 055 */ 056 public void setFiscalYearMakers(List<FiscalYearMaker> fiscalYearMakers) { 057 this.fiscalYearMakers = fiscalYearMakers; 058 } 059 060 public List<String> getBatchFileDirectories() { 061 return batchFileDirectories; 062 } 063 064 public void setBatchFileDirectories(List<String> batchFileDirectories) { 065 if (batchFileDirectories == null) { 066 this.batchFileDirectories = new ArrayList<String>(); 067 } else { 068 this.batchFileDirectories = batchFileDirectories; 069 for (String batchFileDirectory : this.batchFileDirectories) { 070 File directory = new File(batchFileDirectory); 071 if ( !directory.exists() ) { 072 if ( !directory.mkdirs() ) { 073 throw new RuntimeException( batchFileDirectory + " does not exist and the server was unable to create it." ); 074 } 075 } else { 076 if (!directory.isDirectory()) { 077 throw new RuntimeException(batchFileDirectory + " exists but is not a directory."); 078 } 079 } 080 } 081 } 082 } 083 }