content-type is get from gcat-api to avoid conflicts
This commit is contained in:
parent
6bdbf5bd8c
commit
303c092cfb
|
@ -1,7 +1,6 @@
|
|||
package org.gcube.gcat;
|
||||
|
||||
import javax.ws.rs.ApplicationPath;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.gcube.gcat.rest.Group;
|
||||
import org.glassfish.jersey.server.ResourceConfig;
|
||||
|
@ -12,8 +11,6 @@ import org.glassfish.jersey.server.ResourceConfig;
|
|||
@ApplicationPath("/")
|
||||
public class ResourceInitializer extends ResourceConfig {
|
||||
|
||||
public static final String APPLICATION_JSON_CHARSET_UTF_8 = MediaType.APPLICATION_JSON + ";charset=UTF-8";
|
||||
|
||||
public ResourceInitializer() {
|
||||
packages(Group.class.getPackage().toString());
|
||||
}
|
||||
|
|
|
@ -20,9 +20,9 @@ import javax.xml.ws.WebServiceException;
|
|||
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
import org.gcube.gcat.ResourceInitializer;
|
||||
import org.gcube.gcat.annotation.PATCH;
|
||||
import org.gcube.gcat.annotation.PURGE;
|
||||
import org.gcube.gcat.api.GCatConstants;
|
||||
import org.gcube.gcat.api.roles.Role;
|
||||
import org.gcube.gcat.configuration.CatalogueConfigurationFactory;
|
||||
import org.gcube.gcat.configuration.ServiceCatalogueConfiguration;
|
||||
|
@ -85,8 +85,8 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf
|
|||
}
|
||||
|
||||
@POST
|
||||
@Consumes(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Override
|
||||
public Response create(String json) throws WebServiceException {
|
||||
try {
|
||||
|
@ -95,7 +95,7 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf
|
|||
String ret = createOrUpdate(catalogueConfiguration);
|
||||
ResponseBuilder responseBuilder = Response.status(Status.CREATED);
|
||||
if(ret!=null) {
|
||||
responseBuilder.entity(ret).type(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
responseBuilder.entity(ret).type(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
}
|
||||
return responseBuilder.build();
|
||||
}catch (WebServiceException e) {
|
||||
|
@ -106,7 +106,7 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf
|
|||
}
|
||||
|
||||
@GET
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
public String read(String context) throws WebServiceException {
|
||||
try {
|
||||
checkContext(context);
|
||||
|
@ -133,8 +133,8 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf
|
|||
}
|
||||
|
||||
@PUT
|
||||
@Consumes(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
public String createOrUpdate(String context, String json) throws WebServiceException {
|
||||
try {
|
||||
ServiceCatalogueConfiguration catalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(json);
|
||||
|
@ -164,8 +164,8 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf
|
|||
}
|
||||
|
||||
@PATCH
|
||||
@Consumes(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
public String patch(String context, String json) throws WebServiceException {
|
||||
try {
|
||||
checkContext(context);
|
||||
|
|
|
@ -13,7 +13,6 @@ import javax.ws.rs.QueryParam;
|
|||
import javax.ws.rs.core.Response;
|
||||
import javax.xml.ws.WebServiceException;
|
||||
|
||||
import org.gcube.gcat.ResourceInitializer;
|
||||
import org.gcube.gcat.annotation.PATCH;
|
||||
import org.gcube.gcat.annotation.PURGE;
|
||||
import org.gcube.gcat.api.GCatConstants;
|
||||
|
@ -41,7 +40,7 @@ public class Group extends REST<CKANGroup> implements org.gcube.gcat.api.interfa
|
|||
}
|
||||
|
||||
@GET
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
public String list(@QueryParam(GCatConstants.LIMIT_PARAMETER) @DefaultValue("10") int limit,
|
||||
@QueryParam(GCatConstants.OFFSET_PARAMETER) @DefaultValue("0") int offset,
|
||||
@QueryParam(GCatConstants.COUNT_PARAMETER) @DefaultValue("false") Boolean countOnly) {
|
||||
|
@ -63,8 +62,8 @@ public class Group extends REST<CKANGroup> implements org.gcube.gcat.api.interfa
|
|||
}
|
||||
|
||||
@POST
|
||||
@Consumes(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Override
|
||||
public Response create(String json) {
|
||||
return super.create(json);
|
||||
|
@ -72,7 +71,7 @@ public class Group extends REST<CKANGroup> implements org.gcube.gcat.api.interfa
|
|||
|
||||
@GET
|
||||
@Path("/{" + GROUP_ID_PARAMETER + "}")
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Override
|
||||
public String read(@PathParam(GROUP_ID_PARAMETER) String id) {
|
||||
return super.read(id);
|
||||
|
@ -80,8 +79,8 @@ public class Group extends REST<CKANGroup> implements org.gcube.gcat.api.interfa
|
|||
|
||||
@PUT
|
||||
@Path("/{" + GROUP_ID_PARAMETER + "}")
|
||||
@Consumes(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Override
|
||||
public String update(@PathParam(GROUP_ID_PARAMETER) String id, String json) {
|
||||
return super.update(id, json);
|
||||
|
@ -89,8 +88,8 @@ public class Group extends REST<CKANGroup> implements org.gcube.gcat.api.interfa
|
|||
|
||||
@PATCH
|
||||
@Path("/{" + GROUP_ID_PARAMETER + "}")
|
||||
@Consumes(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Override
|
||||
public String patch(@PathParam(GROUP_ID_PARAMETER) String id, String json) {
|
||||
return super.patch(id, json);
|
||||
|
|
|
@ -15,7 +15,6 @@ import javax.ws.rs.core.Response.ResponseBuilder;
|
|||
import javax.ws.rs.core.Response.Status;
|
||||
import javax.xml.ws.WebServiceException;
|
||||
|
||||
import org.gcube.gcat.ResourceInitializer;
|
||||
import org.gcube.gcat.annotation.PATCH;
|
||||
import org.gcube.gcat.annotation.PURGE;
|
||||
import org.gcube.gcat.api.GCatConstants;
|
||||
|
@ -40,7 +39,7 @@ public class Item extends REST<CKANPackage> implements org.gcube.gcat.api.interf
|
|||
}
|
||||
|
||||
@GET
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
public String list(@QueryParam(GCatConstants.LIMIT_PARAMETER) @DefaultValue("10") int limit,
|
||||
@QueryParam(GCatConstants.OFFSET_PARAMETER) @DefaultValue("0") int offset,
|
||||
@QueryParam(GCatConstants.COUNT_PARAMETER) @DefaultValue("false") Boolean countOnly) {
|
||||
|
@ -63,8 +62,8 @@ public class Item extends REST<CKANPackage> implements org.gcube.gcat.api.interf
|
|||
}
|
||||
|
||||
@POST
|
||||
@Consumes(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Override
|
||||
public Response create(String json) {
|
||||
return super.create(json);
|
||||
|
@ -72,7 +71,7 @@ public class Item extends REST<CKANPackage> implements org.gcube.gcat.api.interf
|
|||
|
||||
@GET
|
||||
@Path("/{" + ITEM_ID_PARAMETER + "}")
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Override
|
||||
public String read(@PathParam(ITEM_ID_PARAMETER) String id) {
|
||||
return super.read(id);
|
||||
|
@ -80,8 +79,8 @@ public class Item extends REST<CKANPackage> implements org.gcube.gcat.api.interf
|
|||
|
||||
@PUT
|
||||
@Path("/{" + ITEM_ID_PARAMETER + "}")
|
||||
@Consumes(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Override
|
||||
public String update(@PathParam(ITEM_ID_PARAMETER) String id, String json) {
|
||||
return super.update(id, json);
|
||||
|
@ -89,8 +88,8 @@ public class Item extends REST<CKANPackage> implements org.gcube.gcat.api.interf
|
|||
|
||||
@PATCH
|
||||
@Path("/{" + ITEM_ID_PARAMETER + "}")
|
||||
@Consumes(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Override
|
||||
public String patch(@PathParam(ITEM_ID_PARAMETER) String id, String json) {
|
||||
return super.patch(id, json);
|
||||
|
@ -129,7 +128,7 @@ public class Item extends REST<CKANPackage> implements org.gcube.gcat.api.interf
|
|||
}
|
||||
|
||||
@DELETE
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Override
|
||||
public Response bulkDelete(@QueryParam(GCatConstants.PURGE_QUERY_PARAMETER) @DefaultValue("false") boolean purge) {
|
||||
deleteAll(purge);
|
||||
|
@ -137,7 +136,7 @@ public class Item extends REST<CKANPackage> implements org.gcube.gcat.api.interf
|
|||
}
|
||||
|
||||
@PURGE
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Override
|
||||
public Response bulkPurge() {
|
||||
return bulkDelete(true);
|
||||
|
@ -145,8 +144,8 @@ public class Item extends REST<CKANPackage> implements org.gcube.gcat.api.interf
|
|||
|
||||
@POST
|
||||
@Path("/{" + ITEM_ID_PARAMETER + "}")
|
||||
@Consumes(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
public Response moderate(@PathParam(ITEM_ID_PARAMETER) String id, String json) {
|
||||
setCalledMethod("POST /" + COLLECTION_PARAMETER + "/{" + ID_PARAMETER + "}");
|
||||
CKANPackage ckanPackage = getInstance();
|
||||
|
@ -154,7 +153,7 @@ public class Item extends REST<CKANPackage> implements org.gcube.gcat.api.interf
|
|||
String ret = ckanPackage.moderate(json);
|
||||
ResponseBuilder responseBuilder = Response.status(Status.ACCEPTED);
|
||||
if(ret!=null) {
|
||||
responseBuilder.entity(ret).type(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
responseBuilder.entity(ret).type(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8);
|
||||
}
|
||||
return responseBuilder.build();
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import javax.ws.rs.GET;
|
|||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import org.gcube.gcat.ResourceInitializer;
|
||||
import org.gcube.gcat.api.GCatConstants;
|
||||
import org.gcube.gcat.persistence.ckan.CKANLicense;
|
||||
|
||||
/**
|
||||
|
@ -18,7 +18,7 @@ public class License extends REST<CKANLicense> implements org.gcube.gcat.api.int
|
|||
}
|
||||
|
||||
@GET
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
public String list() {
|
||||
return super.list(-1, -1);
|
||||
}
|
||||
|
|
|
@ -7,13 +7,12 @@ import javax.ws.rs.InternalServerErrorException;
|
|||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.NamespaceCategory;
|
||||
import org.gcube.gcat.ResourceInitializer;
|
||||
import org.gcube.gcat.profile.MetadataUtility;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.NamespaceCategory;
|
||||
import org.gcube.gcat.api.GCatConstants;
|
||||
import org.gcube.gcat.profile.MetadataUtility;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
|
@ -22,7 +21,7 @@ import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
|
|||
public class Namespace extends BaseREST implements org.gcube.gcat.api.interfaces.Namespace {
|
||||
|
||||
@GET
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
public String list() {
|
||||
setCalledMethod("GET /" + NAMESPACES);
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ import javax.ws.rs.QueryParam;
|
|||
import javax.ws.rs.core.Response;
|
||||
import javax.xml.ws.WebServiceException;
|
||||
|
||||
import org.gcube.gcat.ResourceInitializer;
|
||||
import org.gcube.gcat.annotation.PATCH;
|
||||
import org.gcube.gcat.annotation.PURGE;
|
||||
import org.gcube.gcat.api.GCatConstants;
|
||||
|
@ -42,7 +41,7 @@ public class Organization extends REST<CKANOrganization>
|
|||
}
|
||||
|
||||
@GET
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
public String list(@QueryParam(GCatConstants.LIMIT_PARAMETER) @DefaultValue("10") int limit,
|
||||
@QueryParam(GCatConstants.OFFSET_PARAMETER) @DefaultValue("0") int offset,
|
||||
@QueryParam(GCatConstants.COUNT_PARAMETER) @DefaultValue("false") Boolean countOnly) {
|
||||
|
@ -64,8 +63,8 @@ public class Organization extends REST<CKANOrganization>
|
|||
}
|
||||
|
||||
@POST
|
||||
@Consumes(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Override
|
||||
public Response create(String json) {
|
||||
return super.create(json);
|
||||
|
@ -73,7 +72,7 @@ public class Organization extends REST<CKANOrganization>
|
|||
|
||||
@GET
|
||||
@Path("/{" + ORGANIZATION_ID_PARAMETER + "}")
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Override
|
||||
public String read(@PathParam(ORGANIZATION_ID_PARAMETER) String id) {
|
||||
return super.read(id);
|
||||
|
@ -81,8 +80,8 @@ public class Organization extends REST<CKANOrganization>
|
|||
|
||||
@PUT
|
||||
@Path("/{" + ORGANIZATION_ID_PARAMETER + "}")
|
||||
@Consumes(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Override
|
||||
public String update(@PathParam(ORGANIZATION_ID_PARAMETER) String id, String json) {
|
||||
return super.update(id, json);
|
||||
|
@ -90,8 +89,8 @@ public class Organization extends REST<CKANOrganization>
|
|||
|
||||
@PATCH
|
||||
@Path("/{" + ORGANIZATION_ID_PARAMETER + "}")
|
||||
@Consumes(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Override
|
||||
public String patch(@PathParam(ORGANIZATION_ID_PARAMETER) String id, String json) {
|
||||
return super.patch(id, json);
|
||||
|
|
|
@ -22,14 +22,12 @@ import javax.ws.rs.core.Response.ResponseBuilder;
|
|||
import javax.ws.rs.core.Response.Status;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import org.gcube.datacatalogue.metadatadiscovery.DataCalogueMetadataFormatReader;
|
||||
import org.gcube.gcat.ResourceInitializer;
|
||||
import org.gcube.gcat.api.GCatConstants;
|
||||
import org.gcube.gcat.profile.ISProfile;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
|
@ -110,7 +108,7 @@ public class Profile extends BaseREST implements org.gcube.gcat.api.interfaces.P
|
|||
|
||||
@GET
|
||||
@Path("/{" + PROFILE_NAME_PARAMETER + "}")
|
||||
@Produces({MediaType.APPLICATION_XML, ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8})
|
||||
@Produces({MediaType.APPLICATION_XML, GCatConstants.APPLICATION_JSON_CHARSET_UTF_8})
|
||||
public String read(@PathParam(PROFILE_NAME_PARAMETER) String name,
|
||||
@DefaultValue(MediaType.APPLICATION_XML) @HeaderParam("Accept") String accept) {
|
||||
setCalledMethod("GET /" + PROFILES + "/{" + PROFILE_NAME_PARAMETER + "}");
|
||||
|
|
|
@ -5,7 +5,7 @@ import javax.ws.rs.core.Response;
|
|||
import javax.ws.rs.core.Response.ResponseBuilder;
|
||||
import javax.ws.rs.core.Response.Status;
|
||||
|
||||
import org.gcube.gcat.ResourceInitializer;
|
||||
import org.gcube.gcat.api.GCatConstants;
|
||||
import org.gcube.gcat.api.interfaces.CRUD;
|
||||
import org.gcube.gcat.persistence.ckan.CKAN;
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class REST<C extends CKAN> extends BaseREST implements CRUD<Response,Resp
|
|||
|
||||
ResponseBuilder responseBuilder = Response.status(Status.CREATED).entity(ret);
|
||||
responseBuilder = addLocation(responseBuilder, ckan.getName());
|
||||
return responseBuilder.type(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8).build();
|
||||
return responseBuilder.type(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,8 +12,8 @@ import javax.ws.rs.core.Response;
|
|||
import javax.ws.rs.core.Response.ResponseBuilder;
|
||||
import javax.ws.rs.core.Response.Status;
|
||||
|
||||
import org.gcube.gcat.ResourceInitializer;
|
||||
import org.gcube.gcat.annotation.PATCH;
|
||||
import org.gcube.gcat.api.GCatConstants;
|
||||
import org.gcube.gcat.persistence.ckan.CKANResource;
|
||||
|
||||
/**
|
||||
|
@ -28,7 +28,7 @@ public class Resource extends BaseREST implements org.gcube.gcat.api.interfaces.
|
|||
protected static final String COLLECTION = Item.ITEMS + "/{" + ITEM_ID_PARAMETER + "}/" + RESOURCES;
|
||||
|
||||
@GET
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
public String list(@PathParam(ITEM_ID_PARAMETER) String itemID) {
|
||||
setCalledMethod("GET /" + COLLECTION);
|
||||
CKANResource ckanResource = new CKANResource(itemID);
|
||||
|
@ -37,8 +37,8 @@ public class Resource extends BaseREST implements org.gcube.gcat.api.interfaces.
|
|||
}
|
||||
|
||||
@POST
|
||||
@Consumes(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
public Response create(@PathParam(ITEM_ID_PARAMETER) String itemID, String json) {
|
||||
setCalledMethod("POST /" + COLLECTION);
|
||||
CKANResource ckanResource = new CKANResource(itemID);
|
||||
|
@ -46,12 +46,12 @@ public class Resource extends BaseREST implements org.gcube.gcat.api.interfaces.
|
|||
|
||||
ResponseBuilder responseBuilder = Response.status(Status.CREATED).entity(ret);
|
||||
responseBuilder = addLocation(responseBuilder, ckanResource.getResourceID());
|
||||
return responseBuilder.type(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8).build();
|
||||
return responseBuilder.type(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{" + RESOURCE_ID_PARAMETER + "}")
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
public String read(@PathParam(ITEM_ID_PARAMETER) String itemID,
|
||||
@PathParam(RESOURCE_ID_PARAMETER) String resourceID) {
|
||||
setCalledMethod("GET /" + COLLECTION + "/{" + RESOURCE_ID_PARAMETER + "}");
|
||||
|
@ -62,8 +62,8 @@ public class Resource extends BaseREST implements org.gcube.gcat.api.interfaces.
|
|||
|
||||
@PUT
|
||||
@Path("/{" + RESOURCE_ID_PARAMETER + "}")
|
||||
@Consumes(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
public String update(@PathParam(ITEM_ID_PARAMETER) String itemID,
|
||||
@PathParam(RESOURCE_ID_PARAMETER) String resourceID, String json) {
|
||||
setCalledMethod("PUT /" + COLLECTION + "/{" + RESOURCE_ID_PARAMETER + "}");
|
||||
|
@ -74,8 +74,8 @@ public class Resource extends BaseREST implements org.gcube.gcat.api.interfaces.
|
|||
|
||||
@PATCH
|
||||
@Path("/{" + RESOURCE_ID_PARAMETER + "}")
|
||||
@Consumes(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
public String patch(@PathParam(ITEM_ID_PARAMETER) String itemID,
|
||||
@PathParam(RESOURCE_ID_PARAMETER) String resourceID, String json) {
|
||||
setCalledMethod("PATCH /" + COLLECTION + "/{" + RESOURCE_ID_PARAMETER + "}");
|
||||
|
|
|
@ -10,7 +10,6 @@ import javax.ws.rs.core.Response;
|
|||
import javax.ws.rs.core.Response.Status;
|
||||
import javax.xml.ws.WebServiceException;
|
||||
|
||||
import org.gcube.gcat.ResourceInitializer;
|
||||
import org.gcube.gcat.annotation.PURGE;
|
||||
import org.gcube.gcat.api.GCatConstants;
|
||||
import org.gcube.gcat.persistence.ckan.CKANPackageTrash;
|
||||
|
@ -23,7 +22,7 @@ public class Trash extends BaseREST implements org.gcube.gcat.api.interfaces.Tra
|
|||
|
||||
|
||||
@GET
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Override
|
||||
public String list(@QueryParam(GCatConstants.OWN_ONLY_QUERY_PARAMETER) @DefaultValue("true") Boolean ownOnly) throws WebServiceException {
|
||||
CKANPackageTrash ckanPackageTrash = new CKANPackageTrash();
|
||||
|
|
|
@ -10,7 +10,7 @@ import javax.ws.rs.PathParam;
|
|||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.gcube.gcat.ResourceInitializer;
|
||||
import org.gcube.gcat.api.GCatConstants;
|
||||
import org.gcube.gcat.persistence.ckan.CKANUser;
|
||||
|
||||
/**
|
||||
|
@ -26,14 +26,14 @@ public class User extends REST<CKANUser> implements org.gcube.gcat.api.interface
|
|||
}
|
||||
|
||||
@GET
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
public String list() {
|
||||
return super.list(-1, -1);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Consumes(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Override
|
||||
public Response create(String json) {
|
||||
return super.create(json);
|
||||
|
@ -41,7 +41,7 @@ public class User extends REST<CKANUser> implements org.gcube.gcat.api.interface
|
|||
|
||||
@GET
|
||||
@Path("/{" + USER_ID_PARAMETER + "}")
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Override
|
||||
public String read(@PathParam(USER_ID_PARAMETER) String username) {
|
||||
return super.read(username);
|
||||
|
@ -49,8 +49,8 @@ public class User extends REST<CKANUser> implements org.gcube.gcat.api.interface
|
|||
|
||||
@PUT
|
||||
@Path("/{" + USER_ID_PARAMETER + "}")
|
||||
@Consumes(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
@Override
|
||||
public String update(@PathParam(USER_ID_PARAMETER) String username, String json) {
|
||||
return super.update(username, json);
|
||||
|
|
Loading…
Reference in New Issue