001: /*
002: * Copyright 2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.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/ecl1.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.module.chart.dao;
017:
018: import java.lang.reflect.InvocationTargetException;
019: import java.util.ArrayList;
020: import java.util.GregorianCalendar;
021: import java.util.HashMap;
022: import java.util.HashSet;
023: import java.util.LinkedHashMap;
024:
025: /*
026: * data access methods for fiscal year makers
027: */
028: public interface FiscalYearMakersDao {
029:
030: public static final boolean replaceMode = true;
031:
032: // @@TODO: remove these test routines
033: public void testUpdateTwoDigitYear();
034:
035: public void testRIRelationships() throws NoSuchMethodException,
036: IllegalAccessException, InvocationTargetException;
037:
038: /**
039: * This method...
040: *
041: * @return
042: */
043: public Integer fiscalYearFromToday();
044:
045: /**
046: * this is the only routine that simply replaces what is there, if anything but, we have to do a delete--otherwise, we can get
047: * an optimistic locking exception when we try to store a new row on top of something already in the database. we will delete by
048: * fiscal year. the accounting period is assumed to correspond to the month, with the month of the start date being the first
049: * period and the month of the last day of the fiscal year being the twelfth. the fiscal year tag is always the year of the
050: * ending date of the fiscal year
051: *
052: * @param newYearStartDate
053: */
054: public void makeUniversityDate(GregorianCalendar newYearStartDate);
055:
056: /*******************************************************************************************************************************
057: * Routines for RI * ******************************************************************************* some kuali objects
058: * represent reference tables keyed by fiscal period (usually a fiscal year). when a new fiscal period is created, these objects
059: * are copied from the predecessor period so that it is not necessary for someone to type literally thousands of rows into a
060: * maintenance document, changing only the fiscal period key. if there is referential integrity in the data base, these objects
061: * must be copied in a certain order. the implementation of this interface allows us to "inject" that order into a spring bean,
062: * and access and manipulate it during the copy process (informally known as "fiscal year makers"). this object makes adding a
063: * new object to the process simpler, by allowing the RI relationships to be expressed in XML. ALL "fiscal year makers" objects
064: * should be included in this bean, even if they have no RI relationship with any other "fiscal year maker" object. The object
065: * list from this bean is used to trigger the copying of every fiscal year maker object.
066: */
067:
068: /**
069: * fetch and set a map of child classes involved in fiscal year makers (ALL such classes should be included, even those which
070: * have no parent(s) in the RI tree.)
071: *
072: * @return HashMap containing the
073: */
074: public HashMap<String, Class> getMakerObjectsList();
075:
076: /**
077: * This method...
078: *
079: * @param makerObjectList
080: */
081: public void setMakerObjectsList(
082: HashMap<String, Class> makerObjectList);
083:
084: /**
085: * fetch and set a map of child classes involved in fiscal year makers and a list of their RI parents
086: *
087: * @return
088: */
089: public HashMap<String, ArrayList<Class>> getChildParentMap();
090:
091: /**
092: * This method...
093: *
094: * @param childParentArrayMap
095: */
096: public void setChildParentArrayMap(
097: HashMap<String, Class[]> childParentArrayMap);
098:
099: /**
100: * the "lagging copy cycle" objects are those which are always one fiscal period behind. in other words, the base period for the
101: * other objects (the source period for the copy) is the request period for them (the target period for their copy). This
102: * method...
103: *
104: * @param laggingCopyCycle
105: */
106: public void setLaggingCopyCycle(HashSet<String> laggingCopyCycle);
107:
108: /**
109: * auto-update or auto-delete in OJB will interfere with the copy order prescribed above. (Tables A and C may be a parents of
110: * Table B, but A may have no relation to C. If A has an auto-xxx on B, then B will be written when A is, even if C is later in
111: * the copy order than A, and an RI exception will result.) So, the code resets any auto-xxx properties on tables involved in a
112: * fiscal-year-makers parent-child relationship. this routine resets the original values at the end of fiscal year makers
113: */
114: public void resetCascades();
115:
116: /**
117: * when the reference objects for a base fiscal period are copied into the next fiscal period, there is an option to delete all
118: * of the next period objects that already exit and replace them with their base period counterparts this method reads a list of
119: * the delete order which satisfies RI (i.e., the dependent object must be deleted before the parent object) and does the job in
120: * the proper order. This method...
121: *
122: * @param RequestYear
123: */
124: public void deleteNewYearRows(Integer requestYear);
125:
126: /**
127: * when we want to copy two years at a time for some tables, we use this method with "slash and burn" mode to delete any rows
128: * for the year after RequestYear that already exist for the parents
129: *
130: * @param RequestYear
131: * @param childClass
132: */
133: public void deleteYearAfterNewYearRowsForParents(
134: Integer requestYear, Class childClass);
135:
136: /**
137: * This method checks to see whether the test class is in the parent list for the child class
138: *
139: * @param testClassName
140: * @param childClass
141: * @return true if testClassName is a parent class of childClass
142: */
143: public boolean isAParentOf(String testClassName, Class childClass);
144:
145: /**
146: * this returns the data structure containing a copy order that is consistent with the RI relationships configured in the XML
147: *
148: * @param baseYear
149: * @param replaceMode
150: * @return
151: */
152: public LinkedHashMap<String, FiscalYearMakersCopyAction> setUpRun(
153: Integer baseYear, boolean replaceMode);
154:
155: }
|