fixed deletion

This commit is contained in:
anhefti 2021-03-09 14:29:24 +01:00
parent b4edfb4ab9
commit 736a686e2a
3 changed files with 22 additions and 7 deletions

View file

@ -23,7 +23,7 @@ public class EntityDependency implements Comparable<EntityDependency> {
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;

View file

@ -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<EntityDependency> dependencies = restCallBuilder.call().getOrThrow();
final List<EntityDependency> list = dependencies.stream().sorted().collect(Collectors.toList());
final Set<EntityDependency> dependencies = restCallBuilder
.call()
.getOrThrow();
final List<EntityDependency> list = dependencies
.stream()
.sorted()
.collect(Collectors.toList());
this.pageService.<EntityDependency> staticListTableBuilder(list, null)
.withEmptyMessage(FORM_REPORT_NONE)
.withColumn(new ColumnDefinition<>(

View file

@ -553,7 +553,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()));
}
@ -573,7 +573,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()));
}
@ -593,7 +593,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()));
}
@ -609,9 +609,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();
}
}