diff --git a/manage-server/src/main/java/manage/conf/MetaDataAutoConfiguration.java b/manage-server/src/main/java/manage/conf/MetaDataAutoConfiguration.java index 8c68a008..b0fbee21 100644 --- a/manage-server/src/main/java/manage/conf/MetaDataAutoConfiguration.java +++ b/manage-server/src/main/java/manage/conf/MetaDataAutoConfiguration.java @@ -130,6 +130,11 @@ public Schema schema(String type) { return this.schemas.get(type); } + public Schema anySchema() { + return this.schemas.getOrDefault(EntityType.SP.getType(), + this.schemas.values().stream().findAny().orElseThrow(IllegalAccessError::new)); + } + public ObjectMapper getObjectMapper() { return objectMapper; } diff --git a/manage-server/src/main/java/manage/hook/EmptyRevisionHook.java b/manage-server/src/main/java/manage/hook/EmptyRevisionHook.java index 142a9130..06084d58 100644 --- a/manage-server/src/main/java/manage/hook/EmptyRevisionHook.java +++ b/manage-server/src/main/java/manage/hook/EmptyRevisionHook.java @@ -28,7 +28,7 @@ public MetaData prePut(MetaData previous, MetaData newMetaData, AbstractUser use boolean eq = mapEquality(previousData, newData) && mapEquality(newData, previousData); if (eq) { //we need a schema, does not matter for which entityType - Schema schema = metaDataAutoConfiguration.schema(EntityType.RP.getType()); + Schema schema = metaDataAutoConfiguration.anySchema(); throw new ValidationException(schema, "No data is changed. An update would result in an empty revision", "empty-revision"); } return super.prePut(previous, newMetaData, user);