Refs #11288: Made resource-registry more RESTful
Task-Url: https://support.d4science.org/issues/11288 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@169078 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
4f07e57030
commit
f4b358be2c
|
@ -429,10 +429,16 @@ public abstract class ERManagement<ERType extends ER, El extends Element> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean exists()
|
public boolean exists(boolean writer)
|
||||||
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException {
|
throws NotFoundException, AvailableInAnotherContextException, ResourceRegistryException {
|
||||||
try {
|
try {
|
||||||
|
if(writer) {
|
||||||
|
// Exists is used to understand if it is a create or update.
|
||||||
|
// In any case the we need writing right on this instance
|
||||||
|
orientGraph = getWorkingContext().getGraph(PermissionMode.WRITER);
|
||||||
|
}else {
|
||||||
orientGraph = getWorkingContext().getGraph(PermissionMode.READER);
|
orientGraph = getWorkingContext().getGraph(PermissionMode.READER);
|
||||||
|
}
|
||||||
|
|
||||||
getElement();
|
getElement();
|
||||||
|
|
||||||
|
|
|
@ -209,7 +209,7 @@ public class Access {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
erManagement.setUUID(UUID.fromString(uuid));
|
erManagement.setUUID(UUID.fromString(uuid));
|
||||||
boolean found = erManagement.exists();
|
boolean found = erManagement.exists(false);
|
||||||
if(found) {
|
if(found) {
|
||||||
return Response.status(Status.NO_CONTENT).build();
|
return Response.status(Status.NO_CONTENT).build();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class InstancesManager {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
erManagement.setUUID(UUID.fromString(uuid));
|
erManagement.setUUID(UUID.fromString(uuid));
|
||||||
boolean found = erManagement.exists();
|
boolean found = erManagement.exists(false);
|
||||||
if(found) {
|
if(found) {
|
||||||
return Response.status(Status.NO_CONTENT).build();
|
return Response.status(Status.NO_CONTENT).build();
|
||||||
} else {
|
} else {
|
||||||
|
@ -162,7 +162,7 @@ public class InstancesManager {
|
||||||
|
|
||||||
boolean create = false;
|
boolean create = false;
|
||||||
try {
|
try {
|
||||||
erManagement.exists();
|
erManagement.exists(true);
|
||||||
} catch(NotFoundException e) {
|
} catch(NotFoundException e) {
|
||||||
create = true;
|
create = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue