Creating missing ConsistsOf when updating a Resource
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@150850 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
939392a5b9
commit
e4ad9c6d09
|
@ -331,6 +331,14 @@ public abstract class ERManagement<ERType extends ER, El extends Element> {
|
|||
public abstract El reallyUpdate() throws ERNotFoundException,
|
||||
ResourceRegistryException;
|
||||
|
||||
public El reallyCreateOrUdate() throws ResourceRegistryException {
|
||||
try {
|
||||
return reallyUpdate();
|
||||
}catch (ERNotFoundException e) {
|
||||
return reallyCreate();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract boolean reallyDelete() throws ERNotFoundException,
|
||||
ResourceRegistryException;
|
||||
|
||||
|
@ -420,6 +428,9 @@ public abstract class ERManagement<ERType extends ER, El extends Element> {
|
|||
|
||||
public El retrieveElement() throws ERNotFoundException, ResourceRegistryException {
|
||||
try {
|
||||
if(uuid==null){
|
||||
throw new ERNotFoundException("null UUID does not allow to retrieve the Element");
|
||||
}
|
||||
return Utility.getElementByUUID(orientGraph,
|
||||
erType == null ? accessType.getName() : erType, uuid, elementClass);
|
||||
} catch (ERNotFoundException e) {
|
||||
|
|
|
@ -170,7 +170,7 @@ public class ResourceManagement extends EntityManagement<Resource> {
|
|||
for (JsonNode relationJsonNode : jsonNodeArray) {
|
||||
ConsistsOfManagement com = new ConsistsOfManagement(orientGraph);
|
||||
com.setJSON(relationJsonNode);
|
||||
com.reallyUpdate();
|
||||
com.reallyCreateOrUdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue