diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/listener/SpecialRunCompletionNotificationListener.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/listener/SpecialRunCompletionNotificationListener.java index 44f09da8..a61da3b6 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/listener/SpecialRunCompletionNotificationListener.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/listener/SpecialRunCompletionNotificationListener.java @@ -1,22 +1,16 @@ package ca.bc.gov.educ.api.batchgraduation.listener; -import ca.bc.gov.educ.api.batchgraduation.model.StudentSearchRequest; import ca.bc.gov.educ.api.batchgraduation.rest.RestUtils; import ca.bc.gov.educ.api.batchgraduation.util.JsonTransformer; -import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.JobExecution; -import org.springframework.batch.core.JobParameters; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.time.ZoneId; import java.util.Date; -import java.util.List; - -import static ca.bc.gov.educ.api.batchgraduation.util.EducGradBatchGraduationApiConstants.SEARCH_REQUEST; @Component public class SpecialRunCompletionNotificationListener extends BaseRunCompletionNotificationListener { @@ -29,8 +23,6 @@ public class SpecialRunCompletionNotificationListener extends BaseRunCompletionN @Autowired JsonTransformer jsonTransformer; - private static final String RUN_BY = "runBy"; - @Override public void afterJob(JobExecution jobExecution) { if (jobExecution.getStatus() == BatchStatus.COMPLETED) { @@ -38,22 +30,7 @@ public void afterJob(JobExecution jobExecution) { LOGGER.info("======================================================================================="); LOGGER.info("Special Job completed in {} s with jobExecution status {}", elapsedTimeMillis/1000, jobExecution.getStatus()); handleSummary(jobExecution, "spcRunAlgSummaryDTO", true); - processGradStudentRecordJobHistory(jobExecution); LOGGER.info("======================================================================================="); } } - - private void processGradStudentRecordJobHistory(JobExecution jobExecution) { - - JobParameters jobParameters = jobExecution.getJobParameters(); - Long batchId = jobExecution.getId(); - String userName = jobParameters.getString(RUN_BY); - - String searchRequest = jobParameters.getString(SEARCH_REQUEST, "{}"); - StudentSearchRequest req = (StudentSearchRequest)jsonTransformer.unmarshall(searchRequest, StudentSearchRequest.class); - - restUtils.updateStudentGradRecordHistory(List.of(), batchId, userName, StringUtils.upperCase(req.getActivityCode())); - } - - } diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/BasePartitioner.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/BasePartitioner.java index 621570f7..7b8b344e 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/BasePartitioner.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/BasePartitioner.java @@ -26,7 +26,7 @@ public abstract class BasePartitioner extends SimplePartitioner { private static final Logger LOGGER = LoggerFactory.getLogger(BasePartitioner.class); private static final String RERUN_TYPE = "reRunType"; - private static final String RUN_BY = "runBy"; + protected static final String RUN_BY = "runBy"; private static final String PREV_BATCH_ID = "previousBatchId"; private static final String RERUN_ALL = "RERUN_ALL"; private static final String RERUN_FAILED = "RERUN_FAILED"; diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/BaseStudentReader.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/BaseStudentReader.java index d37c999a..a97a75e6 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/BaseStudentReader.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/BaseStudentReader.java @@ -3,6 +3,8 @@ import ca.bc.gov.educ.api.batchgraduation.model.AlgorithmSummaryDTO; import ca.bc.gov.educ.api.batchgraduation.model.ResponseObj; import ca.bc.gov.educ.api.batchgraduation.rest.RestUtils; +import ca.bc.gov.educ.api.batchgraduation.util.ThreadLocalStateUtil; +import org.apache.commons.lang3.StringUtils; import org.springframework.batch.core.JobExecution; import org.springframework.batch.item.ItemReader; import org.springframework.beans.factory.annotation.Autowired; @@ -20,6 +22,9 @@ public abstract class BaseStudentReader implements ItemReader { @Value("#{stepExecutionContext['index']}") protected Integer nxtStudentForProcessing; + @Value("#{stepExecutionContext['runBy']}") + protected String runBy; + @Value("#{stepExecutionContext['data']}") protected List studentList; @@ -35,4 +40,10 @@ protected void fetchAccessToken() { summaryDTO.setAccessToken(res.getAccess_token()); } } + + protected void setUserName() { + if (StringUtils.isNotBlank(runBy) && StringUtils.isBlank(ThreadLocalStateUtil.getCurrentUser())) { + ThreadLocalStateUtil.setCurrentUser(runBy); + } + } } \ No newline at end of file diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateProjectedGradRunErrorReader.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateProjectedGradRunErrorReader.java index 30e3966d..9293eb7d 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateProjectedGradRunErrorReader.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateProjectedGradRunErrorReader.java @@ -12,6 +12,7 @@ public class RecalculateProjectedGradRunErrorReader extends BaseStudentReader { @Override public UUID read() throws Exception { fetchAccessToken(); + setUserName(); UUID nextStudent = null; if (nxtStudentForProcessing < studentList.size()) { diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateProjectedGradRunErrorRetryReader.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateProjectedGradRunErrorRetryReader.java index edd68426..e17cb48d 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateProjectedGradRunErrorRetryReader.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateProjectedGradRunErrorRetryReader.java @@ -12,6 +12,7 @@ public class RecalculateProjectedGradRunErrorRetryReader extends BaseStudentRead @Override public UUID read() throws Exception { fetchAccessToken(); + setUserName(); UUID nextStudent = null; if (nxtStudentForProcessing < studentList.size()) { diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateProjectedGradRunReader.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateProjectedGradRunReader.java index 3cbca59d..d51253c2 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateProjectedGradRunReader.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateProjectedGradRunReader.java @@ -12,6 +12,7 @@ public class RecalculateProjectedGradRunReader extends BaseStudentReader { @Override public UUID read() throws Exception { fetchAccessToken(); + setUserName(); UUID nextStudent = null; if (nxtStudentForProcessing < studentList.size()) { diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateStudentErrorReader.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateStudentErrorReader.java index 6a2a3cc4..a74b5f9c 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateStudentErrorReader.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateStudentErrorReader.java @@ -12,6 +12,7 @@ public class RecalculateStudentErrorReader extends BaseStudentReader { @Override public UUID read() throws Exception { fetchAccessToken(); + setUserName(); UUID nextStudent = null; if (nxtStudentForProcessing < studentList.size()) { diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateStudentErrorRetryReader.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateStudentErrorRetryReader.java index 64c2c31e..810d2249 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateStudentErrorRetryReader.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateStudentErrorRetryReader.java @@ -12,6 +12,7 @@ public class RecalculateStudentErrorRetryReader extends BaseStudentReader { @Override public UUID read() throws Exception { fetchAccessToken(); + setUserName(); UUID nextStudent = null; if (nxtStudentForProcessing < studentList.size()) { diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateStudentReader.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateStudentReader.java index ae887f4c..c5d8f2b9 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateStudentReader.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RecalculateStudentReader.java @@ -12,6 +12,7 @@ public class RecalculateStudentReader extends BaseStudentReader { @Override public UUID read() throws Exception { fetchAccessToken(); + setUserName(); summaryDTO.setReadCount(studentList.size()); UUID nextStudent = null; diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RegGradAlgPartitioner.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RegGradAlgPartitioner.java index be76349c..c5b15f73 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RegGradAlgPartitioner.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RegGradAlgPartitioner.java @@ -6,6 +6,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.core.JobExecution; +import org.springframework.batch.core.JobParameters; import org.springframework.batch.item.ExecutionContext; import org.springframework.beans.factory.annotation.Value; @@ -31,6 +32,8 @@ public JobExecution getJobExecution() { public Map partition(int gridSize) { initializeRunType(); BatchGradAlgorithmJobHistoryEntity jobHistory = createBatchJobHistory(); + JobParameters jobParameters = jobExecution.getJobParameters(); + String username = jobParameters.getString(RUN_BY); List studentList; if (runType == RunTypeEnum.NORMAL_JOB_PROCESS) { studentList = restUtils.getStudentsForAlgorithm(); @@ -57,6 +60,7 @@ public Map partition(int gridSize) { summaryDTO.setReadCount(data.size()); executionContext.put("summary", summaryDTO); executionContext.put("index",0); + executionContext.put("runBy", username); String key = "partition" + i; map.put(key, executionContext); } diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RegGradAlgPartitionerRetry.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RegGradAlgPartitionerRetry.java index dad374d3..cebc76a1 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RegGradAlgPartitionerRetry.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/RegGradAlgPartitionerRetry.java @@ -5,6 +5,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.core.JobExecution; +import org.springframework.batch.core.JobParameters; import org.springframework.batch.item.ExecutionContext; import org.springframework.beans.factory.annotation.Value; @@ -30,6 +31,8 @@ public JobExecution getJobExecution() { @Override public Map partition(int gridSize) { Long batchId = jobExecution.getId(); + JobParameters jobParameters = jobExecution.getJobParameters(); + String username = jobParameters.getString(RUN_BY); List studentList = getInputDataForErroredStudents(batchId); createTotalSummaryDTO("regGradAlgSummaryDTO"); @@ -48,6 +51,7 @@ public Map partition(int gridSize) { summaryDTO.setReadCount(data.size()); executionContext.put("summary", summaryDTO); executionContext.put("index",0); + executionContext.put("runBy", username); String key = "partition" + i; map.put(key, executionContext); } diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/SpcRegGradAlgPartitioner.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/SpcRegGradAlgPartitioner.java index 82df4cc8..d9307e8f 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/SpcRegGradAlgPartitioner.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/SpcRegGradAlgPartitioner.java @@ -4,6 +4,7 @@ import ca.bc.gov.educ.api.batchgraduation.model.AlgorithmSummaryDTO; import ca.bc.gov.educ.api.batchgraduation.model.RunTypeEnum; import ca.bc.gov.educ.api.batchgraduation.model.StudentSearchRequest; +import ca.bc.gov.educ.api.batchgraduation.util.ThreadLocalStateUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.core.JobExecution; @@ -37,6 +38,7 @@ public Map partition(int gridSize) { BatchGradAlgorithmJobHistoryEntity jobHistory = createBatchJobHistory(); List studentList; JobParameters jobParameters = jobExecution.getJobParameters(); + String username = jobParameters.getString(RUN_BY); String searchRequest = jobParameters.getString(SEARCH_REQUEST, "{}"); StudentSearchRequest req = (StudentSearchRequest)jsonTransformer.unmarshall(searchRequest, StudentSearchRequest.class); if (runType == RunTypeEnum.NORMAL_JOB_PROCESS) { @@ -64,6 +66,7 @@ public Map partition(int gridSize) { summaryDTO.setReadCount(data.size()); executionContext.put("summary", summaryDTO); executionContext.put("index",0); + executionContext.put("runBy", username); String key = "partition" + i; map.put(key, executionContext); } diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/SpcRegGradAlgPartitionerRetry.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/SpcRegGradAlgPartitionerRetry.java index e4eddd53..49d2c634 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/SpcRegGradAlgPartitionerRetry.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/SpcRegGradAlgPartitionerRetry.java @@ -3,6 +3,7 @@ import ca.bc.gov.educ.api.batchgraduation.model.AlgorithmSummaryDTO; import ca.bc.gov.educ.api.batchgraduation.model.RunTypeEnum; import ca.bc.gov.educ.api.batchgraduation.model.StudentSearchRequest; +import ca.bc.gov.educ.api.batchgraduation.util.ThreadLocalStateUtil; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import org.slf4j.Logger; @@ -34,6 +35,8 @@ public JobExecution getJobExecution() { @Override public Map partition(int gridSize) { Long batchId = jobExecution.getId(); + JobParameters jobParameters = jobExecution.getJobParameters(); + String username = jobParameters.getString(RUN_BY); List studentList = getInputDataForErroredStudents(batchId); createTotalSummaryDTO("spcRunAlgSummaryDTO"); @@ -52,6 +55,7 @@ public Map partition(int gridSize) { summaryDTO.setReadCount(data.size()); executionContext.put("summary", summaryDTO); executionContext.put("index",0); + executionContext.put("runBy", username); String key = "partition" + i; map.put(key, executionContext); } diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/SpecialGradRunStudentReader.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/SpecialGradRunStudentReader.java index ce051e9f..5d1f2884 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/SpecialGradRunStudentReader.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/SpecialGradRunStudentReader.java @@ -12,6 +12,7 @@ public class SpecialGradRunStudentReader extends BaseStudentReader { @Override public UUID read() throws Exception { fetchAccessToken(); + setUserName(); UUID nextStudent = null; if (nxtStudentForProcessing < studentList.size()) { diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/SpecialProjectedGradRunReader.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/SpecialProjectedGradRunReader.java index a12faff6..408035f1 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/SpecialProjectedGradRunReader.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/SpecialProjectedGradRunReader.java @@ -12,6 +12,7 @@ public class SpecialProjectedGradRunReader extends BaseStudentReader { @Override public UUID read() throws Exception { fetchAccessToken(); + setUserName(); UUID nextStudent = null; if (nxtStudentForProcessing < studentList.size()) { diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/TvrRunPartitioner.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/TvrRunPartitioner.java index 5f9d2b5f..a8a96458 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/TvrRunPartitioner.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/TvrRunPartitioner.java @@ -6,6 +6,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.core.JobExecution; +import org.springframework.batch.core.JobParameters; import org.springframework.batch.item.ExecutionContext; import org.springframework.beans.factory.annotation.Value; @@ -31,6 +32,8 @@ public JobExecution getJobExecution() { public Map partition(int gridSize) { initializeRunType(); BatchGradAlgorithmJobHistoryEntity jobHistory = createBatchJobHistory(); + JobParameters jobParameters = jobExecution.getJobParameters(); + String username = jobParameters.getString(RUN_BY); List studentList; if (runType == RunTypeEnum.NORMAL_JOB_PROCESS) { studentList = restUtils.getStudentsForProjectedAlgorithm(); @@ -57,6 +60,7 @@ public Map partition(int gridSize) { summaryDTO.setReadCount(data.size()); executionContext.put("summary", summaryDTO); executionContext.put("index",0); + executionContext.put("runBy", username); String key = "partition" + i; map.put(key, executionContext); } diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/TvrRunPartitionerRetry.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/TvrRunPartitionerRetry.java index 6aba6575..a4bb0df8 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/TvrRunPartitionerRetry.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/reader/TvrRunPartitionerRetry.java @@ -5,6 +5,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.core.JobExecution; +import org.springframework.batch.core.JobParameters; import org.springframework.batch.item.ExecutionContext; import org.springframework.beans.factory.annotation.Value; @@ -30,6 +31,8 @@ public JobExecution getJobExecution() { @Override public Map partition(int gridSize) { Long batchId = jobExecution.getId(); + JobParameters jobParameters = jobExecution.getJobParameters(); + String username = jobParameters.getString(RUN_BY); List studentList = getInputDataForErroredStudents(batchId); createTotalSummaryDTO("tvrRunSummaryDTO"); @@ -48,6 +51,7 @@ public Map partition(int gridSize) { summaryDTO.setReadCount(data.size()); executionContext.put("summary", summaryDTO); executionContext.put("index",0); + executionContext.put("runBy", username); String key = "partition" + i; map.put(key, executionContext); } diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/rest/RESTService.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/rest/RESTService.java index c5e128de..c288e1f7 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/rest/RESTService.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/rest/RESTService.java @@ -83,7 +83,10 @@ public T get(String url, Class clazz) { obj = this.batchWebClient .get() .uri(url) - .headers(h -> h.set(EducGradBatchGraduationApiConstants.CORRELATION_ID, ThreadLocalStateUtil.getCorrelationID())) + .headers(h -> { + h.set(EducGradBatchGraduationApiConstants.CORRELATION_ID, ThreadLocalStateUtil.getCorrelationID()); + h.set(EducGradBatchGraduationApiConstants.USERNAME, ThreadLocalStateUtil.getCurrentUser()); + }) .retrieve() // if 5xx errors, throw Service error .onStatus(HttpStatusCode::is5xxServerError, @@ -154,7 +157,10 @@ public T post(String url, Object body, Class clazz) { try { obj = this.batchWebClient.post() .uri(url) - .headers(h -> h.set(EducGradBatchGraduationApiConstants.CORRELATION_ID, ThreadLocalStateUtil.getCorrelationID())) + .headers(h -> { + h.set(EducGradBatchGraduationApiConstants.CORRELATION_ID, ThreadLocalStateUtil.getCorrelationID()); + h.set(EducGradBatchGraduationApiConstants.USERNAME, ThreadLocalStateUtil.getCurrentUser()); + }) .body(BodyInserters.fromValue(body)) .retrieve() .onStatus(HttpStatusCode::is5xxServerError, @@ -192,7 +198,10 @@ public T put(String url, Object body, Class clazz) { try { obj = this.batchWebClient.put() .uri(url) - .headers(h -> h.set(EducGradBatchGraduationApiConstants.CORRELATION_ID, ThreadLocalStateUtil.getCorrelationID())) + .headers(h -> { + h.set(EducGradBatchGraduationApiConstants.CORRELATION_ID, ThreadLocalStateUtil.getCorrelationID()); + h.set(EducGradBatchGraduationApiConstants.USERNAME, ThreadLocalStateUtil.getCurrentUser()); + }) .body(BodyInserters.fromValue(body)) .retrieve() .onStatus(HttpStatusCode::is5xxServerError, @@ -227,7 +236,10 @@ public T delete(String url, Class boundClass) { T obj; try { obj = this.batchWebClient.delete().uri(url) - .headers(h -> h.set(EducGradBatchGraduationApiConstants.CORRELATION_ID, ThreadLocalStateUtil.getCorrelationID())) + .headers(h -> { + h.set(EducGradBatchGraduationApiConstants.CORRELATION_ID, ThreadLocalStateUtil.getCorrelationID()); + h.set(EducGradBatchGraduationApiConstants.USERNAME, ThreadLocalStateUtil.getCurrentUser()); + }) .retrieve().bodyToMono(boundClass).block(); } catch(Exception e) { // catches IOExceptions and the like diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/EducGradBatchGraduationApiConstants.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/EducGradBatchGraduationApiConstants.java index dd44be18..871d332b 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/EducGradBatchGraduationApiConstants.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/EducGradBatchGraduationApiConstants.java @@ -16,6 +16,7 @@ public class EducGradBatchGraduationApiConstants { public static final String API_ROOT_MAPPING = ""; public static final String API_VERSION = "v1"; public static final String CORRELATION_ID = "correlationID"; + public static final String USERNAME = "username"; public static final String GRAD_BATCH_API_ROOT_MAPPING = "/api/" + API_VERSION + "/batch"; // Manual Run