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