Search in sources :

Example 1 with LogUser

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

the class UtkastServiceImpl method createNewDraft.

@Override
public Utkast createNewDraft(CreateNewDraftRequest request) {
    populateRequestWithIntygId(request);
    request.setStatus(UtkastStatus.DRAFT_INCOMPLETE);
    String intygType = request.getIntygType();
    CreateNewDraftHolder draftRequest = createModuleRequest(request);
    String intygJsonModel = getPopulatedModelFromIntygModule(intygType, draftRequest);
    Utkast savedUtkast = persistNewDraft(request, intygJsonModel);
    // Persist the referens if supplied
    if (!Strings.isNullOrEmpty(request.getReferens())) {
        referensService.saveReferens(request.getIntygId(), request.getReferens());
    }
    monitoringService.logUtkastCreated(savedUtkast.getIntygsId(), savedUtkast.getIntygsTyp(), savedUtkast.getEnhetsId(), savedUtkast.getSkapadAv().getHsaId());
    // Notify stakeholders when a draft has been created
    sendNotification(savedUtkast, Event.CREATED);
    // Create a PDL log for this action
    LogUser logUser = createLogUser(request);
    logCreateDraftPDL(savedUtkast, logUser);
    return savedUtkast;
}
Also used : Utkast(se.inera.intyg.webcert.persistence.utkast.model.Utkast) LogUser(se.inera.intyg.webcert.web.service.log.dto.LogUser) CreateNewDraftHolder(se.inera.intyg.common.support.modules.support.api.dto.CreateNewDraftHolder)

Aggregations

CreateNewDraftHolder (se.inera.intyg.common.support.modules.support.api.dto.CreateNewDraftHolder)1 Utkast (se.inera.intyg.webcert.persistence.utkast.model.Utkast)1 LogUser (se.inera.intyg.webcert.web.service.log.dto.LogUser)1