Added exists method which use HTTP HEAD method

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@146397 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-03-28 14:01:42 +00:00
parent 0ebbef1c55
commit dfb18b9144
1 changed files with 20 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import java.util.Arrays;
import java.util.UUID; import java.util.UUID;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.HEAD;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.PathParam; import javax.ws.rs.PathParam;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
@ -75,6 +76,24 @@ public class Access {
return queryManager.query(query, limit, fetchPlan); return queryManager.query(query, limit, fetchPlan);
} }
@HEAD
@Path(AccessPath.INSTANCE_PATH_PART + "/" + "{" + TYPE_PATH_PARAM + "}"
+ "/{" + ID_PATH_PARAM + "}")
public void exists(@PathParam(TYPE_PATH_PARAM) String type,
@PathParam(ID_PATH_PARAM) String id) throws ERNotFoundException, ResourceRegistryException {
logger.info("Requested to check if {} with id {} exists", type, id);
@SuppressWarnings("rawtypes")
ERManagement erManagement = ERManagement.getERManagement(type);
UUID uuid = null;
try {
uuid = UUID.fromString(id);
} catch (Exception e) {
throw new ResourceRegistryException(e);
}
erManagement.setUUID(uuid);
erManagement.exists();
}
/* /*
* e.g. GET * e.g. GET
* /resource-registry/access/instance/ContactFacet/4d28077b-566d-4132-b073- * /resource-registry/access/instance/ContactFacet/4d28077b-566d-4132-b073-