diff --git a/src/main/java/org/onedatashare/odsmetadata/controller/BatchJobController.java b/src/main/java/org/onedatashare/odsmetadata/controller/BatchJobController.java index 36364fb..c94aaba 100644 --- a/src/main/java/org/onedatashare/odsmetadata/controller/BatchJobController.java +++ b/src/main/java/org/onedatashare/odsmetadata/controller/BatchJobController.java @@ -32,17 +32,22 @@ @RestController @RequestMapping(value = "/api/v1/meta", produces = MediaType.APPLICATION_JSON_VALUE) public class BatchJobController { - @Autowired - JobService jobService; - @Autowired - InfluxIOService influxIOService; + private JobService jobService; + + private InfluxIOService influxIOService; private static final String REGEX_PATTERN = "^(?=.{1,64}@)[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)*@" + "[^-][A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*(\\.[A-Za-z]{2,})$"; //this is used to validate that the userEmail is an email private static final String REGEX = "\\d+"; + @Autowired + public BatchJobController(JobService jobService, InfluxIOService influxIOService){ + this.jobService = jobService; + this.influxIOService = influxIOService; + } + /** * Returns all the jobs with the corresponding userEmail * This call should be done if you only want the JobIds diff --git a/src/main/java/org/onedatashare/odsmetadata/services/JobService.java b/src/main/java/org/onedatashare/odsmetadata/services/JobService.java index 82d5c54..89a5ec7 100644 --- a/src/main/java/org/onedatashare/odsmetadata/services/JobService.java +++ b/src/main/java/org/onedatashare/odsmetadata/services/JobService.java @@ -24,11 +24,9 @@ @Service public class JobService { - @Autowired - BatchJobRepository batchJobRepository; + private BatchJobRepository batchJobRepository; - @Autowired - BatchJobParamRepository batchJobParamRepository; + private BatchJobParamRepository batchJobParamRepository; private BatchJobMapper mapper = Mappers.getMapper(BatchJobMapper.class); @@ -36,6 +34,12 @@ public class JobService { private static final String LONG_VAL = "LONG"; private static final String DOUBLE_VAL = "DOUBLE"; + @Autowired + public JobService(BatchJobParamRepository batchJobParamRepository, BatchJobRepository batchJobRepository) { + this.batchJobParamRepository = batchJobParamRepository; + this.batchJobRepository = batchJobRepository; + } + public BatchJobData getJobStat(Long jobId) { log.info("JobId: {}", jobId); BatchJobData batchJobData = new BatchJobData();