Search in sources :

Example 1 with CustomObjectMapper

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

the class ArendeViewConverterTest method convertToJson.

@Test
public void convertToJson() throws JsonGenerationException, JsonMappingException, IOException {
    Arende arende = buildArende("lisjp");
    StringWriter jsonWriter = new StringWriter();
    CustomObjectMapper objectMapper = new CustomObjectMapper();
    objectMapper.writeValue(jsonWriter, arende);
}
Also used : StringWriter(java.io.StringWriter) CustomObjectMapper(se.inera.intyg.common.util.integration.json.CustomObjectMapper) MedicinsktArende(se.inera.intyg.webcert.persistence.arende.model.MedicinsktArende) Arende(se.inera.intyg.webcert.persistence.arende.model.Arende) Test(org.junit.Test)

Example 2 with CustomObjectMapper

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

the class IntygResource method updateUtkastForSend.

private void updateUtkastForSend(@PathParam("id") String id) {
    Utkast utkast = utkastRepository.findOne(id);
    if (utkast != null) {
        utkast.setStatus(UtkastStatus.SIGNED);
        Utlatande utlatande = moduleFacade.getUtlatandeFromInternalModel(utkast.getIntygsTyp(), utkast.getModel());
        utlatande.getGrundData().setSigneringsdatum(LocalDateTime.now());
        try {
            CustomObjectMapper mapper = new CustomObjectMapper();
            StringWriter writer = new StringWriter();
            mapper.writeValue(writer, utlatande);
            utkast.setModel(writer.toString());
        } catch (IOException e) {
            LOG.error("Could not update the model of the utkast. Failed with message ", e.getMessage());
        }
        if (utkast.getSignatur() == null) {
            Signatur sig = new Signatur(LocalDateTime.now(), "", id, "", "", "");
            utkast.setSignatur(sig);
        }
        utkast.setSkickadTillMottagare("FKASSA");
        utkast.setSkickadTillMottagareDatum(LocalDateTime.now());
        utkastRepository.save(utkast);
    }
}
Also used : Signatur(se.inera.intyg.webcert.persistence.utkast.model.Signatur) StringWriter(java.io.StringWriter) Utkast(se.inera.intyg.webcert.persistence.utkast.model.Utkast) Utlatande(se.inera.intyg.common.support.model.common.internal.Utlatande) CustomObjectMapper(se.inera.intyg.common.util.integration.json.CustomObjectMapper) IOException(java.io.IOException)

Example 3 with CustomObjectMapper

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

the class FragaSvarBootstrapBean method addFragaSvar.

private void addFragaSvar(Resource res) {
    try {
        FragaSvar fragaSvar = new CustomObjectMapper().readValue(res.getInputStream(), FragaSvar.class);
        fragaSvarRepository.save(fragaSvar);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
Also used : CustomObjectMapper(se.inera.intyg.common.util.integration.json.CustomObjectMapper) FragaSvar(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar) IOException(java.io.IOException)

Example 4 with CustomObjectMapper

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

the class IntygServiceConfigurationManagerTest method setup.

@Before
public void setup() {
    configurationManager = new IntygServiceConfigurationManagerImpl();
    configurationManager.setObjectMapper(new CustomObjectMapper());
}
Also used : CustomObjectMapper(se.inera.intyg.common.util.integration.json.CustomObjectMapper) Before(org.junit.Before)

Example 5 with CustomObjectMapper

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

the class MailNotificationServiceTest method setupTestlandVardgivare.

@PostConstruct
public void setupTestlandVardgivare() throws IOException {
    Vardgivare vardgivare = new CustomObjectMapper().readValue(new ClassPathResource("MailNotificationServiceTest/landstinget-testland.json").getFile(), Vardgivare.class);
    hsaStub.getVardgivare().add(vardgivare);
}
Also used : CustomObjectMapper(se.inera.intyg.common.util.integration.json.CustomObjectMapper) Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare) ClassPathResource(org.springframework.core.io.ClassPathResource) PostConstruct(javax.annotation.PostConstruct)

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