From af2ef0ccb5d4ff9c95b7d49625dbff1e895ac7e3 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Thu, 27 Apr 2023 11:13:35 +0200 Subject: [PATCH] Refactored to use Element getTypeName() function --- .../publisher/ResourceRegistryPublisherImpl.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/publisher/ResourceRegistryPublisherImpl.java b/src/main/java/org/gcube/informationsystem/resourceregistry/publisher/ResourceRegistryPublisherImpl.java index 7b40f4b..2cbb04c 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/publisher/ResourceRegistryPublisherImpl.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/publisher/ResourceRegistryPublisherImpl.java @@ -328,7 +328,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher protected String internalCreate(ERElem er) throws SchemaViolationException, AlreadyPresentException, ResourceRegistryException { try { - String type = TypeUtility.getTypeName(er); + String type = er.getTypeName(); String json = ElementMapper.marshal(er); UUID uuid = er.getUUID(); if (uuid == null) { @@ -379,7 +379,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher @Override public boolean exist(ERElem er) throws AvailableInAnotherContextException, ResourceRegistryException { - String type = TypeUtility.getTypeName(er); + String type = er.getTypeName(); UUID uuid = er.getUUID(); return exist(type, uuid); } @@ -428,7 +428,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher public ERElem read(ERElem er) throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException { try { - String type = TypeUtility.getTypeName(er); + String type = er.getTypeName(); UUID uuid = er.getUUID(); String ret = read(type, uuid); return (ERElem) ElementMapper.unmarshal(ERElement.class, ret); @@ -488,7 +488,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher public ERElem update(ERElem er) throws SchemaViolationException, NotFoundException, ResourceRegistryException { try { - String type = TypeUtility.getTypeName(er); + String type = er.getTypeName(); String json = ElementMapper.marshal(er); UUID uuid = er.getUUID(); String ret = update(type, json, uuid); @@ -564,7 +564,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher public boolean delete(ERElem er) throws SchemaViolationException, NotFoundException, ResourceRegistryException { try { - String type = TypeUtility.getTypeName(er); + String type = er.getTypeName(); UUID uuid = er.getUUID(); return delete(type, uuid); } catch (ResourceRegistryException e) { @@ -840,7 +840,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher public List addToContext(ERElement er, UUID contextUUID, Boolean dryRun) throws SchemaViolationException, NotFoundException, ContextNotFoundException, ResourceRegistryException { try { - String type = TypeUtility.getTypeName(er); + String type = er.getTypeName(); UUID instanceUUID = er.getUUID(); return addToContext(type, instanceUUID, contextUUID, dryRun); } catch (ResourceRegistryException e) { @@ -907,7 +907,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher public List removeFromContext(ERElement er, UUID contextUUID, Boolean dryRun) throws SchemaViolationException, NotFoundException, ContextNotFoundException, ResourceRegistryException { try { - String type = TypeUtility.getTypeName(er); + String type = er.getTypeName(); UUID instanceUUID = er.getUUID(); return removeFromContext(type, instanceUUID, contextUUID, dryRun); } catch (ResourceRegistryException e) { @@ -966,7 +966,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher @Override public Map getElementContexts(ERElem er) throws NotFoundException, ResourceRegistryException { - String type = TypeUtility.getTypeName(er); + String type = er.getTypeName(); UUID instanceUUID = er.getUUID(); return getElementContexts(type, instanceUUID); }