Refactored due to is-model constant name change
This commit is contained in:
parent
0724020bd2
commit
7b582be333
|
@ -1237,7 +1237,7 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
protected List<String> getSuperclasses() throws SchemaException, ResourceRegistryException {
|
protected List<String> getSuperclasses() throws SchemaException, ResourceRegistryException {
|
||||||
List<String> superClasses = new ArrayList<>();
|
List<String> typeSuperTypes = new ArrayList<>();
|
||||||
List<OClass> allSuperClasses = getOClass().getSuperClasses();
|
List<OClass> allSuperClasses = getOClass().getSuperClasses();
|
||||||
while(allSuperClasses.size()>0) {
|
while(allSuperClasses.size()>0) {
|
||||||
List<OClass> toBeAnalysed = new ArrayList<>(allSuperClasses);
|
List<OClass> toBeAnalysed = new ArrayList<>(allSuperClasses);
|
||||||
|
@ -1251,11 +1251,11 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
|
||||||
if(superClassesToBeExcluded.contains(name)) {
|
if(superClassesToBeExcluded.contains(name)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
superClasses.add(superClasses.size(), name);
|
typeSuperTypes.add(typeSuperTypes.size(), name);
|
||||||
allSuperClasses.addAll(oSuperClass.getSuperClasses());
|
allSuperClasses.addAll(oSuperClass.getSuperClasses());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return superClasses;
|
return typeSuperTypes;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -227,7 +227,7 @@ public class TypeManagement {
|
||||||
protected List<OClass> getSuperclassesAndCheckCompliancy(ODatabaseDocument oDatabaseDocument,
|
protected List<OClass> getSuperclassesAndCheckCompliancy(ODatabaseDocument oDatabaseDocument,
|
||||||
Type type, String baseType) throws SchemaException, SchemaNotFoundException {
|
Type type, String baseType) throws SchemaException, SchemaNotFoundException {
|
||||||
|
|
||||||
Set<String> superClasses = type.getSuperClasses();
|
Set<String> superClasses = type.getTypeSuperTypes();
|
||||||
if(baseType != null) {
|
if(baseType != null) {
|
||||||
if(superClasses == null || superClasses.size() == 0) {
|
if(superClasses == null || superClasses.size() == 0) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
|
@ -442,8 +442,8 @@ public class TypeManagement {
|
||||||
|
|
||||||
private boolean superClassesMatch(Type actualTypeDefinition, Type newTypeDefinition) {
|
private boolean superClassesMatch(Type actualTypeDefinition, Type newTypeDefinition) {
|
||||||
// Checking superclasses. Must be the same. If differs the operation will be aborted.
|
// Checking superclasses. Must be the same. If differs the operation will be aborted.
|
||||||
Set<String> actualSuperClasses = new HashSet<>(actualTypeDefinition.getSuperClasses());
|
Set<String> actualSuperClasses = new HashSet<>(actualTypeDefinition.getTypeSuperTypes());
|
||||||
Set<String> newSuperClasses = new HashSet<>(newTypeDefinition.getSuperClasses());
|
Set<String> newSuperClasses = new HashSet<>(newTypeDefinition.getTypeSuperTypes());
|
||||||
|
|
||||||
if(actualSuperClasses.size()!=newSuperClasses.size()) {
|
if(actualSuperClasses.size()!=newSuperClasses.size()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -454,7 +454,7 @@ public class TypeManagement {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
actualSuperClasses = new HashSet<>(actualTypeDefinition.getSuperClasses());
|
actualSuperClasses = new HashSet<>(actualTypeDefinition.getTypeSuperTypes());
|
||||||
newSuperClasses.removeAll(actualSuperClasses);
|
newSuperClasses.removeAll(actualSuperClasses);
|
||||||
if(newSuperClasses.size()>0) {
|
if(newSuperClasses.size()>0) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -484,9 +484,9 @@ public class TypeManagement {
|
||||||
if(!superClassesMatch(actualTypeDefinition, newTypeDefinition)){
|
if(!superClassesMatch(actualTypeDefinition, newTypeDefinition)){
|
||||||
StringBuffer error = new StringBuffer();
|
StringBuffer error = new StringBuffer();
|
||||||
error.append("The new type definition has a different set of superclasses. Actual version superclasses are: ");
|
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(". New version superclasses are: ");
|
||||||
error.append(newTypeDefinition.getSuperClasses());
|
error.append(newTypeDefinition.getTypeSuperTypes());
|
||||||
error.append(". This kind update is not supported for a type.");
|
error.append(". This kind update is not supported for a type.");
|
||||||
throw new SchemaException(error.toString());
|
throw new SchemaException(error.toString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,8 +284,8 @@ public class SchemaManagementImplTest extends ContextTest {
|
||||||
Assert.assertTrue(type.getDescription().compareTo(typeManaged.getDescription())==0);
|
Assert.assertTrue(type.getDescription().compareTo(typeManaged.getDescription())==0);
|
||||||
Assert.assertTrue(type.isAbstract() == typeManaged.isAbstract());
|
Assert.assertTrue(type.isAbstract() == typeManaged.isAbstract());
|
||||||
|
|
||||||
Assert.assertTrue(type.getSuperClasses().containsAll(typeManaged.getSuperClasses()));
|
Assert.assertTrue(type.getTypeSuperTypes().containsAll(typeManaged.getTypeSuperTypes()));
|
||||||
Assert.assertTrue(typeManaged.getSuperClasses().containsAll(type.getSuperClasses()));
|
Assert.assertTrue(typeManaged.getTypeSuperTypes().containsAll(type.getTypeSuperTypes()));
|
||||||
|
|
||||||
|
|
||||||
Map<Version, String> typeChangelog = type.getChangelog();
|
Map<Version, String> typeChangelog = type.getChangelog();
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class TypesCacheTest {
|
||||||
CachedType<?> cachedType = getCachedType(typesCache, typeName);
|
CachedType<?> cachedType = getCachedType(typesCache, typeName);
|
||||||
|
|
||||||
List<String> superTypes = cachedType.getSuperTypes();
|
List<String> superTypes = cachedType.getSuperTypes();
|
||||||
logger.debug("{} superTypes are {}", typeName, superTypes);
|
logger.debug("{} typeSuperTypes are {}", typeName, superTypes);
|
||||||
for(String superType : superTypes) {
|
for(String superType : superTypes) {
|
||||||
getCachedType(typesCache, superType);
|
getCachedType(typesCache, superType);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue