Search in sources :

Example 11 with CertificateStatusUpdateForCareType

use of se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareType in project webcert by sklintyg.

the class NotificationWSClient method sendStatusUpdate.

public void sendStatusUpdate(CertificateStatusUpdateForCareType request, @Header(NotificationRouteHeaders.LOGISK_ADRESS) String logicalAddress) throws TemporaryException, PermanentException {
    LOG.debug("Sending status update with version 2 to '{}' for intyg '{}'", logicalAddress, request.getIntyg().getIntygsId().getExtension());
    CertificateStatusUpdateForCareResponseType response = null;
    try {
        response = statusUpdateForCareClient.certificateStatusUpdateForCare(logicalAddress, request);
    } catch (Exception e) {
        LOG.warn("Exception occured when sending status update: {}", e.getMessage());
        throw new TemporaryException(e);
    }
    ResultType result = response.getResult();
    switch(result.getResultCode()) {
        case ERROR:
            if (ErrorIdType.TECHNICAL_ERROR.equals(result.getErrorId())) {
                throw new TemporaryException(String.format("NotificationWSClient failed with error code: %s and message %s", result.getErrorId(), result.getResultText()));
            } else {
                throw new PermanentException(String.format("NotificationWSClient failed with non-recoverable error code: %s and message %s", result.getErrorId(), result.getResultText()));
            }
        case INFO:
            LOG.info("NotificationWSClient got message:" + result.getResultText());
            break;
        case OK:
            break;
    }
}
Also used : TemporaryException(se.inera.intyg.webcert.common.sender.exception.TemporaryException) PermanentException(se.inera.intyg.webcert.common.sender.exception.PermanentException) CertificateStatusUpdateForCareResponseType(se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareResponseType) ResultType(se.riv.clinicalprocess.healthcond.certificate.v3.ResultType) PermanentException(se.inera.intyg.webcert.common.sender.exception.PermanentException) TemporaryException(se.inera.intyg.webcert.common.sender.exception.TemporaryException)

Example 12 with CertificateStatusUpdateForCareType

use of se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareType in project webcert by sklintyg.

the class NotificationWSClientTest method createRequest.

private CertificateStatusUpdateForCareType createRequest() {
    CertificateStatusUpdateForCareType res = new CertificateStatusUpdateForCareType();
    res.setIntyg(new Intyg());
    res.getIntyg().setIntygsId(new IntygId());
    res.getIntyg().getIntygsId().setExtension("intygsId");
    return res;
}
Also used : Intyg(se.riv.clinicalprocess.healthcond.certificate.v3.Intyg) CertificateStatusUpdateForCareType(se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareType) IntygId(se.riv.clinicalprocess.healthcond.certificate.types.v3.IntygId)

Example 13 with CertificateStatusUpdateForCareType

use of se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareType in project webcert by sklintyg.

the class NotificationRouteBuilder method initializeJaxbMessageDataFormatV3.

// CHECKSTYLE:OFF LineLength
private JaxbDataFormat initializeJaxbMessageDataFormatV3() throws JAXBException {
    // We need to register DatePeriodType with the JAXBContext explicitly for some reason.
    JaxbDataFormat jaxbMessageDataFormatV3 = new JaxbDataFormat(JAXBContext.newInstance(CertificateStatusUpdateForCareType.class, DatePeriodType.class, PartialDateType.class));
    jaxbMessageDataFormatV3.setPartClass("se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareType");
    jaxbMessageDataFormatV3.setPartNamespace(new QName("urn:riv:clinicalprocess:healthcond:certificate:CertificateStatusUpdateForCareResponder:3", "CertificateStatusUpdateForCare"));
    return jaxbMessageDataFormatV3;
}
Also used : PartialDateType(se.riv.clinicalprocess.healthcond.certificate.types.v3.PartialDateType) QName(javax.xml.namespace.QName) CertificateStatusUpdateForCareType(se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareType) DatePeriodType(se.riv.clinicalprocess.healthcond.certificate.types.v3.DatePeriodType) JaxbDataFormat(org.apache.camel.converter.jaxb.JaxbDataFormat)

Aggregations

CertificateStatusUpdateForCareType (se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareType)6 NotificationMessage (se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage)5 CertificateStatusUpdateForCareType (se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.CertificateStatusUpdateForCareType)5 UtlatandeType (se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.UtlatandeType)4 UtlatandeId (se.riv.clinicalprocess.healthcond.certificate.types.v1.UtlatandeId)4 Intyg (se.riv.clinicalprocess.healthcond.certificate.v3.Intyg)4 LocalDateTime (java.time.LocalDateTime)3 Test (org.junit.Test)3 HandelsekodEnum (se.inera.intyg.common.support.common.enumerations.HandelsekodEnum)3 ArendeCount (se.inera.intyg.common.support.modules.support.api.notification.ArendeCount)3 Handelse (se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.Handelse)2 CertificateStatusUpdateForCareResponseType (se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareResponseType)2 ResultType (se.riv.clinicalprocess.healthcond.certificate.v3.ResultType)2 LocalDate (java.time.LocalDate)1 List (java.util.List)1 Map (java.util.Map)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 QName (javax.xml.namespace.QName)1