renamed variable

This commit is contained in:
Luca Frosini 2021-02-18 09:42:51 +01:00
parent dbbdd206d5
commit ad1637ab14
12 changed files with 106 additions and 105 deletions

View File

@ -55,7 +55,7 @@ public class ContextManagement extends EntityElementManagement<Context> {
private void init() { private void init() {
this.ignoreStartWithKeys.add(Context.PARENT_PROPERTY); this.ignoreStartWithKeys.add(Context.PARENT_PROPERTY);
this.ignoreStartWithKeys.add(Context.CHILDREN_PROPERTY); this.ignoreStartWithKeys.add(Context.CHILDREN_PROPERTY);
this.elementType = Context.NAME; this.typeName = Context.NAME;
} }
protected ContextCacheRenewal contextCacheRenewal = new ContextCacheRenewal() { protected ContextCacheRenewal contextCacheRenewal = new ContextCacheRenewal() {
@ -400,7 +400,7 @@ public class ContextManagement extends EntityElementManagement<Context> {
public String reallyGetAll(boolean polymorphic) throws ResourceRegistryException { public String reallyGetAll(boolean polymorphic) throws ResourceRegistryException {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
ArrayNode arrayNode = objectMapper.createArrayNode(); ArrayNode arrayNode = objectMapper.createArrayNode();
Iterable<ODocument> iterable = oDatabaseDocument.browseClass(elementType, polymorphic); Iterable<ODocument> iterable = oDatabaseDocument.browseClass(typeName, polymorphic);
for(ODocument vertex : iterable) { for(ODocument vertex : iterable) {
ContextManagement contextManagement = new ContextManagement(); ContextManagement contextManagement = new ContextManagement();
contextManagement.setElement((OVertex) vertex); contextManagement.setElement((OVertex) vertex);

View File

@ -88,7 +88,7 @@ public abstract class ElementManagement<El extends OElement> {
protected UUID uuid; protected UUID uuid;
protected JsonNode jsonNode; protected JsonNode jsonNode;
protected OClass oClass; protected OClass oClass;
protected String elementType; protected String typeName;
protected JsonNode self; protected JsonNode self;
protected JsonNode complete; protected JsonNode complete;
@ -183,11 +183,11 @@ public abstract class ElementManagement<El extends OElement> {
oClass = ElementManagementUtility.getOClass(element); oClass = ElementManagementUtility.getOClass(element);
} else { } else {
TypesCache typesCache = TypesCache.getInstance(); TypesCache typesCache = TypesCache.getInstance();
CachedType cachedType = typesCache.getType(elementType); CachedType cachedType = typesCache.getType(typeName);
oClass = cachedType.getOClass(); oClass = cachedType.getOClass();
AccessType gotAccessType = cachedType.getAccessType(); AccessType gotAccessType = cachedType.getAccessType();
if(accessType!=gotAccessType) { if(accessType!=gotAccessType) {
throw new SchemaException(elementType + " is not a " + accessType.getName()); throw new SchemaException(typeName + " is not a " + accessType.getName());
} }
} }
} }
@ -195,11 +195,11 @@ public abstract class ElementManagement<El extends OElement> {
} }
public void setElementType(String elementType) throws ResourceRegistryException { public void setElementType(String elementType) throws ResourceRegistryException {
if(this.elementType == null) { if(this.typeName == null) {
if(elementType == null || elementType.compareTo("") == 0) { if(elementType == null || elementType.compareTo("") == 0) {
elementType = accessType.getName(); elementType = accessType.getName();
} }
this.elementType = elementType; this.typeName = elementType;
} else { } else {
if(elementType.compareTo(elementType) != 0) { if(elementType.compareTo(elementType) != 0) {
throw new ResourceRegistryException( throw new ResourceRegistryException(
@ -213,7 +213,7 @@ public abstract class ElementManagement<El extends OElement> {
} }
public String getElementType() { public String getElementType() {
return elementType; return typeName;
} }
protected void checkJsonNode() throws ResourceRegistryException { protected void checkJsonNode() throws ResourceRegistryException {
@ -226,8 +226,8 @@ public abstract class ElementManagement<El extends OElement> {
checkUUIDMatch(); checkUUIDMatch();
} }
if(this.elementType == null) { if(this.typeName == null) {
this.elementType = getClassProperty(jsonNode); this.typeName = getClassProperty(jsonNode);
getOClass(); getOClass();
} else { } else {
checkERMatch(); checkERMatch();
@ -237,9 +237,9 @@ public abstract class ElementManagement<El extends OElement> {
protected void checkERMatch() throws ResourceRegistryException { protected void checkERMatch() throws ResourceRegistryException {
if(jsonNode != null) { if(jsonNode != null) {
String type = getClassProperty(jsonNode); String type = getClassProperty(jsonNode);
if(type != null && type.compareTo(elementType) != 0) { if(type != null && type.compareTo(typeName) != 0) {
String error = String.format("Requested type does not match with json representation %s!=%s", String error = String.format("Requested type does not match with json representation %s!=%s",
elementType, type); typeName, type);
logger.trace(error); logger.trace(error);
throw new ResourceRegistryException(error); throw new ResourceRegistryException(error);
} }
@ -260,7 +260,7 @@ public abstract class ElementManagement<El extends OElement> {
if(resourceUUID.compareTo(uuid) != 0) { if(resourceUUID.compareTo(uuid) != 0) {
String error = String.format( String error = String.format(
"UUID provided in header (%s) differs from the one (%s) used to identify the %s instance", "UUID provided in header (%s) differs from the one (%s) used to identify the %s instance",
resourceUUID.toString(), uuid.toString(), elementType); resourceUUID.toString(), uuid.toString(), typeName);
throw new ResourceRegistryException(error); throw new ResourceRegistryException(error);
} }
@ -345,7 +345,7 @@ public abstract class ElementManagement<El extends OElement> {
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {
throw e; throw e;
} catch(Exception e) { } catch(Exception e) {
throw new ResourceRegistryException("Error Creating " + elementType + " with " + jsonNode, e); throw new ResourceRegistryException("Error Creating " + typeName + " with " + jsonNode, e);
} }
} }
@ -363,7 +363,7 @@ public abstract class ElementManagement<El extends OElement> {
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {
throw e; throw e;
} catch(Exception e) { } catch(Exception e) {
throw new ResourceRegistryException("Error Updating " + elementType + " with " + jsonNode, e); throw new ResourceRegistryException("Error Updating " + typeName + " with " + jsonNode, e);
} }
} }
@ -389,7 +389,7 @@ public abstract class ElementManagement<El extends OElement> {
this.element = element; this.element = element;
this.uuid = HeaderUtility.getHeader(element).getUUID(); this.uuid = HeaderUtility.getHeader(element).getUUID();
OClass oClass = getOClass(); OClass oClass = getOClass();
this.elementType = oClass.getName(); this.typeName = oClass.getName();
} }
protected abstract NotFoundException getSpecificElementNotFoundException(NotFoundException e); protected abstract NotFoundException getSpecificElementNotFoundException(NotFoundException e);
@ -421,7 +421,7 @@ public abstract class ElementManagement<El extends OElement> {
if(uuid == null) { if(uuid == null) {
throw new NotFoundException("null UUID does not allow to retrieve the Element"); throw new NotFoundException("null UUID does not allow to retrieve the Element");
} }
return Utility.getElementByUUID(oDatabaseDocument, elementType == null ? accessType.getName() : elementType, uuid, return Utility.getElementByUUID(oDatabaseDocument, typeName == null ? accessType.getName() : typeName, uuid,
elementClass); elementClass);
} catch(NotFoundException e) { } catch(NotFoundException e) {
throw getSpecificElementNotFoundException(e); throw getSpecificElementNotFoundException(e);
@ -434,7 +434,7 @@ public abstract class ElementManagement<El extends OElement> {
public El retrieveElementFromAnyContext() throws NotFoundException, ResourceRegistryException { public El retrieveElementFromAnyContext() throws NotFoundException, ResourceRegistryException {
try { try {
return Utility.getElementByUUIDAsAdmin(elementType == null ? accessType.getName() : elementType, uuid, return Utility.getElementByUUIDAsAdmin(typeName == null ? accessType.getName() : typeName, uuid,
elementClass); elementClass);
} catch(NotFoundException e) { } catch(NotFoundException e) {
throw getSpecificElementNotFoundException(e); throw getSpecificElementNotFoundException(e);
@ -689,7 +689,7 @@ public abstract class ElementManagement<El extends OElement> {
public Set<String> getContextsSet() throws NotFoundException, ContextException, ResourceRegistryException { public Set<String> getContextsSet() throws NotFoundException, ContextException, ResourceRegistryException {
logger.debug("Going to get contexts for {} with UUID", elementType, uuid); logger.debug("Going to get contexts for {} with UUID", typeName, uuid);
ODatabaseDocument current = ContextUtility.getCurrentODatabaseDocumentFromThreadLocal(); ODatabaseDocument current = ContextUtility.getCurrentODatabaseDocumentFromThreadLocal();
try { try {
AdminSecurityContext adminSecurityContext = ContextUtility.getAdminSecurityContext(); AdminSecurityContext adminSecurityContext = ContextUtility.getAdminSecurityContext();
@ -698,10 +698,10 @@ public abstract class ElementManagement<El extends OElement> {
Set<String> contexts = SecurityContext.getContexts(getElement()); Set<String> contexts = SecurityContext.getContexts(getElement());
return contexts; return contexts;
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {
logger.error("Unable to get contexts for {} with UUID {}", elementType, uuid, e); logger.error("Unable to get contexts for {} with UUID {}", typeName, uuid, e);
throw e; throw e;
} catch(Exception e) { } catch(Exception e) {
logger.error("Unable to get contexts for {} with UUID {}", elementType, uuid, e); logger.error("Unable to get contexts for {} with UUID {}", typeName, uuid, e);
throw new ContextException(e); throw new ContextException(e);
} finally { } finally {
if(oDatabaseDocument != null) { if(oDatabaseDocument != null) {

View File

@ -111,24 +111,24 @@ public abstract class EntityElementManagement<E extends EntityElement> extends E
protected OVertex createVertex() throws EntityAlreadyPresentException, ResourceRegistryException { protected OVertex createVertex() throws EntityAlreadyPresentException, ResourceRegistryException {
logger.trace("Going to create {} for {} ({}) using {}", OVertex.class.getSimpleName(), accessType.getName(), logger.trace("Going to create {} for {} ({}) using {}", OVertex.class.getSimpleName(), accessType.getName(),
elementType, jsonNode); typeName, jsonNode);
try { try {
if(oClass.isAbstract()) { if(oClass.isAbstract()) {
String error = String.format( String error = String.format(
"Trying to create an instance of %s of type %s which is abstract. The operation will be aborted.", "Trying to create an instance of %s of type %s which is abstract. The operation will be aborted.",
accessType.getName(), elementType); accessType.getName(), typeName);
throw new ResourceRegistryException(error); throw new ResourceRegistryException(error);
} }
OVertex vertexEntity = oDatabaseDocument.newVertex(elementType); OVertex vertexEntity = oDatabaseDocument.newVertex(typeName);
try { try {
if(uuid != null) { if(uuid != null) {
OVertex v = getElement(); OVertex v = getElement();
if(v != null) { if(v != null) {
String error = String.format("A %s with UUID %s already exist", elementType, uuid.toString()); String error = String.format("A %s with UUID %s already exist", typeName, uuid.toString());
throw getSpecificERAlreadyPresentException(error); throw getSpecificERAlreadyPresentException(error);
} }
} }
@ -164,8 +164,8 @@ public abstract class EntityElementManagement<E extends EntityElement> extends E
throw e; throw e;
} catch(Exception e) { } catch(Exception e) {
logger.trace("Error while creating {} for {} ({}) using {}", OVertex.class.getSimpleName(), logger.trace("Error while creating {} for {} ({}) using {}", OVertex.class.getSimpleName(),
accessType.getName(), elementType, jsonNode, e); accessType.getName(), typeName, jsonNode, e);
throw new ResourceRegistryException("Error Creating " + elementType + " with " + jsonNode, e.getCause()); throw new ResourceRegistryException("Error Creating " + typeName + " with " + jsonNode, e.getCause());
} }
} }

View File

@ -136,7 +136,7 @@ public abstract class RelationElementManagement<SEM extends EntityElementManagem
if(!jsonNode.has(Relation.TARGET_PROPERTY)) { if(!jsonNode.has(Relation.TARGET_PROPERTY)) {
throw new ResourceRegistryException( throw new ResourceRegistryException(
"Error while creating " + elementType + ". No target definition found"); "Error while creating " + typeName + ". No target definition found");
} }
try { try {
@ -144,7 +144,7 @@ public abstract class RelationElementManagement<SEM extends EntityElementManagem
} catch(SchemaException e) { } catch(SchemaException e) {
StringBuilder errorMessage = new StringBuilder(); StringBuilder errorMessage = new StringBuilder();
errorMessage.append("A "); errorMessage.append("A ");
errorMessage.append(elementType); errorMessage.append(typeName);
errorMessage.append(" can be only created beetween "); errorMessage.append(" can be only created beetween ");
errorMessage.append(sourceEntityManagement.getAccessType().getName()); errorMessage.append(sourceEntityManagement.getAccessType().getName());
errorMessage.append(" and "); errorMessage.append(" and ");
@ -162,9 +162,9 @@ public abstract class RelationElementManagement<SEM extends EntityElementManagem
OVertex source = (OVertex) getSourceEntityManagement().getElement(); OVertex source = (OVertex) getSourceEntityManagement().getElement();
OVertex target = (OVertex) getTargetEntityManagement().getElement(); OVertex target = (OVertex) getTargetEntityManagement().getElement();
logger.trace("Going to create {} beetween {} -> {}", elementType, source.toString(), target.toString()); logger.trace("Going to create {} beetween {} -> {}", typeName, source.toString(), target.toString());
element = oDatabaseDocument.newEdge(source, target, elementType); element = oDatabaseDocument.newEdge(source, target, typeName);
updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys); updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
@ -178,7 +178,7 @@ public abstract class RelationElementManagement<SEM extends EntityElementManagem
@Override @Override
protected OEdge reallyUpdate() throws ResourceRegistryException { protected OEdge reallyUpdate() throws ResourceRegistryException {
logger.debug("Trying to update {} : {}", elementType, jsonNode); logger.debug("Trying to update {} : {}", typeName, jsonNode);
OEdge edge = getElement(); OEdge edge = getElement();
updateProperties(oClass, edge, jsonNode, ignoreKeys, ignoreStartWithKeys); updateProperties(oClass, edge, jsonNode, ignoreKeys, ignoreStartWithKeys);
@ -194,7 +194,7 @@ public abstract class RelationElementManagement<SEM extends EntityElementManagem
} }
} }
logger.info("{} {} successfully updated", elementType, jsonNode); logger.info("{} {} successfully updated", typeName, jsonNode);
return edge; return edge;

View File

@ -162,8 +162,8 @@ public abstract class EntityManagement<E extends Entity> extends EntityElementMa
} catch(NotFoundException e) { } catch(NotFoundException e) {
try { try {
retrieveElementFromAnyContext(); retrieveElementFromAnyContext();
throw getSpecificERAvailableInAnotherContextException(elementType == null ? accessType.getName() throw getSpecificERAvailableInAnotherContextException(typeName == null ? accessType.getName()
: elementType + " with UUID " + uuid + " is available in another " : typeName + " with UUID " + uuid + " is available in another "
+ Context.class.getSimpleName()); + Context.class.getSimpleName());
} catch(AvailableInAnotherContextException e1) { } catch(AvailableInAnotherContextException e1) {
throw e1; throw e1;
@ -232,24 +232,24 @@ public abstract class EntityManagement<E extends Entity> extends EntityElementMa
protected OVertex createVertex() throws EntityAlreadyPresentException, ResourceRegistryException { protected OVertex createVertex() throws EntityAlreadyPresentException, ResourceRegistryException {
logger.trace("Going to create {} for {} ({}) using {}", OVertex.class.getSimpleName(), accessType.getName(), logger.trace("Going to create {} for {} ({}) using {}", OVertex.class.getSimpleName(), accessType.getName(),
elementType, jsonNode); typeName, jsonNode);
try { try {
if(oClass.isAbstract()) { if(oClass.isAbstract()) {
String error = String.format( String error = String.format(
"Trying to create an instance of %s of type %s which is abstract. The operation will be aborted.", "Trying to create an instance of %s of type %s which is abstract. The operation will be aborted.",
accessType.getName(), elementType); accessType.getName(), typeName);
throw new ResourceRegistryException(error); throw new ResourceRegistryException(error);
} }
OVertex vertexEntity = oDatabaseDocument.newVertex(elementType); OVertex vertexEntity = oDatabaseDocument.newVertex(typeName);
try { try {
if(uuid != null) { if(uuid != null) {
OVertex v = getElement(); OVertex v = getElement();
if(v != null) { if(v != null) {
String error = String.format("A %s with UUID %s already exist", elementType, uuid.toString()); String error = String.format("A %s with UUID %s already exist", typeName, uuid.toString());
throw getSpecificERAlreadyPresentException(error); throw getSpecificERAlreadyPresentException(error);
} }
} }
@ -284,8 +284,8 @@ public abstract class EntityManagement<E extends Entity> extends EntityElementMa
throw e; throw e;
} catch(Exception e) { } catch(Exception e) {
logger.trace("Error while creating {} for {} ({}) using {}", OVertex.class.getSimpleName(), logger.trace("Error while creating {} for {} ({}) using {}", OVertex.class.getSimpleName(),
accessType.getName(), elementType, jsonNode, e); accessType.getName(), typeName, jsonNode, e);
throw new ResourceRegistryException("Error Creating " + elementType + " with " + jsonNode, e.getCause()); throw new ResourceRegistryException("Error Creating " + typeName + " with " + jsonNode, e.getCause());
} }
} }
@ -333,7 +333,7 @@ public abstract class EntityManagement<E extends Entity> extends EntityElementMa
throw e; throw e;
} catch(Exception e) { } catch(Exception e) {
throw new ResourceRegistryException( throw new ResourceRegistryException(
"Error Adding " + elementType + " to " + targetSecurityContext.toString(), e.getCause()); "Error Adding " + typeName + " to " + targetSecurityContext.toString(), e.getCause());
} }
} }
@ -349,17 +349,17 @@ public abstract class EntityManagement<E extends Entity> extends EntityElementMa
Map<UUID,JsonNode> affectedInstances = internalAddToContext(targetSecurityContext); Map<UUID,JsonNode> affectedInstances = internalAddToContext(targetSecurityContext);
oDatabaseDocument.commit(); oDatabaseDocument.commit();
logger.info("{} with UUID {} successfully added to Context with UUID {}", elementType, uuid, contextUUID); logger.info("{} with UUID {} successfully added to Context with UUID {}", typeName, uuid, contextUUID);
return affectedInstances; return affectedInstances;
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {
logger.error("Unable to add {} with UUID {} to Context with UUID {} - Reason is {}", elementType, uuid, contextUUID, e.getMessage()); logger.error("Unable to add {} with UUID {} to Context with UUID {} - Reason is {}", typeName, uuid, contextUUID, e.getMessage());
if(oDatabaseDocument != null) { if(oDatabaseDocument != null) {
oDatabaseDocument.rollback(); oDatabaseDocument.rollback();
} }
throw e; throw e;
} catch(Exception e) { } catch(Exception e) {
logger.error("Unable to add {} with UUID {} to Context with UUID {}", elementType, uuid, contextUUID, e); logger.error("Unable to add {} with UUID {} to Context with UUID {}", typeName, uuid, contextUUID, e);
if(oDatabaseDocument != null) { if(oDatabaseDocument != null) {
oDatabaseDocument.rollback(); oDatabaseDocument.rollback();
} }
@ -390,7 +390,7 @@ public abstract class EntityManagement<E extends Entity> extends EntityElementMa
throw e; throw e;
} catch(Exception e) { } catch(Exception e) {
throw new ResourceRegistryException( throw new ResourceRegistryException(
"Error Removing " + elementType + " from " + targetSecurityContext.toString(), e.getCause()); "Error Removing " + typeName + " from " + targetSecurityContext.toString(), e.getCause());
} }
} }
@ -425,7 +425,7 @@ public abstract class EntityManagement<E extends Entity> extends EntityElementMa
public Map<UUID,JsonNode> removeFromContext(UUID contextUUID) public Map<UUID,JsonNode> removeFromContext(UUID contextUUID)
throws SchemaViolationException, NotFoundException, ContextException, ResourceRegistryException { throws SchemaViolationException, NotFoundException, ContextException, ResourceRegistryException {
logger.debug("Going to remove {} with UUID {} from Context with UUID {}", elementType, uuid, contextUUID); logger.debug("Going to remove {} with UUID {} from Context with UUID {}", typeName, uuid, contextUUID);
ODatabaseDocument current = ContextUtility.getCurrentODatabaseDocumentFromThreadLocal(); ODatabaseDocument current = ContextUtility.getCurrentODatabaseDocumentFromThreadLocal();
try { try {
oDatabaseDocument = ContextUtility.getAdminSecurityContext().getDatabaseDocument(PermissionMode.WRITER); oDatabaseDocument = ContextUtility.getAdminSecurityContext().getDatabaseDocument(PermissionMode.WRITER);
@ -436,17 +436,17 @@ public abstract class EntityManagement<E extends Entity> extends EntityElementMa
Map<UUID,JsonNode> affectedInstances = internalRemoveFromContext(targetSecurityContext); Map<UUID,JsonNode> affectedInstances = internalRemoveFromContext(targetSecurityContext);
oDatabaseDocument.commit(); oDatabaseDocument.commit();
logger.info("{} with UUID {} successfully removed from Context with UUID {}", elementType, uuid, contextUUID); logger.info("{} with UUID {} successfully removed from Context with UUID {}", typeName, uuid, contextUUID);
return affectedInstances; return affectedInstances;
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {
logger.error("Unable to remove {} with UUID {} from Context with UUID {}", elementType, uuid, contextUUID); logger.error("Unable to remove {} with UUID {} from Context with UUID {}", typeName, uuid, contextUUID);
if(oDatabaseDocument != null) { if(oDatabaseDocument != null) {
oDatabaseDocument.rollback(); oDatabaseDocument.rollback();
} }
throw e; throw e;
} catch(Exception e) { } catch(Exception e) {
logger.error("Unable to remove {} with UUID {} from Context with UUID {}", elementType, uuid, contextUUID, logger.error("Unable to remove {} with UUID {} from Context with UUID {}", typeName, uuid, contextUUID,
e); e);
if(oDatabaseDocument != null) { if(oDatabaseDocument != null) {
oDatabaseDocument.rollback(); oDatabaseDocument.rollback();
@ -468,7 +468,7 @@ public abstract class EntityManagement<E extends Entity> extends EntityElementMa
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
ArrayNode arrayNode = objectMapper.createArrayNode(); ArrayNode arrayNode = objectMapper.createArrayNode();
Iterable<ODocument> iterable = oDatabaseDocument.browseClass(elementType, polymorphic); Iterable<ODocument> iterable = oDatabaseDocument.browseClass(typeName, polymorphic);
for(ODocument vertex : iterable) { for(ODocument vertex : iterable) {
EntityManagement<?> entityManagement = ElementManagementUtility.getEntityManagement(getWorkingContext(), EntityManagement<?> entityManagement = ElementManagementUtility.getEntityManagement(getWorkingContext(),
oDatabaseDocument, (OVertex) vertex); oDatabaseDocument, (OVertex) vertex);
@ -622,8 +622,8 @@ public abstract class EntityManagement<E extends Entity> extends EntityElementMa
* if the resulting type is a subclass of the requested type * if the resulting type is a subclass of the requested type
* *
*/ */
if(oClass.getName().compareTo(elementType)!=0) { if(oClass.getName().compareTo(typeName)!=0) {
if(polymorphic && oClass.isSubClassOf(elementType)) { if(polymorphic && oClass.isSubClassOf(typeName)) {
// OK // OK
} else { } else {
// excluding from results // excluding from results
@ -693,7 +693,7 @@ public abstract class EntityManagement<E extends Entity> extends EntityElementMa
selectStringBuilder.append("'), "); selectStringBuilder.append("'), ");
selectStringBuilder.append(direction.opposite().name().toLowerCase()); selectStringBuilder.append(direction.opposite().name().toLowerCase());
selectStringBuilder.append("V('"); selectStringBuilder.append("V('");
selectStringBuilder.append(elementType); selectStringBuilder.append(typeName);
selectStringBuilder.append("') FROM (SELECT FROM "); selectStringBuilder.append("') FROM (SELECT FROM ");
selectStringBuilder.append(referenceType); selectStringBuilder.append(referenceType);
boolean first = true; boolean first = true;
@ -715,7 +715,7 @@ public abstract class EntityManagement<E extends Entity> extends EntityElementMa
if(!polymorphic) { if(!polymorphic) {
selectStringBuilder.append(" WHERE @class='"); selectStringBuilder.append(" WHERE @class='");
selectStringBuilder.append(elementType); selectStringBuilder.append(typeName);
selectStringBuilder.append("'"); selectStringBuilder.append("'");
} }
@ -742,7 +742,7 @@ public abstract class EntityManagement<E extends Entity> extends EntityElementMa
throw new ResourceRegistryException(error); throw new ResourceRegistryException(error);
} }
if(oClass.isSubClassOf(elementType)) { if(oClass.isSubClassOf(typeName)) {
continue; continue;
} }
@ -804,7 +804,7 @@ public abstract class EntityManagement<E extends Entity> extends EntityElementMa
if(direction != ODirection.OUT) { if(direction != ODirection.OUT) {
String error = String.format("%s can only goes %s from %s.", relationType, String error = String.format("%s can only goes %s from %s.", relationType,
ODirection.OUT.name(), elementType); ODirection.OUT.name(), typeName);
throw new InvalidQueryException(error); throw new InvalidQueryException(error);
} else { } else {
if(referenceAccessType != AccessType.FACET) { if(referenceAccessType != AccessType.FACET) {
@ -820,7 +820,7 @@ public abstract class EntityManagement<E extends Entity> extends EntityElementMa
case FACET: case FACET:
if(relationAccessType != AccessType.CONSISTS_OF || direction != ODirection.IN if(relationAccessType != AccessType.CONSISTS_OF || direction != ODirection.IN
|| referenceAccessType != AccessType.RESOURCE) { || referenceAccessType != AccessType.RESOURCE) {
String error = String.format("%s can only has %s %s from a %s.", elementType, String error = String.format("%s can only has %s %s from a %s.", typeName,
ODirection.IN.name(), ConsistsOf.NAME, Resource.NAME); ODirection.IN.name(), ConsistsOf.NAME, Resource.NAME);
throw new InvalidQueryException(error); throw new InvalidQueryException(error);
} }

View File

@ -322,8 +322,9 @@ public class ResourceManagement extends EntityManagement<Resource> {
*/ */
read(); read();
ResourceTypeDefinitionManagement resourceTypeDefinitionManagement = new ResourceTypeDefinitionManagement(); ResourceTypeDefinitionManagement resourceTypeDefinitionManagement = new ResourceTypeDefinitionManagement();
resourceTypeDefinitionManagement.setName(elementType); resourceTypeDefinitionManagement.setName(typeName);
String stringType = resourceTypeDefinitionManagement.read().toString(); String stringType = resourceTypeDefinitionManagement.read().toString();
ResourceType resourceType = null; ResourceType resourceType = null;
try { try {
@ -382,7 +383,7 @@ public class ResourceManagement extends EntityManagement<Resource> {
stringBuffer.append("To avoid to have an incosistent graph, add to context no follows cannot add a "); stringBuffer.append("To avoid to have an incosistent graph, add to context no follows cannot add a ");
stringBuffer.append(Resource.NAME); stringBuffer.append(Resource.NAME);
stringBuffer.append(" (i.e. "); stringBuffer.append(" (i.e. ");
stringBuffer.append(elementType); stringBuffer.append(typeName);
stringBuffer.append(" with UUID "); stringBuffer.append(" with UUID ");
stringBuffer.append(uuid.toString()); stringBuffer.append(uuid.toString());
stringBuffer.append(") without adding at least a "); stringBuffer.append(") without adding at least a ");

View File

@ -145,8 +145,8 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
} catch(NotFoundException e) { } catch(NotFoundException e) {
try { try {
retrieveElementFromAnyContext(); retrieveElementFromAnyContext();
throw getSpecificERAvailableInAnotherContextException(elementType == null ? accessType.getName() throw getSpecificERAvailableInAnotherContextException(typeName == null ? accessType.getName()
: elementType + " with UUID " + uuid + " is available in another " : typeName + " with UUID " + uuid + " is available in another "
+ Context.class.getSimpleName()); + Context.class.getSimpleName());
} catch(AvailableInAnotherContextException e1) { } catch(AvailableInAnotherContextException e1) {
throw e1; throw e1;
@ -323,7 +323,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
checkPropagationConstraint(); checkPropagationConstraint();
logger.info("{} successfully created", elementType); logger.info("{} successfully created", typeName);
return element; return element;
} }
@ -340,7 +340,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
@Override @Override
protected OEdge reallyUpdate() throws ResourceRegistryException { protected OEdge reallyUpdate() throws ResourceRegistryException {
logger.debug("Trying to update {} : {}", elementType, jsonNode); logger.debug("Trying to update {} : {}", typeName, jsonNode);
OEdge edge = getElement(); OEdge edge = getElement();
updateProperties(oClass, edge, jsonNode, ignoreKeys, ignoreStartWithKeys); updateProperties(oClass, edge, jsonNode, ignoreKeys, ignoreStartWithKeys);
@ -356,7 +356,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
} }
} }
logger.info("{} {} successfully updated", elementType, jsonNode); logger.info("{} {} successfully updated", typeName, jsonNode);
return edge; return edge;
@ -451,7 +451,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
throw e; throw e;
} catch(Exception e) { } catch(Exception e) {
throw new ResourceRegistryException( throw new ResourceRegistryException(
"Error Adding " + elementType + " to " + targetSecurityContext.toString(), e.getCause()); "Error Adding " + typeName + " to " + targetSecurityContext.toString(), e.getCause());
} }
} }
@ -611,13 +611,13 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
throw e; throw e;
} catch(Exception e) { } catch(Exception e) {
throw new ResourceRegistryException( throw new ResourceRegistryException(
"Error Removing " + elementType + " from " + targetSecurityContext.toString(), e.getCause()); "Error Removing " + typeName + " from " + targetSecurityContext.toString(), e.getCause());
} }
} }
public Map<UUID,JsonNode> removeFromContext(UUID contextUUID) public Map<UUID,JsonNode> removeFromContext(UUID contextUUID)
throws NotFoundException, ContextException, ResourceRegistryException { throws NotFoundException, ContextException, ResourceRegistryException {
logger.debug("Going to remove {} with UUID {} from Context with UUID {}", elementType, uuid, contextUUID); logger.debug("Going to remove {} with UUID {} from Context with UUID {}", typeName, uuid, contextUUID);
ODatabaseDocument current = ContextUtility.getCurrentODatabaseDocumentFromThreadLocal(); ODatabaseDocument current = ContextUtility.getCurrentODatabaseDocumentFromThreadLocal();
try { try {
oDatabaseDocument = ContextUtility.getAdminSecurityContext().getDatabaseDocument(PermissionMode.WRITER); oDatabaseDocument = ContextUtility.getAdminSecurityContext().getDatabaseDocument(PermissionMode.WRITER);
@ -628,17 +628,17 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
Map<UUID,JsonNode> affectedInstances = internalRemoveFromContext(targetSecurityContext); Map<UUID,JsonNode> affectedInstances = internalRemoveFromContext(targetSecurityContext);
oDatabaseDocument.commit(); oDatabaseDocument.commit();
logger.info("{} with UUID {} successfully removed from Context with UUID {}", elementType, uuid, contextUUID); logger.info("{} with UUID {} successfully removed from Context with UUID {}", typeName, uuid, contextUUID);
return affectedInstances; return affectedInstances;
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {
logger.error("Unable to remove {} with UUID {} from Context with UUID {}", elementType, uuid, contextUUID); logger.error("Unable to remove {} with UUID {} from Context with UUID {}", typeName, uuid, contextUUID);
if(oDatabaseDocument != null) { if(oDatabaseDocument != null) {
oDatabaseDocument.rollback(); oDatabaseDocument.rollback();
} }
throw e; throw e;
} catch(Exception e) { } catch(Exception e) {
logger.error("Unable to remove {} with UUID {} from Context with UUID {}", elementType, uuid, contextUUID, logger.error("Unable to remove {} with UUID {} from Context with UUID {}", typeName, uuid, contextUUID,
e); e);
if(oDatabaseDocument != null) { if(oDatabaseDocument != null) {
oDatabaseDocument.rollback(); oDatabaseDocument.rollback();
@ -718,7 +718,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
OEdge edge = (OEdge) d; OEdge edge = (OEdge) d;
// TODO check because it was using compare // TODO check because it was using compare
if(postFilterPolymorphic && getOClass().isSubClassOf(elementType)) { if(postFilterPolymorphic && getOClass().isSubClassOf(typeName)) {
continue; continue;
} }
@ -741,7 +741,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
@Override @Override
public String reallyGetAll(boolean polymorphic) throws ResourceRegistryException { public String reallyGetAll(boolean polymorphic) throws ResourceRegistryException {
Iterable<ODocument> edges = oDatabaseDocument.browseClass(elementType, polymorphic); Iterable<ODocument> edges = oDatabaseDocument.browseClass(typeName, polymorphic);
Collection<JsonNode> collection = serializeEdges(edges, false); Collection<JsonNode> collection = serializeEdges(edges, false);
return serializeJsonNodeCollectionAsString(collection); return serializeJsonNodeCollectionAsString(collection);
} }

View File

@ -36,7 +36,7 @@ public abstract class EntityTypeDefinitionManagement<E extends EntityType> exten
protected EntityTypeDefinitionManagement(Class<E> clz) { protected EntityTypeDefinitionManagement(Class<E> clz) {
super(AccessType.ENTITY_TYPE); super(AccessType.ENTITY_TYPE);
this.elementType = TypeMapper.getType(clz); this.typeName = TypeMapper.getType(clz);
} }
@Override @Override
@ -72,13 +72,13 @@ public abstract class EntityTypeDefinitionManagement<E extends EntityType> exten
@Override @Override
protected OVertex reallyCreate() throws AlreadyPresentException, ResourceRegistryException { protected OVertex reallyCreate() throws AlreadyPresentException, ResourceRegistryException {
logger.debug("Going to create {} for {}", this.elementType, getName()); logger.debug("Going to create {} for {}", this.typeName, getName());
return createVertex(); return createVertex();
} }
@Override @Override
protected OVertex reallyUpdate() throws NotFoundException, ResourceRegistryException { protected OVertex reallyUpdate() throws NotFoundException, ResourceRegistryException {
logger.debug("Going to update {} for {}", this.elementType, getName()); logger.debug("Going to update {} for {}", this.typeName, getName());
OVertex entityTypeDefinition = getElement(); OVertex entityTypeDefinition = getElement();
entityTypeDefinition = (OVertex) updateProperties(oClass, entityTypeDefinition, jsonNode, entityTypeDefinition = (OVertex) updateProperties(oClass, entityTypeDefinition, jsonNode,
ignoreKeys, ignoreStartWithKeys); ignoreKeys, ignoreStartWithKeys);
@ -87,7 +87,7 @@ public abstract class EntityTypeDefinitionManagement<E extends EntityType> exten
@Override @Override
protected boolean reallyDelete() throws NotFoundException, ResourceRegistryException { protected boolean reallyDelete() throws NotFoundException, ResourceRegistryException {
logger.debug("Going to remove {} for {}", this.elementType, getName()); logger.debug("Going to remove {} for {}", this.typeName, getName());
getElement().delete(); getElement().delete();
return true; return true;
} }
@ -120,13 +120,13 @@ public abstract class EntityTypeDefinitionManagement<E extends EntityType> exten
throw new NotFoundException("null name does not allow to retrieve the Element"); throw new NotFoundException("null name does not allow to retrieve the Element");
} }
String select = "SELECT FROM " + elementType + " WHERE " + EntityType.NAME_PROPERTY + " = \"" String select = "SELECT FROM " + typeName + " WHERE " + EntityType.NAME_PROPERTY + " = \""
+ getName() + "\""; + getName() + "\"";
OResultSet resultSet = oDatabaseDocument.query(select, new HashMap<>()); OResultSet resultSet = oDatabaseDocument.query(select, new HashMap<>());
if(resultSet == null || !resultSet.hasNext()) { if(resultSet == null || !resultSet.hasNext()) {
String error = String.format("No %s with name %s was found", elementType, getName()); String error = String.format("No %s with name %s was found", typeName, getName());
logger.info(error); logger.info(error);
throw new NotFoundException(error); throw new NotFoundException(error);
} }
@ -134,10 +134,10 @@ public abstract class EntityTypeDefinitionManagement<E extends EntityType> exten
OResult oResult = resultSet.next(); OResult oResult = resultSet.next();
OVertex element = (OVertex) ElementManagementUtility.getElementFromOptional(oResult.getElement()); OVertex element = (OVertex) ElementManagementUtility.getElementFromOptional(oResult.getElement());
logger.trace("{} with id {} is : {}", elementType, getName(), Utility.toJsonString(element, true)); logger.trace("{} with id {} is : {}", typeName, getName(), Utility.toJsonString(element, true));
if(resultSet.hasNext()) { if(resultSet.hasNext()) {
throw new ResourceRegistryException("Found more than one " + elementType + " with name " + getName() throw new ResourceRegistryException("Found more than one " + typeName + " with name " + getName()
+ ". This is a fatal error please contact Admnistrator"); + ". This is a fatal error please contact Admnistrator");
} }
@ -155,11 +155,11 @@ public abstract class EntityTypeDefinitionManagement<E extends EntityType> exten
protected OVertex createVertex() throws EntityAlreadyPresentException, ResourceRegistryException { protected OVertex createVertex() throws EntityAlreadyPresentException, ResourceRegistryException {
logger.trace("Going to create {} for {} ({}) using {}", OVertex.class.getSimpleName(), accessType.getName(), logger.trace("Going to create {} for {} ({}) using {}", OVertex.class.getSimpleName(), accessType.getName(),
elementType, jsonNode); typeName, jsonNode);
try { try {
this.element = oDatabaseDocument.newVertex(elementType); this.element = oDatabaseDocument.newVertex(typeName);
updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys); updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
@ -170,8 +170,8 @@ public abstract class EntityTypeDefinitionManagement<E extends EntityType> exten
throw e; throw e;
} catch(Exception e) { } catch(Exception e) {
logger.trace("Error while creating {} for {} ({}) using {}", OVertex.class.getSimpleName(), logger.trace("Error while creating {} for {} ({}) using {}", OVertex.class.getSimpleName(),
accessType.getName(), elementType, jsonNode, e); accessType.getName(), typeName, jsonNode, e);
throw new ResourceRegistryException("Error Creating " + elementType + " with " + jsonNode, e.getCause()); throw new ResourceRegistryException("Error Creating " + typeName + " with " + jsonNode, e.getCause());
} }
} }

View File

@ -37,7 +37,7 @@ public class PropertyTypeDefinitionManagement extends ElementManagement<OElement
public PropertyTypeDefinitionManagement() { public PropertyTypeDefinitionManagement() {
super(AccessType.PROPERTY_TYPE); super(AccessType.PROPERTY_TYPE);
this.elementType = PropertyType.NAME; this.typeName = PropertyType.NAME;
} }
public PropertyTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument) throws ResourceRegistryException { public PropertyTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument) throws ResourceRegistryException {
@ -127,13 +127,13 @@ public class PropertyTypeDefinitionManagement extends ElementManagement<OElement
throw new NotFoundException("null name does not allow to retrieve the Element"); throw new NotFoundException("null name does not allow to retrieve the Element");
} }
String select = "SELECT FROM " + elementType + " WHERE " + PropertyType.NAME_PROPERTY + " = \"" String select = "SELECT FROM " + typeName + " WHERE " + PropertyType.NAME_PROPERTY + " = \""
+ getName() + "\""; + getName() + "\"";
OResultSet resultSet = oDatabaseDocument.query(select, new HashMap<>()); OResultSet resultSet = oDatabaseDocument.query(select, new HashMap<>());
if(resultSet == null || !resultSet.hasNext()) { if(resultSet == null || !resultSet.hasNext()) {
String error = String.format("No %s with name %s was found", elementType, getName()); String error = String.format("No %s with name %s was found", typeName, getName());
logger.info(error); logger.info(error);
throw new NotFoundException(error); throw new NotFoundException(error);
} }
@ -141,10 +141,10 @@ public class PropertyTypeDefinitionManagement extends ElementManagement<OElement
OResult oResult = resultSet.next(); OResult oResult = resultSet.next();
OElement element = (OElement) ElementManagementUtility.getElementFromOptional(oResult.getElement()); OElement element = (OElement) ElementManagementUtility.getElementFromOptional(oResult.getElement());
logger.trace("{} with id {} is : {}", elementType, getName(), Utility.toJsonString(element, true)); logger.trace("{} with id {} is : {}", typeName, getName(), Utility.toJsonString(element, true));
if(resultSet.hasNext()) { if(resultSet.hasNext()) {
throw new ResourceRegistryException("Found more than one " + elementType + " with name " + getName() throw new ResourceRegistryException("Found more than one " + typeName + " with name " + getName()
+ ". This is a fatal error please contact Admnistrator"); + ". This is a fatal error please contact Admnistrator");
} }
@ -160,7 +160,7 @@ public class PropertyTypeDefinitionManagement extends ElementManagement<OElement
protected OElement createElement() throws AlreadyPresentException, ResourceRegistryException { protected OElement createElement() throws AlreadyPresentException, ResourceRegistryException {
try { try {
this.element = new ODocument(elementType); this.element = new ODocument(typeName);
updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys); updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
@ -171,8 +171,8 @@ public class PropertyTypeDefinitionManagement extends ElementManagement<OElement
throw e; throw e;
} catch(Exception e) { } catch(Exception e) {
logger.trace("Error while creating {} for {} ({}) using {}", OElement.class.getSimpleName(), logger.trace("Error while creating {} for {} ({}) using {}", OElement.class.getSimpleName(),
accessType.getName(), elementType, jsonNode, e); accessType.getName(), typeName, jsonNode, e);
throw new ResourceRegistryException("Error Creating " + elementType + " with " + jsonNode, e.getCause()); throw new ResourceRegistryException("Error Creating " + typeName + " with " + jsonNode, e.getCause());
} }
} }

View File

@ -16,13 +16,13 @@ public class ConsistsOfTypeDefinitionManagement
public ConsistsOfTypeDefinitionManagement() { public ConsistsOfTypeDefinitionManagement() {
super(FacetType.class); super(FacetType.class);
this.elementType = ConsistsOfType.NAME; this.typeName = ConsistsOfType.NAME;
} }
public ConsistsOfTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument) public ConsistsOfTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument)
throws ResourceRegistryException { throws ResourceRegistryException {
super(securityContext, oDatabaseDocument, FacetType.class); super(securityContext, oDatabaseDocument, FacetType.class);
this.elementType = ConsistsOfType.NAME; this.typeName = ConsistsOfType.NAME;
} }
@Override @Override

View File

@ -16,13 +16,13 @@ public class IsRelatedToTypeDefinitionManagement
public IsRelatedToTypeDefinitionManagement() { public IsRelatedToTypeDefinitionManagement() {
super(ResourceType.class); super(ResourceType.class);
this.elementType = IsRelatedToType.NAME; this.typeName = IsRelatedToType.NAME;
} }
public IsRelatedToTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument) public IsRelatedToTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument)
throws ResourceRegistryException { throws ResourceRegistryException {
super(securityContext, oDatabaseDocument, ResourceType.class); super(securityContext, oDatabaseDocument, ResourceType.class);
this.elementType = IsRelatedToType.NAME; this.typeName = IsRelatedToType.NAME;
} }
@Override @Override

View File

@ -38,7 +38,7 @@ public abstract class RelationTypeDefinitionManagement<T extends EntityTypeDefin
public RelationTypeDefinitionManagement(Class<TT> clz) { public RelationTypeDefinitionManagement(Class<TT> clz) {
super(AccessType.RELATION_TYPE, ResourceType.class, clz); super(AccessType.RELATION_TYPE, ResourceType.class, clz);
this.elementType = RelationType.NAME; this.typeName = RelationType.NAME;
} }
public RelationTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument, Class<TT> clz) throws ResourceRegistryException { public RelationTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument, Class<TT> clz) throws ResourceRegistryException {
@ -89,7 +89,7 @@ public abstract class RelationTypeDefinitionManagement<T extends EntityTypeDefin
if(targetEntityManagement == null) { if(targetEntityManagement == null) {
if(!jsonNode.has(Relation.TARGET_PROPERTY)) { if(!jsonNode.has(Relation.TARGET_PROPERTY)) {
throw new ResourceRegistryException( throw new ResourceRegistryException(
"Error while creating " + elementType + ". No target definition found"); "Error while creating " + typeName + ". No target definition found");
} }
targetEntityManagement = newTargetEntityManagement(); targetEntityManagement = newTargetEntityManagement();
@ -100,10 +100,10 @@ public abstract class RelationTypeDefinitionManagement<T extends EntityTypeDefin
OVertex source = (OVertex) getSourceEntityManagement().getElement(); OVertex source = (OVertex) getSourceEntityManagement().getElement();
OVertex target = (OVertex) getTargetEntityManagement().getElement(); OVertex target = (OVertex) getTargetEntityManagement().getElement();
logger.trace("Creating {} beetween {} -> {}", elementType, source.toString(), logger.trace("Creating {} beetween {} -> {}", typeName, source.toString(),
target.toString()); target.toString());
element = oDatabaseDocument.newEdge(source, target, elementType); element = oDatabaseDocument.newEdge(source, target, typeName);
updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys); updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
@ -155,13 +155,13 @@ public abstract class RelationTypeDefinitionManagement<T extends EntityTypeDefin
throw new NotFoundException("null name does not allow to retrieve the Element"); throw new NotFoundException("null name does not allow to retrieve the Element");
} }
String select = "SELECT FROM " + elementType + " WHERE " + RelationType.NAME_PROPERTY + " = \"" String select = "SELECT FROM " + typeName + " WHERE " + RelationType.NAME_PROPERTY + " = \""
+ getName() + "\""; + getName() + "\"";
OResultSet resultSet = oDatabaseDocument.query(select, new HashMap<>()); OResultSet resultSet = oDatabaseDocument.query(select, new HashMap<>());
if(resultSet == null || !resultSet.hasNext()) { if(resultSet == null || !resultSet.hasNext()) {
String error = String.format("No %s with name %s was found", elementType, getName()); String error = String.format("No %s with name %s was found", typeName, getName());
logger.info(error); logger.info(error);
throw new NotFoundException(error); throw new NotFoundException(error);
} }
@ -169,10 +169,10 @@ public abstract class RelationTypeDefinitionManagement<T extends EntityTypeDefin
OResult oResult = resultSet.next(); OResult oResult = resultSet.next();
OEdge element = (OEdge) ElementManagementUtility.getElementFromOptional(oResult.getElement()); OEdge element = (OEdge) ElementManagementUtility.getElementFromOptional(oResult.getElement());
logger.trace("{} with id {} is : {}", elementType, getName(), Utility.toJsonString(element, true)); logger.trace("{} with id {} is : {}", typeName, getName(), Utility.toJsonString(element, true));
if(resultSet.hasNext()) { if(resultSet.hasNext()) {
throw new ResourceRegistryException("Found more than one " + elementType + " with name " + getName() throw new ResourceRegistryException("Found more than one " + typeName + " with name " + getName()
+ ". This is a fatal error please contact Admnistrator"); + ". This is a fatal error please contact Admnistrator");
} }