Search in sources :

Example 6 with ResultType

use of se.riv.clinicalprocess.healthcond.certificate.v1.ResultType 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 to '{}' for intyg '{}'", logicalAddress, request.getUtlatande().getUtlatandeId().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) ResultType(se.riv.clinicalprocess.healthcond.certificate.v1.ResultType) PermanentException(se.inera.intyg.webcert.common.sender.exception.PermanentException) TemporaryException(se.inera.intyg.webcert.common.sender.exception.TemporaryException)

Example 7 with ResultType

use of se.riv.clinicalprocess.healthcond.certificate.v1.ResultType in project webcert by sklintyg.

the class SendMessageToRecipientProcessor method process.

public void process(@Body String xmlBody, @Header(Constants.INTYGS_ID) String intygsId, @Header(Constants.LOGICAL_ADDRESS) String logicalAddress) throws TemporaryException, PermanentException {
    try {
        SendMessageToRecipientType parameters = SendMessageToRecipientTypeConverter.fromXml(xmlBody);
        SendMessageToRecipientResponseType response = sendMessageToRecipientResponder.sendMessageToRecipient(logicalAddress, parameters);
        ResultType result = response.getResult();
        switch(result.getResultCode()) {
            case OK:
            case INFO:
                return;
            case ERROR:
                switch(result.getErrorId()) {
                    case REVOKED:
                    case VALIDATION_ERROR:
                        LOG.error("Call to sendMessageToRecipient for intyg {} caused an error: {}, ErrorId: {}." + " Rethrowing as PermanentException", intygsId, result.getResultText(), result.getErrorId());
                        throw new PermanentException(result.getResultText());
                    case APPLICATION_ERROR:
                    case TECHNICAL_ERROR:
                        LOG.error("Call to sendMessageToRecipient for intyg {} caused an error: {}, ErrorId: {}." + " Rethrowing as TemporaryException", intygsId, result.getResultText(), result.getErrorId());
                        throw new TemporaryException(result.getResultText());
                }
        }
    } catch (JAXBException e) {
        LOG.error("Call to sendMessageToRecipient for intyg {} caused an error: {}. Rethrowing as PermanentException", intygsId, e.getMessage());
        throw new PermanentException(e.getMessage());
    } catch (WebServiceException e) {
        LOG.error("Call to sendMessageToRecipient for intyg {} caused an error: {}. Will retry", intygsId, e.getMessage());
        throw new TemporaryException(e.getMessage());
    }
}
Also used : TemporaryException(se.inera.intyg.webcert.common.sender.exception.TemporaryException) WebServiceException(javax.xml.ws.WebServiceException) PermanentException(se.inera.intyg.webcert.common.sender.exception.PermanentException) JAXBException(javax.xml.bind.JAXBException) SendMessageToRecipientType(se.riv.clinicalprocess.healthcond.certificate.sendMessageToRecipient.v2.SendMessageToRecipientType) ResultType(se.riv.clinicalprocess.healthcond.certificate.v3.ResultType) SendMessageToRecipientResponseType(se.riv.clinicalprocess.healthcond.certificate.sendMessageToRecipient.v2.SendMessageToRecipientResponseType)

Example 8 with ResultType

use of se.riv.clinicalprocess.healthcond.certificate.v1.ResultType in project webcert by sklintyg.

the class CreateDraftCertificateResponderImpl method createSuccessResponse.

/**
 * The response sent back to caller when creating a certificate draft succeeded.
 */
private CreateDraftCertificateResponseType createSuccessResponse(String nyttUtkastsId) {
    ResultType result = ResultTypeUtil.okResult();
    UtlatandeId utlId = new UtlatandeId();
    utlId.setRoot("utlatandeId");
    utlId.setExtension(nyttUtkastsId);
    CreateDraftCertificateResponseType response = new CreateDraftCertificateResponseType();
    response.setResult(result);
    response.setUtlatandeId(utlId);
    return response;
}
Also used : CreateDraftCertificateResponseType(se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v1.CreateDraftCertificateResponseType) UtlatandeId(se.riv.clinicalprocess.healthcond.certificate.types.v1.UtlatandeId) ResultType(se.riv.clinicalprocess.healthcond.certificate.v1.ResultType)

