Merge remote-tracking branch 'origin/patch-1.0.2' into development
This commit is contained in:
commit
87be4f4696
3 changed files with 17 additions and 1 deletions
|
@ -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<Exam, Exam>, BulkActionSupportDAO<Exam> {
|
||||
|
||||
/** 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<GrantEntity> examGrantEntityByPK(final Long id);
|
||||
|
||||
/** Get all active Exams for a given institution.
|
||||
*
|
||||
* @param institutionId the identifier of the institution
|
||||
|
|
|
@ -35,6 +35,7 @@ import ch.ethz.seb.sebserver.gbl.Constants;
|
|||
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||
import ch.ethz.seb.sebserver.gbl.model.EntityDependency;
|
||||
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;
|
||||
|
@ -84,6 +85,13 @@ public class ExamDAOImpl implements ExamDAO {
|
|||
.flatMap(this::toDomainModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public Result<GrantEntity> examGrantEntityByPK(final Long id) {
|
||||
return recordById(id)
|
||||
.map(record -> toDomainModel(record, null).getOrThrow());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public Result<Exam> byClientConnection(final Long connectionId) {
|
||||
|
|
|
@ -110,7 +110,7 @@ public class ExamConfigurationMappingController extends EntityController<ExamCon
|
|||
}
|
||||
|
||||
return this.examDao
|
||||
.byPK(entity.examId)
|
||||
.examGrantEntityByPK(entity.examId)
|
||||
.getOrThrow();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue