View Javadoc
1   /*
2    * Copyright 2008 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.sys;
17  
18  import java.io.File;
19  import java.util.ArrayList;
20  import java.util.List;
21  
22  import org.kuali.ole.sys.batch.dataaccess.FiscalYearMaker;
23  import org.kuali.rice.krad.bo.ModuleConfiguration;
24  
25  /**
26   * Slim subclass to enforce class hierarchy not enforced by the parent class' contract.
27   */
28  public class FinancialSystemModuleConfiguration extends ModuleConfiguration {
29      protected List<FiscalYearMaker> fiscalYearMakers;
30      protected List<String> batchFileDirectories;
31      
32      /**
33       * Constructs a FinancialSystemModuleConfiguration.java.
34       */
35      public FinancialSystemModuleConfiguration() {
36          super();
37          
38          fiscalYearMakers = new ArrayList<FiscalYearMaker>();
39          batchFileDirectories = new ArrayList<String>();
40      }
41  
42      /**
43       * Gets the fiscalYearMakers attribute.
44       * 
45       * @return Returns the fiscalYearMakers.
46       */
47      public List<FiscalYearMaker> getFiscalYearMakers() {
48          return fiscalYearMakers;
49      }
50  
51      /**
52       * Sets the fiscalYearMakers attribute value.
53       * 
54       * @param fiscalYearMakers The fiscalYearMakers to set.
55       */
56      public void setFiscalYearMakers(List<FiscalYearMaker> fiscalYearMakers) {
57          this.fiscalYearMakers = fiscalYearMakers;
58      }
59      
60      public List<String> getBatchFileDirectories() {
61          return batchFileDirectories;
62      }
63      
64      public void setBatchFileDirectories(List<String> batchFileDirectories) {
65          if (batchFileDirectories == null) {
66              this.batchFileDirectories = new ArrayList<String>();
67          } else {
68              this.batchFileDirectories = batchFileDirectories;
69              for (String batchFileDirectory : this.batchFileDirectories) {
70                  File directory = new File(batchFileDirectory);
71                  if ( !directory.exists() ) {
72                      if ( !directory.mkdirs() ) {
73                          throw new RuntimeException( batchFileDirectory + " does not exist and the server was unable to create it." );
74                      }
75                  } else {
76                      if (!directory.isDirectory()) {
77                          throw new RuntimeException(batchFileDirectory + " exists but is not a directory.");
78                      }
79                  }
80              }
81          }
82      }
83  }