Example 9 with ResultType

use of se.riv.clinicalprocess.healthcond.certificate.v1.ResultType in project webcert by sklintyg.

the class CreateDraftCertificateResponderImpl method createSuccessResponse.

/**
 * The response sent back to caller when creating a certificate draft succeeded.
 */
private CreateDraftCertificateResponseType createSuccessResponse(String nyttUtkastsId, String invokingUnitHsaId) {
    ResultType result = ResultTypeUtil.okResult();
    IntygId intygId = new IntygId();
    intygId.setRoot(invokingUnitHsaId);
    intygId.setExtension(nyttUtkastsId);
    CreateDraftCertificateResponseType response = new CreateDraftCertificateResponseType();
    response.setResult(result);
    response.setIntygsId(intygId);
    return response;
}
Also used : CreateDraftCertificateResponseType(se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.CreateDraftCertificateResponseType) ResultType(se.riv.clinicalprocess.healthcond.certificate.v3.ResultType) IntygId(se.riv.clinicalprocess.healthcond.certificate.types.v3.IntygId)

Example 10 with ResultType

use of se.riv.clinicalprocess.healthcond.certificate.v1.ResultType in project webcert by sklintyg.

the class CreateDraftCertificateResponderImpl method createErrorResponse.

/**
 * The response sent back to caller when an error is raised.
 */
private CreateDraftCertificateResponseType createErrorResponse(String errorMsg, ErrorIdType errorType) {
    ResultType result = ResultTypeUtil.errorResult(errorType, errorMsg);
    CreateDraftCertificateResponseType response = new CreateDraftCertificateResponseType();
    response.setResult(result);
    return response;
}
Also used : CreateDraftCertificateResponseType(se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v1.CreateDraftCertificateResponseType) ResultType(se.riv.clinicalprocess.healthcond.certificate.v1.ResultType)

Aggregations

ResultType (se.riv.clinicalprocess.healthcond.certificate.v3.ResultType)12 PermanentException (se.inera.intyg.webcert.common.sender.exception.PermanentException)4 TemporaryException (se.inera.intyg.webcert.common.sender.exception.TemporaryException)4 SendCertificateToRecipientResponseType (se.riv.clinicalprocess.healthcond.certificate.sendCertificateToRecipient.v2.SendCertificateToRecipientResponseType)4 CertificateStatusUpdateForCareResponseType (se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareResponseType)3 ResultType (se.riv.clinicalprocess.healthcond.certificate.v1.ResultType)3 WebServiceException (javax.xml.ws.WebServiceException)2 CreateDraftCertificateResponseType (se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v1.CreateDraftCertificateResponseType)2 CreateDraftCertificateResponseType (se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.CreateDraftCertificateResponseType)2 ArrayList (java.util.ArrayList)1 JAXBException (javax.xml.bind.JAXBException)1 QName (javax.xml.namespace.QName)1 ElementSetType (net.opengis.cat.csw.v_2_0_2.ElementSetType)1 GetRecordsType (net.opengis.cat.csw.v_2_0_2.GetRecordsType)1 ResultType (net.opengis.cat.csw.v_2_0_2.ResultType)1 CswRecordCollection (org.codice.ddf.spatial.ogc.csw.catalog.common.CswRecordCollection)1 CertificateHolder (se.inera.intyg.common.support.modules.support.api.CertificateHolder)1 CertificateStateHolder (se.inera.intyg.common.support.modules.support.api.CertificateStateHolder)1 WebCertServiceException (se.inera.intyg.webcert.common.service.exception.WebCertServiceException)1 StubLatencyAware (se.inera.intyg.webcert.intygstjanststub.mode.StubLatencyAware)1