improving code

This commit is contained in:
Luca Frosini 2021-03-04 17:08:54 +01:00
parent dc481fbba6
commit 42bb1a217a
2 changed files with 3 additions and 5 deletions

View File

@ -35,7 +35,7 @@ public interface ERManagement {
public Map<UUID, JsonNode> removeFromContext(UUID contextUUID)
throws SchemaViolationException, NotFoundException, ContextException, ResourceRegistryException;
public void sanityCheck() throws SchemaViolationException, ResourceRegistryException;
// public void sanityCheck() throws SchemaViolationException, ResourceRegistryException;
public AvailableInAnotherContextException getSpecificERAvailableInAnotherContextException(String message);

View File

@ -338,6 +338,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
element.save();
}
affectedInstances.put(uuid, serializeSelfAsJsonNode());
sanityCheck();
return affectedInstances;
} catch(ResourceRegistryException e) {
throw e;
@ -360,8 +361,6 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
Map<UUID,JsonNode> affectedInstances = internalAddToContext();
sanityCheck();
oDatabaseDocument.commit();
logger.info("{} with UUID {} successfully added to Context with UUID {}", typeName, uuid, contextUUID);
@ -400,6 +399,7 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
element.save();
}
affectedInstances.put(uuid, serializeSelfAsJsonNode());
sanityCheck();
return affectedInstances;
} catch(ResourceRegistryException e) {
throw e;
@ -454,8 +454,6 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
Map<UUID,JsonNode> affectedInstances = internalRemoveFromContext();
sanityCheck();
oDatabaseDocument.commit();
logger.info("{} with UUID {} successfully removed from Context with UUID {}", typeName, uuid, contextUUID);