/*
 * Copyright 2017 Crown Copyright
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package stroom.job.impl;

import stroom.event.logging.rs.api.AutoLogged;
import stroom.job.shared.GetScheduledTimesRequest;
import stroom.job.shared.ScheduledTimeResource;
import stroom.job.shared.ScheduledTimes;
import stroom.security.api.SecurityContext;

import javax.inject.Inject;

@AutoLogged
public class ScheduledTimeResourceImpl implements ScheduledTimeResource {

    private final ScheduleService scheduleService;
    private final SecurityContext securityContext;

    @Inject
    ScheduledTimeResourceImpl(final ScheduleService scheduleService,
                              final SecurityContext securityContext) {
        this.scheduleService = scheduleService;
        this.securityContext = securityContext;
    }

    @Override
    public ScheduledTimes get(final GetScheduledTimesRequest request) {
        return securityContext.secureResult(() ->
                scheduleService.getScheduledTimes(
                        request.getJobType(),
                        request.getScheduleReferenceTime(),
                        request.getLastExecutedTime(),
                        request.getSchedule()));
    }
}

@@ -810,53 +810,37 @@
 es;%0A
+%0A
 import 
-stroom.security.api.SecurityContex
+javax.inject.Injec
 t;%0A
-%0A
 impo
@@ -855,22 +855,24 @@
 .inject.
-Inject
+Provider
 ;%0A%0A@Auto
@@ -967,24 +967,33 @@
 ivate final 
+Provider%3C
 ScheduleServ
@@ -987,32 +987,33 @@
 %3CScheduleService
+%3E
  scheduleService
@@ -1016,59 +1016,16 @@
 vice
-;%0A    private final SecurityContext securityContext
+Provider
 ;%0A%0A 
@@ -1071,16 +1071,25 @@
 l(final 
+Provider%3C
 Schedule
@@ -1095,16 +1095,17 @@
 eService
+%3E
  schedul
@@ -1116,77 +1116,16 @@
 vice
-,%0A                              final SecurityContext securityContext
+Provider
 ) %7B%0A
@@ -1152,16 +1152,24 @@
 eService
+Provider
  = sched
@@ -1182,56 +1182,16 @@
 vice
-;%0A        this.securityContext = securityContext
+Provider
 ;%0A  
@@ -1301,59 +1301,8 @@
 rn s
-ecurityContext.secureResult(() -%3E%0A                s
 ched
@@ -1311,16 +1311,30 @@
 eService
+Provider.get()
 .getSche
@@ -1345,24 +1345,16 @@
 dTimes(%0A
-        
         
@@ -1395,32 +1395,24 @@
             
-       
- 
 request.getS
@@ -1431,32 +1431,24 @@
 enceTime(),%0A
-        
             
@@ -1494,32 +1494,24 @@
             
-        
 request.getS
@@ -1520,17 +1520,16 @@
 edule())
-)
 ;%0A    %7D%0A

Apply Stroom standard for REST to ScheduledTimeResourceImpl