Search in sources :

Example 6 with CustomObjectMapper

use of se.inera.intyg.common.util.integration.json.CustomObjectMapper in project webcert by sklintyg.

the class CopyCompletionUtkastBuilderTest method createIntygContentHolder.

private IntygContentHolder createIntygContentHolder() throws Exception {
    List<Status> status = new ArrayList<>();
    status.add(new Status(CertificateState.RECEIVED, "HSVARD", LocalDateTime.now()));
    status.add(new Status(CertificateState.SENT, "FKASSA", LocalDateTime.now()));
    Fk7263Utlatande utlatande = new CustomObjectMapper().readValue(new ClassPathResource("IntygDraftServiceImplTest/utlatande.json").getFile(), Fk7263Utlatande.class);
    return IntygContentHolder.builder().setContents("<external-json/>").setUtlatande(utlatande).setStatuses(status).setRevoked(false).setRelations(new Relations()).setDeceased(false).setSekretessmarkering(false).setPatientNameChangedInPU(false).setPatientAddressChangedInPU(false).build();
}
Also used : ValidationStatus(se.inera.intyg.common.support.modules.support.api.dto.ValidationStatus) Status(se.inera.intyg.common.support.model.Status) Fk7263Utlatande(se.inera.intyg.common.fk7263.model.internal.Fk7263Utlatande) CustomObjectMapper(se.inera.intyg.common.util.integration.json.CustomObjectMapper) ArrayList(java.util.ArrayList) Relations(se.inera.intyg.webcert.web.web.controller.api.dto.Relations) ClassPathResource(org.springframework.core.io.ClassPathResource)

Example 7 with CustomObjectMapper

use of se.inera.intyg.common.util.integration.json.CustomObjectMapper in project webcert by sklintyg.

the class CreateRenewalCopyUtkastBuilderImplTest method createIntygContentHolder.

private IntygContentHolder createIntygContentHolder() throws Exception {
    List<Status> status = new ArrayList<>();
    status.add(new Status(CertificateState.RECEIVED, "HSVARD", LocalDateTime.now()));
    status.add(new Status(CertificateState.SENT, "FKASSA", LocalDateTime.now()));
    Fk7263Utlatande utlatande = new CustomObjectMapper().readValue(new ClassPathResource("IntygDraftServiceImplTest/utlatande.json").getFile(), Fk7263Utlatande.class);
    return IntygContentHolder.builder().setContents("<external-json/>").setUtlatande(utlatande).setStatuses(status).setRevoked(false).setRelations(new Relations()).setDeceased(false).setSekretessmarkering(false).setPatientNameChangedInPU(false).setPatientAddressChangedInPU(false).build();
}
Also used : ValidationStatus(se.inera.intyg.common.support.modules.support.api.dto.ValidationStatus) Status(se.inera.intyg.common.support.model.Status) Fk7263Utlatande(se.inera.intyg.common.fk7263.model.internal.Fk7263Utlatande) CustomObjectMapper(se.inera.intyg.common.util.integration.json.CustomObjectMapper) ArrayList(java.util.ArrayList) Relations(se.inera.intyg.webcert.web.web.controller.api.dto.Relations) ClassPathResource(org.springframework.core.io.ClassPathResource)

Example 8 with CustomObjectMapper

use of se.inera.intyg.common.util.integration.json.CustomObjectMapper in project webcert by sklintyg.

the class CreateUtkastFromTemplateBuilderTest method createIntygContentHolder.

private IntygContentHolder createIntygContentHolder() throws Exception {
    List<Status> status = new ArrayList<>();
    status.add(new Status(CertificateState.RECEIVED, "HSVARD", LocalDateTime.now()));
    status.add(new Status(CertificateState.SENT, "SKV", LocalDateTime.now()));
    DbUtlatande utlatande = new CustomObjectMapper().readValue(new ClassPathResource("IntygDraftServiceImplTest/db-utlatande.json").getFile(), DbUtlatande.class);
    return IntygContentHolder.builder().setContents("<external-json/>").setUtlatande(utlatande).setStatuses(status).setRevoked(false).setRelations(new Relations()).setDeceased(false).setSekretessmarkering(false).setPatientNameChangedInPU(false).setPatientAddressChangedInPU(false).build();
}
Also used : Status(se.inera.intyg.common.support.model.Status) ValidationStatus(se.inera.intyg.common.support.modules.support.api.dto.ValidationStatus) DbUtlatande(se.inera.intyg.common.db.model.internal.DbUtlatande) CustomObjectMapper(se.inera.intyg.common.util.integration.json.CustomObjectMapper) ArrayList(java.util.ArrayList) Relations(se.inera.intyg.webcert.web.web.controller.api.dto.Relations) ClassPathResource(org.springframework.core.io.ClassPathResource)

Example 9 with CustomObjectMapper

use of se.inera.intyg.common.util.integration.json.CustomObjectMapper in project webcert by sklintyg.

the class IntegreradeEnheterBootstrapBean method addIntegreradEnhet.

private void addIntegreradEnhet(Resource res) {
    try {
        IntegreradEnhet integreradEnhet = new CustomObjectMapper().readValue(res.getInputStream(), IntegreradEnhet.class);
        integreradEnhet.setSkapadDatum(LocalDateTime.now());
        integreradEnhetRepository.save(integreradEnhet);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
Also used : CustomObjectMapper(se.inera.intyg.common.util.integration.json.CustomObjectMapper) IOException(java.io.IOException) IntegreradEnhet(se.inera.intyg.webcert.persistence.integreradenhet.model.IntegreradEnhet)

Example 10 with CustomObjectMapper

use of se.inera.intyg.common.util.integration.json.CustomObjectMapper in project webcert by sklintyg.

the class FragaSvarConverterTest method compareObjectWithReferenceFile.

private void compareObjectWithReferenceFile(Object object, String fileName) throws IOException {
    ObjectMapper objectMapper = new CustomObjectMapper();
    JsonNode tree = objectMapper.valueToTree(object);
    JsonNode expectedTree = objectMapper.readTree(new ClassPathResource(fileName).getInputStream());
    assertEquals("JSON does not match expectation. Resulting JSON is \n" + tree.toString() + "\n", expectedTree, tree);
}
Also used : CustomObjectMapper(se.inera.intyg.common.util.integration.json.CustomObjectMapper) JsonNode(com.fasterxml.jackson.databind.JsonNode) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) CustomObjectMapper(se.inera.intyg.common.util.integration.json.CustomObjectMapper) ClassPathResource(org.springframework.core.io.ClassPathResource)

Aggregations

CustomObjectMapper (se.inera.intyg.common.util.integration.json.CustomObjectMapper)10 ClassPathResource (org.springframework.core.io.ClassPathResource)5 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 Status (se.inera.intyg.common.support.model.Status)3 ValidationStatus (se.inera.intyg.common.support.modules.support.api.dto.ValidationStatus)3 Relations (se.inera.intyg.webcert.web.web.controller.api.dto.Relations)3 StringWriter (java.io.StringWriter)2 Fk7263Utlatande (se.inera.intyg.common.fk7263.model.internal.Fk7263Utlatande)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 PostConstruct (javax.annotation.PostConstruct)1 Before (org.junit.Before)1 Test (org.junit.Test)1 DbUtlatande (se.inera.intyg.common.db.model.internal.DbUtlatande)1 Utlatande (se.inera.intyg.common.support.model.common.internal.Utlatande)1 Vardgivare (se.inera.intyg.infra.integration.hsa.model.Vardgivare)1 Arende (se.inera.intyg.webcert.persistence.arende.model.Arende)1 MedicinsktArende (se.inera.intyg.webcert.persistence.arende.model.MedicinsktArende)1 FragaSvar (se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar)1