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 2e5cbb4e..fd6d1391 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 @@ -12,6 +12,7 @@ import java.util.Collection; import org.springframework.cache.annotation.CacheEvict; +import ch.ethz.seb.sebserver.gbl.model.GrantEntity; import ch.ethz.seb.sebserver.gbl.model.exam.Exam; import ch.ethz.seb.sebserver.gbl.model.exam.Exam.ExamStatus; import ch.ethz.seb.sebserver.gbl.util.Result; @@ -21,6 +22,13 @@ import ch.ethz.seb.sebserver.webservice.servicelayer.session.impl.ExamSessionCac /** Concrete EntityDAO interface of Exam entities */ public interface ExamDAO extends ActivatableEntityDAO, BulkActionSupportDAO { + /** Get a GrantEntity for the exam of specified id (PK) + * This is actually a Exam instance but with no course data loaded. + * + * @param id The id of the exam (PK) + * @return Result referring to the GrantEntity of the exam or to an error when happened */ + Result examGrantEntityByPK(final Long id); + /** Get all active Exams for a given institution. * * @param institutionId the identifier of the institution diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java index baa5308a..1a433549 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java @@ -33,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional; import ch.ethz.seb.sebserver.gbl.Constants; import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.model.EntityKey; +import ch.ethz.seb.sebserver.gbl.model.GrantEntity; import ch.ethz.seb.sebserver.gbl.model.exam.Exam; import ch.ethz.seb.sebserver.gbl.model.exam.Exam.ExamStatus; import ch.ethz.seb.sebserver.gbl.model.exam.Exam.ExamType; @@ -82,6 +83,13 @@ public class ExamDAOImpl implements ExamDAO { .flatMap(this::toDomainModel); } + @Override + @Transactional(readOnly = true) + public Result examGrantEntityByPK(final Long id) { + return recordById(id) + .map(record -> toDomainModel(record, null).getOrThrow()); + } + @Override @Transactional(readOnly = true) public Result byClientConnection(final Long connectionId) { 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 f153c6d3..b89a2e32 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 @@ -108,7 +108,7 @@ public class ExamConfigurationMappingController extends EntityController