Search in sources :

Example 16 with LogRequest

use of se.inera.intyg.webcert.web.service.log.dto.LogRequest in project webcert by sklintyg.

the class LogServiceImplTest method testActivityArgsAreIdenticalToAdditionalInfo.

public void testActivityArgsAreIdenticalToAdditionalInfo() {
    LogRequest logRequest = new LogRequest();
    logRequest.setIntygId("abc123");
    logRequest.setPatientId(createPnr("19121212-1212"));
    logRequest.setPatientName("Hans Olof van der Test");
    logRequest.setAdditionalInfo("this is additional");
    logService.logPrintIntygAsPDF(logRequest);
}
Also used : LogRequest(se.inera.intyg.webcert.web.service.log.dto.LogRequest)

Example 17 with LogRequest

use of se.inera.intyg.webcert.web.service.log.dto.LogRequest in project webcert by sklintyg.

the class LogServiceImplTest method logServiceJmsException.

@Test(expected = JmsException.class)
public void logServiceJmsException() throws Exception {
    when(userService.getUser()).thenReturn(createUser());
    doThrow(new DestinationResolutionException("")).when(template).send(any(MessageCreator.class));
    LogRequest logRequest = new LogRequest();
    logRequest.setIntygId("abc123");
    logRequest.setPatientId(createPnr("19121212-1212"));
    logRequest.setPatientName("Hans Olof van der Test");
    try {
        logService.logReadIntyg(logRequest);
    } finally {
        verify(template, times(1)).send(any(MessageCreator.class));
    }
}
Also used : LogRequest(se.inera.intyg.webcert.web.service.log.dto.LogRequest) DestinationResolutionException(org.springframework.jms.support.destination.DestinationResolutionException) MessageCreator(org.springframework.jms.core.MessageCreator) Test(org.junit.Test)

Example 18 with LogRequest

use of se.inera.intyg.webcert.web.service.log.dto.LogRequest in project webcert by sklintyg.

the class UtkastServiceImpl method getDraft.

@Override
@Transactional(readOnly = true)
public Utkast getDraft(String intygId, String intygType) {
    Utkast utkast = getIntygAsDraft(intygId, intygType);
    LogRequest logRequest = LogRequestFactory.createLogRequestFromUtkast(utkast);
    abortIfUserNotAuthorizedForUnit(utkast.getVardgivarId(), utkast.getEnhetsId());
    // Log read to PDL
    logService.logReadIntyg(logRequest);
    // Log read to monitoring log
    monitoringService.logUtkastRead(utkast.getIntygsId(), utkast.getIntygsTyp());
    return utkast;
}
Also used : LogRequest(se.inera.intyg.webcert.web.service.log.dto.LogRequest) Utkast(se.inera.intyg.webcert.persistence.utkast.model.Utkast) Transactional(org.springframework.transaction.annotation.Transactional)

Example 19 with LogRequest

use of se.inera.intyg.webcert.web.service.log.dto.LogRequest in project webcert by sklintyg.

the class UtkastServiceImpl method logCreateDraftPDL.

private void logCreateDraftPDL(Utkast utkast, LogUser logUser) {
    LogRequest logRequest = LogRequestFactory.createLogRequestFromUtkast(utkast);
    logService.logCreateIntyg(logRequest, logUser);
}
Also used : LogRequest(se.inera.intyg.webcert.web.service.log.dto.LogRequest)

Example 20 with LogRequest

use of se.inera.intyg.webcert.web.service.log.dto.LogRequest in project webcert by sklintyg.

the class IntygServiceImpl method fetchIntygData.

/**
 * Returns the IntygContentHolder. Used both externally to frontend and internally in the modules.
 *
 * @param intygsId  the identifier of the intyg.
 * @param intygsTyp the typ of the intyg. Used to call the correct module.
 * @param relations If the relations between intyg should be populated. This can be expensive (several database
 *                  operations). Use sparsely.
 */
private IntygContentHolder fetchIntygData(String intygsId, String intygsTyp, boolean relations, boolean coherentJournaling) {
    IntygContentHolder intygsData = getIntygData(intygsId, intygsTyp, relations);
    LogRequest logRequest = LogRequestFactory.createLogRequestFromUtlatande(intygsData.getUtlatande(), coherentJournaling);
    if (!coherentJournaling) {
        verifyEnhetsAuth(intygsData.getUtlatande(), true);
    }
    Personnummer pnr = intygsData.getUtlatande().getGrundData().getPatient().getPersonId();
    String enhetsId = intygsData.getUtlatande().getGrundData().getSkapadAv().getVardenhet().getEnhetsid();
    verifySekretessmarkering(intygsTyp, webCertUserService.getUser(), enhetsId, pnr);
    // Log read to PDL
    logService.logReadIntyg(logRequest);
    // Log read to monitoring log
    monitoringService.logIntygRead(intygsId, intygsTyp);
    return intygsData;
}
Also used : Personnummer(se.inera.intyg.schemas.contract.Personnummer) LogRequest(se.inera.intyg.webcert.web.service.log.dto.LogRequest) IntygContentHolder(se.inera.intyg.webcert.web.service.intyg.dto.IntygContentHolder)

Aggregations

LogRequest (se.inera.intyg.webcert.web.service.log.dto.LogRequest)25 Utkast (se.inera.intyg.webcert.persistence.utkast.model.Utkast)11 Test (org.junit.Test)7 Transactional (org.springframework.transaction.annotation.Transactional)5 WebCertServiceException (se.inera.intyg.webcert.common.service.exception.WebCertServiceException)5 SignaturTicket (se.inera.intyg.webcert.web.service.signatur.dto.SignaturTicket)3 OptimisticLockException (javax.persistence.OptimisticLockException)2 MessageCreator (org.springframework.jms.core.MessageCreator)2 Utlatande (se.inera.intyg.common.support.model.common.internal.Utlatande)2 ModuleApi (se.inera.intyg.common.support.modules.support.api.ModuleApi)2 ModuleException (se.inera.intyg.common.support.modules.support.api.exception.ModuleException)2 UtkastStatus (se.inera.intyg.webcert.common.model.UtkastStatus)2 IOException (java.io.IOException)1 StringWriter (java.io.StringWriter)1 Session (javax.jms.Session)1 DestinationResolutionException (org.springframework.jms.support.destination.DestinationResolutionException)1 Relation (se.inera.intyg.common.support.model.common.internal.Relation)1 ModuleNotFoundException (se.inera.intyg.common.support.modules.registry.ModuleNotFoundException)1 PdlLogMessage (se.inera.intyg.infra.logmessages.PdlLogMessage)1 Personnummer (se.inera.intyg.schemas.contract.Personnummer)1