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.scheduler;
017
018
019 import java.util.Calendar;
020
021 import org.apache.log4j.Logger;
022 import org.quartz.JobExecutionContext;
023 import org.quartz.JobExecutionException;
024 import org.springframework.scheduling.quartz.QuartzJobBean;
025
026 public class TimeBlockSerializerJobBean extends QuartzJobBean{
027 private static final Logger LOG = Logger.getLogger(TimeBlockSerializerJobBean.class);
028 private static TimeBlockSerializerService timeBlockSerializerService;
029
030
031
032 public TimeBlockSerializerService getTimeBlockSerializerService() {
033 return timeBlockSerializerService;
034 }
035
036
037
038 public void setTimeBlockSerializerService(
039 TimeBlockSerializerService timeBlockSerializerService) {
040 TimeBlockSerializerJobBean.timeBlockSerializerService = timeBlockSerializerService;
041 }
042
043
044 @Override
045 protected void executeInternal(JobExecutionContext arg0)
046 throws JobExecutionException {
047 try {
048 //UnComment following 2 statements to apply the effect of Scheduled Job
049
050 LOG.info("Executed at :" + Calendar.getInstance().getTime());
051 timeBlockSerializerService.serializeToCSV();
052 timeBlockSerializerService.serializeToXML();
053 } catch (Exception e) {
054 // TODO Auto-generated catch block
055 e.printStackTrace();
056
057 }
058
059 }
060
061
062 }