use of se.inera.intyg.webcert.intygstjanststub.mode.StubModeAware in project webcert by sklintyg.
the class GetMedicalCertificateResponderStub method getMedicalCertificate.
@Override
@StubLatencyAware
@StubModeAware
public GetMedicalCertificateResponseType getMedicalCertificate(String logicalAddress, GetMedicalCertificateRequestType request) {
GetMedicalCertificateResponseType response = new GetMedicalCertificateResponseType();
CertificateHolder intygResponse = intygStore.getIntygForCertificateId(request.getCertificateId());
if (intygResponse != null) {
response.setMeta(ModelConverter.toCertificateMetaType(intygResponse));
attachCertificateDocument(intygResponse, response);
if (intygResponse.isRevoked()) {
response.setResult(ResultTypeUtil.errorResult(ErrorIdType.REVOKED, String.format("Certificate '%s' has been revoked", intygResponse.getId())));
} else {
response.setResult(ResultTypeUtil.okResult());
}
} else {
response.setResult(ResultTypeUtil.errorResult(ErrorIdType.VALIDATION_ERROR, "Intyg not found in stub"));
}
return response;
}
use of se.inera.intyg.webcert.intygstjanststub.mode.StubModeAware in project webcert by sklintyg.
the class ListCertificatesForCareResponderStub method listCertificatesForCare.
@Override
@StubLatencyAware
@StubModeAware
public ListCertificatesForCareResponseType listCertificatesForCare(String logicalAddress, ListCertificatesForCareType parameters) {
ListCertificatesForCareResponseType response = new ListCertificatesForCareResponseType();
response.setIntygsLista(new ListaType());
response.getIntygsLista().getIntyg();
List<CertificateHolder> intygForEnhetAndPersonnummer = intygStore.getIntygForEnhetAndPersonnummer(parameters.getEnhetsId().stream().map(HsaId::getExtension).collect(Collectors.toList()), parameters.getPersonId().getExtension());
for (CertificateHolder cert : intygForEnhetAndPersonnummer) {
Intyg intyg = getIntyg(cert);
intyg.getStatus().addAll(CertificateStateHolderConverter.toIntygsStatusType(cert.getCertificateStates()));
response.getIntygsLista().getIntyg().add(intyg);
}
return response;
}
use of se.inera.intyg.webcert.intygstjanststub.mode.StubModeAware in project webcert by sklintyg.
the class SendCertificateToRecipientResponderStub method sendCertificateToRecipient.
@Override
@StubLatencyAware
@StubModeAware
public SendCertificateToRecipientResponseType sendCertificateToRecipient(String logicalAddress, SendCertificateToRecipientType parameters) {
CertificateHolder fromStore = intygStore.getIntygForCertificateId(parameters.getIntygsId().getExtension());
SendCertificateToRecipientResponseType responseType = new SendCertificateToRecipientResponseType();
if (fromStore == null) {
ResultType resultOfCall = new ResultType();
resultOfCall.setResultCode(ResultCodeType.ERROR);
resultOfCall.setErrorId(ErrorIdType.APPLICATION_ERROR);
responseType.setResult(resultOfCall);
return responseType;
}
intygStore.addStatus(parameters.getIntygsId().getExtension(), new CertificateStateHolder("FKASSA", CertificateState.SENT, LocalDateTime.now()));
ResultType resultType = new ResultType();
resultType.setResultCode(ResultCodeType.OK);
responseType.setResult(resultType);
return responseType;
}
use of se.inera.intyg.webcert.intygstjanststub.mode.StubModeAware in project webcert by sklintyg.
the class RegisterTSBasResponderStub method registerTSBas.
@Override
@StubModeAware
public RegisterTSBasResponseType registerTSBas(String logicalAddress, RegisterTSBasType parameters) {
intygStore.addIntyg(buildStubInternalCertificate(parameters));
RegisterTSBasResponseType resp = new RegisterTSBasResponseType();
ResultatTyp resultatTyp = new ResultatTyp();
resultatTyp.setResultCode(ResultCodeType.OK);
resp.setResultat(resultatTyp);
return resp;
}
use of se.inera.intyg.webcert.intygstjanststub.mode.StubModeAware in project webcert by sklintyg.
the class RegisterTSDiabetesResponderStub method registerTSDiabetes.
@Override
@StubModeAware
public RegisterTSDiabetesResponseType registerTSDiabetes(String logicalAddress, RegisterTSDiabetesType parameters) {
intygStore.addIntyg(buildStubInternalCertificate(parameters));
RegisterTSDiabetesResponseType resp = new RegisterTSDiabetesResponseType();
ResultatTyp resultatTyp = new ResultatTyp();
resultatTyp.setResultCode(ResultCodeType.OK);
resp.setResultat(resultatTyp);
return resp;
}
Aggregations