fixed returns
This commit is contained in:
parent
303c092cfb
commit
7b21261ce6
|
@ -107,7 +107,7 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||||
public String read(String context) throws WebServiceException {
|
public Response read(String context) throws WebServiceException {
|
||||||
try {
|
try {
|
||||||
checkContext(context);
|
checkContext(context);
|
||||||
return read();
|
return read();
|
||||||
|
@ -119,12 +119,16 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String read() throws WebServiceException {
|
public Response read() throws WebServiceException {
|
||||||
try {
|
try {
|
||||||
ServiceCatalogueConfiguration catalogueConfiguration = CatalogueConfigurationFactory.getInstance();
|
ServiceCatalogueConfiguration catalogueConfiguration = CatalogueConfigurationFactory.getInstance();
|
||||||
String configuration = catalogueConfiguration.toJsonString();
|
String configuration = catalogueConfiguration.toJsonString();
|
||||||
logger.debug("Configuration in context {} is {}", catalogueConfiguration.getContext(), configuration);
|
logger.debug("Configuration in context {} is {}", catalogueConfiguration.getContext(), configuration);
|
||||||
return configuration;
|
ResponseBuilder responseBuilder = Response.status(Status.OK);
|
||||||
|
if(configuration!=null) {
|
||||||
|
responseBuilder.entity(configuration).type(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8);
|
||||||
|
}
|
||||||
|
return responseBuilder.build();
|
||||||
}catch (WebServiceException e) {
|
}catch (WebServiceException e) {
|
||||||
throw e;
|
throw e;
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
|
@ -148,14 +152,18 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String update(String json) throws WebServiceException {
|
public Response update(String json) throws WebServiceException {
|
||||||
try {
|
try {
|
||||||
ServiceCatalogueConfiguration catalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(json);
|
ServiceCatalogueConfiguration catalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(json);
|
||||||
checkContext(CURRENT_CONTEXT_PATH_PARAMETER);
|
checkContext(CURRENT_CONTEXT_PATH_PARAMETER);
|
||||||
catalogueConfiguration = CatalogueConfigurationFactory.createOrUpdate(catalogueConfiguration);
|
catalogueConfiguration = CatalogueConfigurationFactory.createOrUpdate(catalogueConfiguration);
|
||||||
String configuration = catalogueConfiguration.toJsonString();
|
String configuration = catalogueConfiguration.toJsonString();
|
||||||
logger.debug("Configuration in context {} has been updated to {}", catalogueConfiguration.getContext(), configuration);
|
logger.debug("Configuration in context {} has been updated to {}", catalogueConfiguration.getContext(), configuration);
|
||||||
return configuration;
|
ResponseBuilder responseBuilder = Response.status(Status.OK);
|
||||||
|
if(configuration!=null) {
|
||||||
|
responseBuilder.entity(configuration).type(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8);
|
||||||
|
}
|
||||||
|
return responseBuilder.build();
|
||||||
}catch (WebServiceException e) {
|
}catch (WebServiceException e) {
|
||||||
throw e;
|
throw e;
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
|
@ -166,7 +174,7 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf
|
||||||
@PATCH
|
@PATCH
|
||||||
@Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
@Consumes(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||||
public String patch(String context, String json) throws WebServiceException {
|
public Response patch(String context, String json) throws WebServiceException {
|
||||||
try {
|
try {
|
||||||
checkContext(context);
|
checkContext(context);
|
||||||
return patch(json);
|
return patch(json);
|
||||||
|
@ -178,7 +186,7 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String patch(String json) throws WebServiceException {
|
public Response patch(String json) throws WebServiceException {
|
||||||
try {
|
try {
|
||||||
ServiceCatalogueConfiguration catalogueConfiguration = CatalogueConfigurationFactory.getInstance();
|
ServiceCatalogueConfiguration catalogueConfiguration = CatalogueConfigurationFactory.getInstance();
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
@ -205,7 +213,11 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf
|
||||||
newCatalogueConfiguration = CatalogueConfigurationFactory.createOrUpdate(newCatalogueConfiguration);
|
newCatalogueConfiguration = CatalogueConfigurationFactory.createOrUpdate(newCatalogueConfiguration);
|
||||||
String ret = newCatalogueConfiguration.toJsonString();
|
String ret = newCatalogueConfiguration.toJsonString();
|
||||||
logger.debug("Configuration in context {} has been patched to {}", catalogueConfiguration.getContext(), ret);
|
logger.debug("Configuration in context {} has been patched to {}", catalogueConfiguration.getContext(), ret);
|
||||||
return ret;
|
ResponseBuilder responseBuilder = Response.status(Status.OK);
|
||||||
|
if(ret!=null) {
|
||||||
|
responseBuilder.entity(ret).type(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8);
|
||||||
|
}
|
||||||
|
return responseBuilder.build();
|
||||||
}catch (WebServiceException e) {
|
}catch (WebServiceException e) {
|
||||||
throw e;
|
throw e;
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
|
|
Loading…
Reference in New Issue