diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagement.java index 975a131..b49a3b6 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagement.java @@ -165,10 +165,17 @@ public abstract class ERManagement { } public void setElementType(String erType) throws ResourceRegistryException { - this.elementType = erType; - if(erType == null || erType.compareTo("") == 0) { - erType = accessType.getName(); + if(this.elementType==null) { + if(erType == null || erType.compareTo("") == 0) { + erType = accessType.getName(); + } + this.elementType = erType; + }else { + if(elementType.compareTo(erType)!=0) { + throw new ResourceRegistryException("Provided type " + erType + " does not match with the one already known " + this.accessType); + } } + if(jsonNode != null) { checkERMatch(); }