From 7b582be33325f1df373bcfa92ed6500ef01d3a4c Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Thu, 27 Apr 2023 11:15:01 +0200 Subject: [PATCH] Refactored due to is-model constant name change --- .../instances/base/ElementManagement.java | 6 +++--- .../resourceregistry/types/TypeManagement.java | 12 ++++++------ .../types/SchemaManagementImplTest.java | 4 ++-- .../resourceregistry/types/TypesCacheTest.java | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/instances/base/ElementManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/instances/base/ElementManagement.java index df94015..b958dcc 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/instances/base/ElementManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/instances/base/ElementManagement.java @@ -1237,7 +1237,7 @@ public abstract class ElementManagement { /* protected List getSuperclasses() throws SchemaException, ResourceRegistryException { - List superClasses = new ArrayList<>(); + List typeSuperTypes = new ArrayList<>(); List allSuperClasses = getOClass().getSuperClasses(); while(allSuperClasses.size()>0) { List toBeAnalysed = new ArrayList<>(allSuperClasses); @@ -1251,11 +1251,11 @@ public abstract class ElementManagement { if(superClassesToBeExcluded.contains(name)) { continue; } - superClasses.add(superClasses.size(), name); + typeSuperTypes.add(typeSuperTypes.size(), name); allSuperClasses.addAll(oSuperClass.getSuperClasses()); } } - return superClasses; + return typeSuperTypes; } */ diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/types/TypeManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/types/TypeManagement.java index 7311a56..8292883 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/types/TypeManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/types/TypeManagement.java @@ -227,7 +227,7 @@ public class TypeManagement { protected List getSuperclassesAndCheckCompliancy(ODatabaseDocument oDatabaseDocument, Type type, String baseType) throws SchemaException, SchemaNotFoundException { - Set superClasses = type.getSuperClasses(); + Set superClasses = type.getTypeSuperTypes(); if(baseType != null) { if(superClasses == null || superClasses.size() == 0) { throw new RuntimeException( @@ -442,8 +442,8 @@ public class TypeManagement { private boolean superClassesMatch(Type actualTypeDefinition, Type newTypeDefinition) { // Checking superclasses. Must be the same. If differs the operation will be aborted. - Set actualSuperClasses = new HashSet<>(actualTypeDefinition.getSuperClasses()); - Set newSuperClasses = new HashSet<>(newTypeDefinition.getSuperClasses()); + Set actualSuperClasses = new HashSet<>(actualTypeDefinition.getTypeSuperTypes()); + Set newSuperClasses = new HashSet<>(newTypeDefinition.getTypeSuperTypes()); if(actualSuperClasses.size()!=newSuperClasses.size()) { return false; @@ -454,7 +454,7 @@ public class TypeManagement { return false; } - actualSuperClasses = new HashSet<>(actualTypeDefinition.getSuperClasses()); + actualSuperClasses = new HashSet<>(actualTypeDefinition.getTypeSuperTypes()); newSuperClasses.removeAll(actualSuperClasses); if(newSuperClasses.size()>0) { return false; @@ -484,9 +484,9 @@ public class TypeManagement { if(!superClassesMatch(actualTypeDefinition, newTypeDefinition)){ StringBuffer error = new StringBuffer(); error.append("The new type definition has a different set of superclasses. Actual version superclasses are: "); - error.append(actualTypeDefinition.getSuperClasses()); + error.append(actualTypeDefinition.getTypeSuperTypes()); error.append(". New version superclasses are: "); - error.append(newTypeDefinition.getSuperClasses()); + error.append(newTypeDefinition.getTypeSuperTypes()); error.append(". This kind update is not supported for a type."); throw new SchemaException(error.toString()); } diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/types/SchemaManagementImplTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/types/SchemaManagementImplTest.java index dc50767..9d6f65a 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/types/SchemaManagementImplTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/types/SchemaManagementImplTest.java @@ -284,8 +284,8 @@ public class SchemaManagementImplTest extends ContextTest { Assert.assertTrue(type.getDescription().compareTo(typeManaged.getDescription())==0); Assert.assertTrue(type.isAbstract() == typeManaged.isAbstract()); - Assert.assertTrue(type.getSuperClasses().containsAll(typeManaged.getSuperClasses())); - Assert.assertTrue(typeManaged.getSuperClasses().containsAll(type.getSuperClasses())); + Assert.assertTrue(type.getTypeSuperTypes().containsAll(typeManaged.getTypeSuperTypes())); + Assert.assertTrue(typeManaged.getTypeSuperTypes().containsAll(type.getTypeSuperTypes())); Map typeChangelog = type.getChangelog(); diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/types/TypesCacheTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/types/TypesCacheTest.java index facc5d2..419e260 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/types/TypesCacheTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/types/TypesCacheTest.java @@ -32,7 +32,7 @@ public class TypesCacheTest { CachedType cachedType = getCachedType(typesCache, typeName); List superTypes = cachedType.getSuperTypes(); - logger.debug("{} superTypes are {}", typeName, superTypes); + logger.debug("{} typeSuperTypes are {}", typeName, superTypes); for(String superType : superTypes) { getCachedType(typesCache, superType); }