diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/EntityDependency.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/EntityDependency.java index 8f727e89..1103a9d7 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/EntityDependency.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/EntityDependency.java @@ -23,7 +23,7 @@ public class EntityDependency implements Comparable { public final EntityKey parent; @JsonProperty(value = ATTR_SELF, required = true) public final EntityKey self; - @JsonProperty(value = ATTR_NAME, required = true) + @JsonProperty(value = ATTR_NAME) public final String name; @JsonProperty(ATTR_DESCRIPTION) public final String description; diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamDeletePopup.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamDeletePopup.java index 49b3341f..a8b37306 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamDeletePopup.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamDeletePopup.java @@ -186,8 +186,14 @@ public class ExamDeletePopup { .withURIVariable(API.PARAM_MODEL_ID, entityKey.modelId) .withQueryParam(API.PARAM_BULK_ACTION_TYPE, BulkActionType.HARD_DELETE.name()); - final Set dependencies = restCallBuilder.call().getOrThrow(); - final List list = dependencies.stream().sorted().collect(Collectors.toList()); + final Set dependencies = restCallBuilder + .call() + .getOrThrow(); + final List list = dependencies + .stream() + .sorted() + .collect(Collectors.toList()); + this.pageService. staticListTableBuilder(list, null) .withEmptyMessage(FORM_REPORT_NONE) .withColumn(new ColumnDefinition<>( diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/SEBClientEvents.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/SEBClientEvents.java index a3b1f244..e3aa051c 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/SEBClientEvents.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/SEBClientEvents.java @@ -224,9 +224,14 @@ public class SEBClientEvents implements TemplateComposer { .publishIf(() -> writeGrant, table.hasAnyContent()); } - private PageAction getOpenDelete(final PageAction pageAction, final MultiValueMap filterCriteria) { + private PageAction getOpenDelete( + final PageAction pageAction, + final MultiValueMap filterCriteria) { + try { - final List ids = this.restService.getBuilder(GetClientEventNames.class) + + final List ids = this.restService + .getBuilder(GetClientEventNames.class) .withQueryParams(filterCriteria) .call() .getOrThrow() @@ -234,9 +239,10 @@ public class SEBClientEvents implements TemplateComposer { .map(EntityName::getModelId) .collect(Collectors.toList()); - final PageAction deleteAction = pageAction.withAttribute( - PageContext.AttributeKeys.ENTITY_ID_LIST, - StringUtils.join(ids, Constants.COMMA)) + final PageAction deleteAction = pageAction + .withAttribute( + PageContext.AttributeKeys.ENTITY_ID_LIST, + StringUtils.join(ids, Constants.COMMA)) .withAttribute( PageContext.AttributeKeys.ENTITY_LIST_TYPE, EntityType.CLIENT_EVENT.name()); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientConnectionDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientConnectionDAOImpl.java index 24eb98f6..6587a2d4 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientConnectionDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientConnectionDAOImpl.java @@ -600,7 +600,7 @@ public class ClientConnectionDAOImpl implements ClientConnectionDAO { .map(rec -> new EntityDependency( institutionKey, new EntityKey(rec.getId(), EntityType.CLIENT_CONNECTION), - rec.getExamUserSessionId(), + getDependencyName(rec), rec.getClientAddress())) .collect(Collectors.toList())); } @@ -620,7 +620,7 @@ public class ClientConnectionDAOImpl implements ClientConnectionDAO { .map(rec -> new EntityDependency( lmsSetupKey, new EntityKey(rec.getId(), EntityType.CLIENT_CONNECTION), - rec.getExamUserSessionId(), + getDependencyName(rec), rec.getClientAddress())) .collect(Collectors.toList())); } @@ -640,7 +640,7 @@ public class ClientConnectionDAOImpl implements ClientConnectionDAO { .map(rec -> new EntityDependency( userKey, new EntityKey(rec.getId(), EntityType.CLIENT_CONNECTION), - rec.getExamUserSessionId(), + getDependencyName(rec), rec.getClientAddress())) .collect(Collectors.toList())); } @@ -656,9 +656,18 @@ public class ClientConnectionDAOImpl implements ClientConnectionDAO { .map(rec -> new EntityDependency( examKey, new EntityKey(rec.getId(), EntityType.CLIENT_CONNECTION), - rec.getExamUserSessionId(), + getDependencyName(rec), rec.getClientAddress())) .collect(Collectors.toList())); } + private String getDependencyName(final ClientConnectionRecord record) { + final String examUserSessionId = record.getExamUserSessionId(); + if (StringUtils.isNotBlank(examUserSessionId)) { + return examUserSessionId; + } + + return record.getConnectionToken(); + } + } diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientEventDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientEventDAOImpl.java index 7b850519..12c747ed 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientEventDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientEventDAOImpl.java @@ -92,6 +92,9 @@ public class ClientEventDAOImpl implements ClientEventDAO { .and( ClientConnectionRecordDynamicSqlSupport.examId, isEqualToWhenPresent(filterMap.getClientEventExamId())) + .and( + ClientConnectionRecordDynamicSqlSupport.examUserSessionId, + SqlBuilder.isLikeWhenPresent(filterMap.getSQLWildcard(ClientConnection.FILTER_ATTR_SESSION_ID))) .and( ClientEventRecordDynamicSqlSupport.clientConnectionId, isEqualToWhenPresent(filterMap.getClientEventConnectionId()))