View Javadoc
1   /*
2    * Copyright 2008-2009 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.batch.dataaccess;
17  
18  import java.util.List;
19  import java.util.Map;
20  import java.util.Set;
21  
22  import org.apache.ojb.broker.query.Criteria;
23  import org.kuali.ole.sys.businessobject.FiscalYearBasedBusinessObject;
24  
25  /**
26   * Defines methods that must be implemented for a DAO making an entity for a new fiscal year
27   */
28  public interface FiscalYearMaker {
29  
30      /**
31       * Does any necessary changes on the base record (for base fiscal year) for storing as a record of the new fiscal year. The
32       * fiscal year field should be updated an minimum.
33       * 
34       * @param baseFiscalYear fiscal year of the base record
35       * @param currentRecord business object of type (@see org.kuali.ole.coa.dataaccess.FiscalYearMakerDao.getBusinessObjectClass())
36       *        populated with the current year record data
37       * @return business object of type (@see org.kuali.ole.coa.dataaccess.FiscalYearMakerDao.getBusinessObjectClass()) populated
38       *         with data for the new fiscal year record
39       */
40      public void changeForNewYear(Integer baseFiscalYear, FiscalYearBasedBusinessObject currentRecord);
41  
42      /**
43       * Creates OJB Criteria object that will be used to query for records to copy
44       * 
45       * @param baseFiscalYear fiscal year of the base record
46       * @return OJB criteria object
47       * @see org.apache.ojb.broker.query.Criteria
48       */
49      public Criteria createSelectionCriteria(Integer baseFiscalYear);
50  
51      /**
52       * Creates OJB Criteria object that will be used to delete records in the target year
53       * 
54       * @param baseFiscalYear fiscal year of the base record
55       * @return OJB criteria object
56       * @see org.apache.ojb.broker.query.Criteria
57       */
58      public Criteria createDeleteCriteria(Integer baseFiscalYear);
59  
60      /**
61       * Hook to do custom new population for a business object
62       * 
63       * @param baseFiscalYear fiscal year of the base record
64       * @param firstCopyYear boolean that indicates whether this is the first year being copied (useful for two year copies)
65       */
66      public void performCustomProcessing(Integer baseFiscalYear, boolean firstCopyYear);
67  
68      /**
69       * Indicator for determining whether we should do normal FYM process and call custom hook or only custom
70       * 
71       * @return true if only custom processing should be done, false if both normal FYM process and custom should be performed
72       */
73      public boolean doCustomProcessingOnly();
74  
75      /**
76       * Returns the class for the business object the fiscal year maker implementation operates on
77       * 
78       * @return business object class
79       */
80      public Class<? extends FiscalYearBasedBusinessObject> getBusinessObjectClass();
81  
82      /**
83       * Returns Set of Class objects that are parents to this business object. Parents will be copied before this object to satisfy
84       * referential integrity in the database
85       * 
86       * @return Set of Class objects that extend PersistableBusinessObject
87       */
88      public Set<Class<? extends FiscalYearBasedBusinessObject>> getParentClasses();
89  
90      /**
91       * Indicates whether records should be created for two fiscal years out as opposed to just one
92       * 
93       * @return true if two years should be copied, false otherwise (only the default one)
94       */
95      public boolean isTwoYearCopy();
96  
97      /**
98       * Indicates whether records of this type can be cleared for target year (if Override parameter is set to true). Clearing
99       * records for some tables causes RI issues therefore they cannot be safely deleted once created
100      * 
101      * @return true if target year data can be cleared, false if not
102      */
103     public boolean isAllowOverrideTargetYear();
104 
105     Criteria createNextYearSelectionCriteria(Integer fiscalYear);
106 
107     List<String> getPrimaryKeyPropertyNames();
108     List<String> getPropertyNames();
109     @SuppressWarnings("rawtypes")
110     Map<String,Class> getReferenceObjectProperties();
111     @SuppressWarnings("rawtypes")
112     Map<String,Class> getCollectionProperties();
113     Map<String,String> getForeignKeyMappings( String referenceName );
114 }