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.batch.dataaccess;
017    
018    import java.util.Collection;
019    import java.util.Set;
020    
021    import org.apache.ojb.broker.query.Criteria;
022    import org.kuali.rice.kns.bo.PersistableBusinessObject;
023    
024    /**
025     * Defines methods that must be implemented for a DAO making an entity for a new fiscal year
026     */
027    public interface FiscalYearMaker {
028    
029        /**
030         * Does any necessary changes on the base record (for base fiscal year) for storing as a record of the new fiscal year. The
031         * fiscal year field should be updated an minimum.
032         * 
033         * @param baseFiscalYear fiscal year of the base record
034         * @param currentRecord business object of type (@see org.kuali.kfs.coa.dataaccess.FiscalYearMakerDao.getBusinessObjectClass())
035         *        populated with the current year record data
036         * @return business object of type (@see org.kuali.kfs.coa.dataaccess.FiscalYearMakerDao.getBusinessObjectClass()) populated
037         *         with data for the new fiscal year record
038         */
039        public void changeForNewYear(Integer baseFiscalYear, PersistableBusinessObject currentRecord);
040    
041        /**
042         * Creates OJB Criteria object that will be used to query for records to copy
043         * 
044         * @param baseFiscalYear fiscal year of the base record
045         * @return OJB criteria object
046         * @see org.apache.ojb.broker.query.Criteria
047         */
048        public Criteria createSelectionCriteria(Integer baseFiscalYear);
049    
050        /**
051         * Creates OJB Criteria object that will be used to delete records in the target year
052         * 
053         * @param baseFiscalYear fiscal year of the base record
054         * @return OJB criteria object
055         * @see org.apache.ojb.broker.query.Criteria
056         */
057        public Criteria createDeleteCriteria(Integer baseFiscalYear);
058    
059        /**
060         * Hook to do custom new population for a business object
061         * 
062         * @param baseFiscalYear fiscal year of the base record
063         * @param firstCopyYear boolean that indicates whether this is the first year being copied (useful for two year copies)
064         */
065        public void performCustomProcessing(Integer baseFiscalYear, boolean firstCopyYear);
066    
067        /**
068         * Indicator for determining whether we should do normal FYM process and call custom hook or only custom
069         * 
070         * @return true if only custom processing should be done, false if both normal FYM process and custom should be performed
071         */
072        public boolean doCustomProcessingOnly();
073    
074        /**
075         * Returns the class for the business object the fiscal year maker implementation operates on
076         * 
077         * @return business object class
078         */
079        public Class<? extends PersistableBusinessObject> getBusinessObjectClass();
080    
081        /**
082         * Returns Set of Class objects that are parents to this business object. Parents will be copied before this object to satisfy
083         * referential integrity in the database
084         * 
085         * @return Set of Class objects that extend PersistableBusinessObject
086         */
087        public Set<Class<? extends PersistableBusinessObject>> getParentClasses();
088    
089        /**
090         * Indicates whether records should be created for two fiscal years out as opposed to just one
091         * 
092         * @return true if two years should be copied, false otherwise (only the default one)
093         */
094        public boolean isTwoYearCopy();
095    
096        /**
097         * Indicates whether records of this type can be cleared for target year (if Override parameter is set to true). Clearing
098         * records for some tables causes RI issues therefore they cannot be safely deleted once created
099         * 
100         * @return true if target year data can be cleared, false if not
101         */
102        public boolean isAllowOverrideTargetYear();
103    
104    }