Search in sources :

Example 1 with DataAccessConfig

use of org.obiba.mica.micaConfig.domain.DataAccessConfig in project mica2 by obiba.

the class DataAccessConfigService method save.

public void save(@NotNull @Valid DataAccessConfig config) {
    DataAccessConfig savedConfig = getOrCreateConfig();
    BeanUtils.copyProperties(config, savedConfig, "id", "version", "createdBy", "createdDate", "lastModifiedBy", "lastModifiedDate");
    dataAccessConfigRepository.save(savedConfig);
    eventBus.post(new DataAccessConfigUpdatedEvent(savedConfig));
}
Also used : DataAccessConfig(org.obiba.mica.micaConfig.domain.DataAccessConfig) DataAccessConfigUpdatedEvent(org.obiba.mica.micaConfig.event.DataAccessConfigUpdatedEvent)

Example 2 with DataAccessConfig

use of org.obiba.mica.micaConfig.domain.DataAccessConfig in project mica2 by obiba.

the class DataAccessEntityService method sendSubmittedNotificationEmail.

protected void sendSubmittedNotificationEmail(T request) {
    DataAccessConfig dataAccessConfig = dataAccessConfigService.getOrCreateConfig();
    if (dataAccessConfig.isNotifySubmitted()) {
        Map<String, String> ctx = getNotificationEmailContext(request);
        String prefix = getTemplatePrefix(ctx);
        mailService.sendEmailToUsers(mailService.getSubject(dataAccessConfig.getSubmittedSubject(), ctx, DataAccessRequestUtilService.DEFAULT_NOTIFICATION_SUBJECT), prefix + "SubmittedApplicantEmail", ctx, request.getApplicant());
        mailService.sendEmailToGroups(mailService.getSubject(dataAccessConfig.getSubmittedSubject(), ctx, DataAccessRequestUtilService.DEFAULT_NOTIFICATION_SUBJECT), prefix + "SubmittedDAOEmail", ctx, Roles.MICA_DAO);
    }
}
Also used : DataAccessConfig(org.obiba.mica.micaConfig.domain.DataAccessConfig)

Example 3 with DataAccessConfig

use of org.obiba.mica.micaConfig.domain.DataAccessConfig in project mica2 by obiba.

the class DataAccessEntityService method sendOpenedNotificationEmail.

protected void sendOpenedNotificationEmail(T request) {
    DataAccessConfig dataAccessConfig = dataAccessConfigService.getOrCreateConfig();
    if (dataAccessConfig.isNotifyReopened()) {
        Map<String, String> ctx = getNotificationEmailContext(request);
        String prefix = getTemplatePrefix(ctx);
        mailService.sendEmailToUsers(mailService.getSubject(dataAccessConfig.getReopenedSubject(), ctx, DataAccessRequestUtilService.DEFAULT_NOTIFICATION_SUBJECT), prefix + "ReopenedApplicantEmail", ctx, request.getApplicant());
    }
}
Also used : DataAccessConfig(org.obiba.mica.micaConfig.domain.DataAccessConfig)

Example 4 with DataAccessConfig

use of org.obiba.mica.micaConfig.domain.DataAccessConfig in project mica2 by obiba.

the class DataAccessRequestUtilService method addNextSubmittedStatus.

private void addNextSubmittedStatus(List<DataAccessEntityStatus> to) {
    to.add(DataAccessEntityStatus.OPENED);
    DataAccessConfig dataAccessConfig = dataAccessConfigService.getOrCreateConfig();
    if (dataAccessConfig.isWithReview()) {
        to.add(DataAccessEntityStatus.REVIEWED);
    } else {
        to.add(DataAccessEntityStatus.APPROVED);
        to.add(DataAccessEntityStatus.REJECTED);
        if (dataAccessConfig.isWithConditionalApproval())
            to.add(DataAccessEntityStatus.CONDITIONALLY_APPROVED);
    }
}
Also used : DataAccessConfig(org.obiba.mica.micaConfig.domain.DataAccessConfig)

Example 5 with DataAccessConfig

use of org.obiba.mica.micaConfig.domain.DataAccessConfig in project mica2 by obiba.

the class DataAccessRequestUtilService method addNextReviewedStatus.

private void addNextReviewedStatus(List<DataAccessEntityStatus> to) {
    to.add(DataAccessEntityStatus.APPROVED);
    to.add(DataAccessEntityStatus.REJECTED);
    DataAccessConfig dataAccessConfig = dataAccessConfigService.getOrCreateConfig();
    if (dataAccessConfig.isWithConditionalApproval())
        to.add(DataAccessEntityStatus.CONDITIONALLY_APPROVED);
    else
        to.add(DataAccessEntityStatus.OPENED);
}
Also used : DataAccessConfig(org.obiba.mica.micaConfig.domain.DataAccessConfig)

Aggregations

DataAccessConfig (org.obiba.mica.micaConfig.domain.DataAccessConfig)15 DataAccessRequest (org.obiba.mica.access.domain.DataAccessRequest)3 List (java.util.List)2 Timed (com.codahale.metrics.annotation.Timed)1 LocalDate (java.time.LocalDate)1 Date (java.util.Date)1 Map (java.util.Map)1 ByteArrayOutputStream (org.apache.commons.io.output.ByteArrayOutputStream)1 DateTime (org.joda.time.DateTime)1 DataAccessRequestGenerationException (org.obiba.mica.access.DataAccessRequestGenerationException)1 DataAccessRequestTimeline (org.obiba.mica.access.domain.DataAccessRequestTimeline)1 IdentifierGenerator (org.obiba.mica.core.support.IdentifierGenerator)1 DataAccessConfigUpdatedEvent (org.obiba.mica.micaConfig.event.DataAccessConfigUpdatedEvent)1 SubjectAcl (org.obiba.mica.security.domain.SubjectAcl)1 Async (org.springframework.scheduling.annotation.Async)1 Scheduled (org.springframework.scheduling.annotation.Scheduled)1