use of se.inera.intyg.webcert.web.service.log.dto.LogRequest in project webcert by sklintyg.
the class LogRequestFactoryTest method testPatientNameRemovedForFkIntyg.
@Test
public void testPatientNameRemovedForFkIntyg() {
Utkast utkast = buildUtkast(intygsId, "luse", patientPersonnummer, patientFornamn, patientMellannamn, patientEfternamn, enhetsid, enhetsnamn, vardgivarid, vardgivarnamn);
LogRequest res = LogRequestFactory.createLogRequestFromUtkast(utkast);
assertNotNull(res);
assertEquals(intygsId, res.getIntygId());
assertEquals(patientPersonnummer, res.getPatientId());
assertEquals("", res.getPatientName());
assertNull(res.getAdditionalInfo());
}
use of se.inera.intyg.webcert.web.service.log.dto.LogRequest in project webcert by sklintyg.
the class IntygServiceImpl method whenSuccessfulRevoke.
/**
* Send a notification message to stakeholders informing that
* a question related to a revoked certificate has been closed.
*/
private IntygServiceResult whenSuccessfulRevoke(Utlatande intyg, String reason) {
String intygsId = intyg.getId();
String hsaId = webCertUserService.getUser().getHsaId();
monitoringService.logIntygRevoked(intygsId, hsaId, reason);
// First: send a notification informing stakeholders that this certificate has been revoked
notificationService.sendNotificationForIntygRevoked(intygsId);
// Second: send a notification informing stakeholders that all questions related to the revoked
// certificate has been closed.
arendeService.closeAllNonClosed(intygsId);
// Third: create a log event
LogRequest logRequest = LogRequestFactory.createLogRequestFromUtlatande(intyg);
logService.logRevokeIntyg(logRequest);
// Fourth: mark the originating Utkast as REVOKED
markUtkastWithRevokedDate(intygsId);
return IntygServiceResult.OK;
}
use of se.inera.intyg.webcert.web.service.log.dto.LogRequest in project webcert by sklintyg.
the class IntygServiceImpl method sendIntyg.
@Override
public IntygServiceResult sendIntyg(String intygsId, String typ, String recipient, boolean delay) {
Utlatande intyg = getUtlatandeForIntyg(intygsId, typ);
verifyEnhetsAuth(intyg, true);
if (isRevoked(intygsId, typ, false)) {
LOG.debug("Cannot send certificate with id '{}', the certificate is revoked", intygsId);
throw new WebCertServiceException(WebCertServiceErrorCodeEnum.INVALID_STATE, "Certificate is revoked");
}
verifyNotReplacedBySignedIntyg(intygsId, "send");
// WC-US-SM-001 - vi får ej skicka FK-intyg för sekretessmarkerad patient som innehåller personuppgifter.
verifyNoExposureOfSekretessmarkeradPatient(intyg);
SendIntygConfiguration sendConfig = new SendIntygConfiguration(recipient, webCertUserService.getUser());
monitoringService.logIntygSent(intygsId, recipient);
// send PDL log event
LogRequest logRequest = LogRequestFactory.createLogRequestFromUtlatande(intyg);
logRequest.setAdditionalInfo(sendConfig.getPatientConsentMessage());
logService.logSendIntygToRecipient(logRequest);
markUtkastWithSendDateAndRecipient(intygsId, recipient);
return sendIntygToCertificateSender(sendConfig, intyg, delay);
}
use of se.inera.intyg.webcert.web.service.log.dto.LogRequest in project webcert by sklintyg.
the class SignaturServiceImpl method clientNiasSignature.
@Override
public SignaturTicket clientNiasSignature(String ticketId, SignatureType signatureType, String niasCertificate, WebCertUser user) {
// Lookup signature ticket
SignaturTicket ticket = ticketTracker.getTicket(ticketId);
if (ticket == null) {
LOG.warn("Ticket '{}' hittades ej", ticketId);
throw new WebCertServiceException(WebCertServiceErrorCodeEnum.INVALID_STATE, "Biljett " + ticketId + " hittades ej");
}
LOG.debug("Klientsignering ticket '{}' intyg '{}'", ticket.getId(), ticket.getIntygsId());
// Fetch the draft
Utkast utkast = getUtkastForSignering(ticket.getIntygsId(), ticket.getVersion(), user);
// Create and persist the new signature
StringWriter sw = new StringWriter();
JAXB.marshal(signatureType, sw);
String rawSignaturXml = sw.toString();
ticket = createAndPersistSignature(utkast, ticket, rawSignaturXml, user);
monitoringService.logIntygSigned(utkast.getIntygsId(), utkast.getIntygsTyp(), user.getHsaId(), user.getAuthenticationScheme(), utkast.getRelationKod());
// Notify stakeholders when certificate has been signed
notificationService.sendNotificationForDraftSigned(utkast);
LogRequest logRequest = LogRequestFactory.createLogRequestFromUtkast(utkast);
// Note that we explictly supplies the WebCertUser here. The NIAS finalization is not executed in a HTTP
// request context and thus we need to supply the user instance manually.
logService.logSignIntyg(logRequest, logService.getLogUser(user));
intygService.handleAfterSigned(utkast);
return ticketTracker.updateStatus(ticket.getId(), SignaturTicket.Status.SIGNERAD);
}
use of se.inera.intyg.webcert.web.service.log.dto.LogRequest in project webcert by sklintyg.
the class LogRequestFactory method createLogRequestFromUser.
public static LogRequest createLogRequestFromUser(WebCertUser user, String patientId) {
LogRequest request = new LogRequest();
request.setPatientId(Personnummer.createPersonnummer(patientId).get());
request.setPatientName("");
request.setIntygCareUnitId(user.getValdVardenhet().getId());
request.setIntygCareUnitName(user.getValdVardenhet().getNamn());
request.setIntygCareGiverId(user.getValdVardgivare().getId());
request.setIntygCareGiverName(user.getValdVardgivare().getNamn());
if (user.getParameters() != null && user.getParameters().isSjf()) {
request.setAdditionalInfo(COHERENT_JOURNALING_LOG_POST);
}
return request;
}
Aggregations