From eac6bccb5f96edbc2452c685996c78fb66c910e2 Mon Sep 17 00:00:00 2001 From: anhefti Date: Wed, 28 Feb 2024 09:36:25 +0100 Subject: [PATCH] SEBSERV-408 fixed cache issue --- .../sebserver/gui/content/exam/ExamFormConfigs.java | 10 +++++----- .../sebserver/webservice/servicelayer/dao/ExamDAO.java | 4 +++- .../session/impl/ExamSessionServiceImpl.java | 2 -- .../api/ExamConfigurationMappingController.java | 10 ++++++++++ src/main/resources/messages.properties | 2 +- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamFormConfigs.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamFormConfigs.java index 51a62228..d881a20b 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamFormConfigs.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamFormConfigs.java @@ -163,6 +163,11 @@ public class ExamFormConfigs implements TemplateComposer { .noEventPropagation() .publishIf(() -> examConfigEnabled && editable && !configurationTable.hasAnyContent()) + .newAction(ActionDefinition.EXAM_CONFIGURATION_EXAM_CONFIG_VIEW_PROP) + .withParentEntityKey(entityKey) + .withEntityKey(configKey) + .publishIf(() -> examConfigEnabled && readGrant && configurationTable.hasAnyContent(), false) + .newAction(ActionDefinition.EXAM_CONFIGURATION_MODIFY_FROM_LIST) .withParentEntityKey(entityKey) .withSelect( @@ -172,11 +177,6 @@ public class ExamFormConfigs implements TemplateComposer { .noEventPropagation() .publishIf(() -> examConfigEnabled && editable && configurationTable.hasAnyContent(), false) - .newAction(ActionDefinition.EXAM_CONFIGURATION_EXAM_CONFIG_VIEW_PROP) - .withParentEntityKey(entityKey) - .withEntityKey(configKey) - .publishIf(() -> examConfigEnabled && readGrant && configurationTable.hasAnyContent(), false) - .newAction(ActionDefinition.EXAM_CONFIGURATION_DELETE_FROM_LIST) .withEntityKey(entityKey) .withSelect( diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/ExamDAO.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/ExamDAO.java index a1767302..e90f30ee 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/ExamDAO.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/ExamDAO.java @@ -216,7 +216,9 @@ public interface ExamDAO extends ActivatableEntityDAO, BulkActionSup * * @param examId the Exam identifier */ @CacheEvict( - cacheNames = ExamSessionCacheService.CACHE_NAME_RUNNING_EXAM, + cacheNames = { + ExamSessionCacheService.CACHE_NAME_RUNNING_EXAM, + ExamSessionCacheService.CACHE_NAME_SEB_CONFIG_EXAM }, key = "#examId") void markUpdate(Long examId); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java index bae50e67..5062f00c 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java @@ -10,11 +10,9 @@ package ch.ethz.seb.sebserver.webservice.servicelayer.session.impl; import java.io.IOException; import java.io.OutputStream; -import java.security.Principal; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.EnumSet; import java.util.HashMap; import java.util.HashSet; import java.util.List; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamConfigurationMappingController.java b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamConfigurationMappingController.java index ee530be4..a70af33c 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamConfigurationMappingController.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamConfigurationMappingController.java @@ -13,6 +13,8 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; import org.mybatis.dynamic.sql.SqlTable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.http.MediaType; import org.springframework.util.MultiValueMap; import org.springframework.validation.FieldError; @@ -57,6 +59,8 @@ import ch.ethz.seb.sebserver.webservice.servicelayer.validation.BeanValidationSe @RequestMapping("${sebserver.webservice.api.admin.endpoint}" + API.EXAM_CONFIGURATION_MAP_ENDPOINT) public class ExamConfigurationMappingController extends EntityController { + private static final Logger log = LoggerFactory.getLogger(ExamConfigurationMappingController.class); + private final ExamDAO examDao; private final ConfigurationNodeDAO configurationNodeDAO; private final ExamConfigUpdateService examConfigUpdateService; @@ -139,6 +143,12 @@ public class ExamConfigurationMappingController extends EntityController notifySaved(final ExamConfigurationMap entity) { + examDao.markUpdate(entity.examId); + return super.notifySaved(entity); + } + @Override @RequestMapping( method = RequestMethod.POST, diff --git a/src/main/resources/messages.properties b/src/main/resources/messages.properties index 0e725a13..af355f71 100644 --- a/src/main/resources/messages.properties +++ b/src/main/resources/messages.properties @@ -679,7 +679,7 @@ sebserver.exam.configuration.list.pleaseSelect=At first please select an exam co sebserver.exam.configuration.action.noconfig.message=There is currently no exam configuration to select.
Please create one in Exam Configurations sebserver.exam.configuration.action.list.new=Add Exam Configuration -sebserver.exam.configuration.action.list.modify=Edit Exam Configuration +sebserver.exam.configuration.action.list.modify=Edit Encryption Password sebserver.exam.configuration.action.list.view=View Exam Configuration sebserver.exam.configuration.action.list.delete=Remove Exam Configuration sebserver.exam.configuration.action.save=Save Exam Configuration