Added logs

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@134330 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2016-11-17 16:02:48 +00:00
parent fb98a6e857
commit 6dff36cb0c
2 changed files with 12 additions and 1 deletions

View File

@ -427,6 +427,7 @@ public class EntityManagementImpl implements EntityManagement {
return vertex;
} catch (Exception e) {
logger.error("Error Creating {} with {}", entityType, jsonRepresentation, e);
if (orientGraph != null) {
orientGraph.rollback();
}
@ -446,6 +447,9 @@ public class EntityManagementImpl implements EntityManagement {
String jsonProperties)
throws FacetNotFoundException, ResourceNotFoundException,
ResourceRegistryException {
logger.trace("Trying to create {} with {}", relationType, jsonProperties);
OrientGraph orientGraph = null;
if (relationType == null || relationType.compareTo("") == 0) {
@ -485,6 +489,7 @@ public class EntityManagementImpl implements EntityManagement {
relationType, relationBaseClass, edgeProperties, false);
} catch(ResourceNotFoundException rnfe){
logger.trace("Error Creating {} with {}", relationType, jsonProperties, rnfe);
throw rnfe;
} catch (Exception e) {
throw new ResourceRegistryException(e);
@ -498,6 +503,7 @@ public class EntityManagementImpl implements EntityManagement {
Map<String, Object> edgeProperties,
boolean deferredCommit) throws ResourceRegistryException {
logger.info("Trying to create {} with {}", relationType, edgeProperties);
try {
@ -541,14 +547,19 @@ public class EntityManagementImpl implements EntityManagement {
if (!deferredCommit) {
orientGraph.commit();
}
logger.info("{} with {} successfully created", relationType, edgeProperties);
return edge;
} catch (ResourceRegistryException rre) {
logger.error("Error Creating {} with {}", relationType, edgeProperties, rre);
if (orientGraph!=null) {
orientGraph.rollback();
}
throw rre;
} catch (Exception e) {
logger.error("Error Creating {} with {}", relationType, edgeProperties, e);
if (orientGraph!=null) {
orientGraph.rollback();
}