Search in sources :

Example 16 with JobOutput

use of gov.cms.ab2d.common.model.JobOutput in project ab2d by CMSgov.

the class TestUtil method createJobOutput.

public JobOutput createJobOutput(String testFile) {
    JobOutput jobOutput = new JobOutput();
    jobOutput.setFhirResourceType(EOB);
    jobOutput.setFilePath(testFile);
    jobOutput.setError(false);
    jobOutput.setChecksum("testoutput");
    jobOutput.setFileLength(20L);
    return jobOutput;
}
Also used : JobOutput(gov.cms.ab2d.common.model.JobOutput)

Example 17 with JobOutput

use of gov.cms.ab2d.common.model.JobOutput in project ab2d by CMSgov.

the class StatusCommon method getJobCompletedResponse.

private JobCompletedResponse getJobCompletedResponse(JobPollResult jobPollResult, String jobUuid, HttpServletRequest request, String apiPrefix) {
    final JobCompletedResponse resp = new JobCompletedResponse();
    final String jobStartedAt = jobPollResult.getTransactionTime();
    resp.setTransactionTime(jobStartedAt);
    resp.setRequest(jobPollResult.getRequestUrl());
    resp.setRequiresAccessToken(true);
    resp.setOutput(jobPollResult.getJobOutputs().stream().filter(o -> !o.getError()).map(o -> {
        List<JobCompletedResponse.FileMetadata> valueOutputs = generateValueOutputs(o);
        return new JobCompletedResponse.Output(o.getFhirResourceType(), getUrlPath(jobUuid, o.getFilePath(), request, apiPrefix), valueOutputs);
    }).toList());
    resp.setError(jobPollResult.getJobOutputs().stream().filter(JobOutput::getError).map(o -> {
        List<JobCompletedResponse.FileMetadata> valueOutputs = generateValueOutputs(o);
        return new JobCompletedResponse.Output(o.getFhirResourceType(), getUrlPath(jobUuid, o.getFilePath(), request, apiPrefix), valueOutputs);
    }).toList());
    return resp;
}
Also used : PdpClient(gov.cms.ab2d.common.model.PdpClient) ApiResponseEvent(gov.cms.ab2d.eventlogger.events.ApiResponseEvent) ZonedDateTime(java.time.ZonedDateTime) EXPIRES(org.springframework.http.HttpHeaders.EXPIRES) JobClient(gov.cms.ab2d.api.remote.JobClient) ArrayList(java.util.ArrayList) X_PROG(gov.cms.ab2d.api.controller.common.ApiText.X_PROG) Value(org.springframework.beans.factory.annotation.Value) ORGANIZATION(gov.cms.ab2d.common.util.Constants.ORGANIZATION) HttpServletRequest(javax.servlet.http.HttpServletRequest) Service(org.springframework.stereotype.Service) FHIR_PREFIX(gov.cms.ab2d.common.util.Constants.FHIR_PREFIX) TooFrequentInvocations(gov.cms.ab2d.common.model.TooFrequentInvocations) JOB_LOG(gov.cms.ab2d.common.util.Constants.JOB_LOG) JobCompletedResponse(gov.cms.ab2d.api.controller.JobCompletedResponse) JobOutput(gov.cms.ab2d.common.model.JobOutput) LogManager(gov.cms.ab2d.eventlogger.LogManager) HttpHeaders(org.springframework.http.HttpHeaders) ZoneId(java.time.ZoneId) HttpStatus(org.springframework.http.HttpStatus) Slf4j(lombok.extern.slf4j.Slf4j) List(java.util.List) RETRY_AFTER(org.springframework.http.HttpHeaders.RETRY_AFTER) TooManyRequestsException(gov.cms.ab2d.api.controller.TooManyRequestsException) JobProcessingException(gov.cms.ab2d.api.controller.JobProcessingException) JobPollResult(gov.cms.ab2d.common.dto.JobPollResult) MDC(org.slf4j.MDC) REQUEST_ID(gov.cms.ab2d.common.util.Constants.REQUEST_ID) DateTimeFormatter(java.time.format.DateTimeFormatter) PdpClientService(gov.cms.ab2d.common.service.PdpClientService) ResponseEntity(org.springframework.http.ResponseEntity) JobCompletedResponse(gov.cms.ab2d.api.controller.JobCompletedResponse) JobOutput(gov.cms.ab2d.common.model.JobOutput)

Aggregations

JobOutput (gov.cms.ab2d.common.model.JobOutput)17 Job (gov.cms.ab2d.common.model.Job)9 Test (org.junit.jupiter.api.Test)9 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)7 ArrayList (java.util.ArrayList)4 OffsetDateTime (java.time.OffsetDateTime)3 ContractDTO (gov.cms.ab2d.common.dto.ContractDTO)2 PdpClient (gov.cms.ab2d.common.model.PdpClient)2 LoggableEvent (gov.cms.ab2d.eventlogger.LoggableEvent)2 ContractSearchEvent (gov.cms.ab2d.eventlogger.events.ContractSearchEvent)2 List (java.util.List)2 Slf4j (lombok.extern.slf4j.Slf4j)2 IBaseBundle (org.hl7.fhir.instance.model.api.IBaseBundle)2 DisplayName (org.junit.jupiter.api.DisplayName)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Trace (com.newrelic.api.agent.Trace)1 AggregatorCallable (gov.cms.ab2d.aggregator.AggregatorCallable)1 JobCompletedResponse (gov.cms.ab2d.api.controller.JobCompletedResponse)1 JobProcessingException (gov.cms.ab2d.api.controller.JobProcessingException)1 TooManyRequestsException (gov.cms.ab2d.api.controller.TooManyRequestsException)1