View Javadoc
1   /*
2    * Copyright 2013-2015 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.batch.admin.web;
18  
19  import java.util.TimeZone;
20  
21  import org.springframework.batch.admin.service.JobService;
22  import org.springframework.batch.admin.web.resource.DetailedJobInfoResourceAssembler;
23  import org.springframework.batch.admin.web.resource.JobExecutionInfoResourceAssembler;
24  import org.springframework.batch.admin.web.resource.JobInstanceInfoResourceAssembler;
25  import org.springframework.batch.admin.web.resource.StepExecutionInfoResourceAssembler;
26  import org.springframework.batch.admin.web.resource.StepExecutionProgressInfoResourceAssembler;
27  import org.springframework.beans.factory.annotation.Autowired;
28  import org.springframework.beans.factory.annotation.Qualifier;
29  
30  
31  /**
32   * Abstract controller that all the XD batch admin controllers extend.
33   *
34   * @author Ilayaperumal Gopinathan
35   * @since 2.0
36   */
37  public abstract class AbstractBatchJobsController {
38  
39  	@Autowired
40  	protected JobService jobService;
41  
42  	protected TimeZone timeZone = TimeZone.getTimeZone("UTC");
43  
44  	protected final DetailedJobInfoResourceAssembler jobInfoResourceAssembler = new DetailedJobInfoResourceAssembler();
45  
46  	protected final JobExecutionInfoResourceAssembler jobExecutionInfoResourceAssembler = new JobExecutionInfoResourceAssembler();
47  
48  	protected final JobInstanceInfoResourceAssembler jobInstanceInfoResourceAssembler = new JobInstanceInfoResourceAssembler();
49  
50  	protected final StepExecutionInfoResourceAssembler stepExecutionInfoResourceAssembler = new StepExecutionInfoResourceAssembler();
51  
52  	protected final StepExecutionProgressInfoResourceAssembler progressInfoResourceAssembler = new StepExecutionProgressInfoResourceAssembler();
53  
54  	/**
55  	 * @param timeZone the timeZone to set
56  	 */
57  	@Autowired(required = false)
58  	@Qualifier("userTimeZone")
59  	public void setTimeZone(TimeZone timeZone) {
60  		this.timeZone = timeZone;
61  	}
62  }