001    /**
002     * Copyright 2004-2013 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.hr.time.calendar;
017    
018    import java.util.Map;
019    
020    import org.apache.log4j.Logger;
021    import org.kuali.hr.core.cache.CacheUtils;
022    import org.kuali.rice.kns.document.MaintenanceDocument;
023    import org.kuali.rice.kns.maintenance.KualiMaintainableImpl;
024    
025    /**
026     * Leverage this class to implement hooks when maintenance is done on a
027     * Calendar.
028     * 
029     * @author djunk
030     * 
031     */
032    public class CalendarMaintainableImpl extends KualiMaintainableImpl {
033    
034            /**
035         * 
036         */
037            private static final long serialVersionUID = 1L;
038            private static final Logger LOG = Logger.getLogger(CalendarMaintainableImpl.class);
039    
040            @Override
041            public void addNewLineToCollection(String collectionName) {
042                    super.addNewLineToCollection(collectionName);
043            }
044    
045            @Override
046            public Map<String, String> populateNewCollectionLines(Map<String, String> fieldValues, MaintenanceDocument maintenanceDocument, String methodToCall) {
047                    return super.populateNewCollectionLines(fieldValues, maintenanceDocument, methodToCall);
048            }
049    
050            @SuppressWarnings("unchecked")
051            @Override
052            public void processAfterAddLine(String colName, Class colClass) {
053                    super.processAfterAddLine(colName, colClass);
054            }
055    
056            @Override
057            public void saveBusinessObject() {
058                    super.saveBusinessObject();
059                    Calendar calendar = (Calendar) this.getBusinessObject();
060                    LOG.info("Saved pay calendar: " + calendar.getHrCalendarId());
061            CacheUtils.flushCache(Calendar.CACHE_NAME);
062            CacheUtils.flushCache(CalendarEntries.CACHE_NAME);
063            }
064    
065    }