ServiceCatalogueConfiguration class provided as argument

This commit is contained in:
Luca Frosini 2024-03-27 12:00:25 +01:00
parent 3c8932cd1f
commit 07fb1e4213
2 changed files with 5 additions and 5 deletions

View File

@ -222,7 +222,7 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf
// @AuthorizationControl(allowedRoles={Role.CATALOGUE_MANAGER}, exception=NotAuthorizedException.class)
public Response create(String json) throws WebServiceException {
try {
ServiceCatalogueConfiguration catalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(json);
ServiceCatalogueConfiguration catalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(json, ServiceCatalogueConfiguration.class);
checkContext(CURRENT_CONTEXT_PATH_PARAMETER, catalogueConfiguration);
String ret = createOrUpdate(catalogueConfiguration);
ResponseBuilder responseBuilder = Response.status(Status.CREATED);
@ -352,7 +352,7 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf
@OperationId("Create or Update")
public String createOrUpdate(@PathParam(CONTEXT_FULLNAME_PARAMETER) String context, String json) throws WebServiceException {
try {
ServiceCatalogueConfiguration catalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(json);
ServiceCatalogueConfiguration catalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(json, ServiceCatalogueConfiguration.class);
checkContext(context, catalogueConfiguration);
return createOrUpdate(catalogueConfiguration);
}catch (WebApplicationException e) {
@ -365,7 +365,7 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf
@Override
public Response update(String json) throws WebServiceException {
try {
ServiceCatalogueConfiguration catalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(json);
ServiceCatalogueConfiguration catalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(json, ServiceCatalogueConfiguration.class);
checkContext(CURRENT_CONTEXT_PATH_PARAMETER);
catalogueConfiguration = CatalogueConfigurationFactory.createOrUpdate(catalogueConfiguration);
String configuration = catalogueConfiguration.toJsonString();
@ -451,7 +451,7 @@ public class Configuration extends BaseREST implements org.gcube.gcat.api.interf
configuration.set(fieldName, node.get(fieldName));
}
ServiceCatalogueConfiguration newCatalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(configuration);
ServiceCatalogueConfiguration newCatalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(configuration, ServiceCatalogueConfiguration.class);
newCatalogueConfiguration = CatalogueConfigurationFactory.createOrUpdate(newCatalogueConfiguration);
String ret = newCatalogueConfiguration.toJsonString();
logger.debug("Configuration in context {} has been patched to {}", catalogueConfiguration.getContext(), ret);

View File

@ -74,7 +74,7 @@ public class GCoreISConfigurationProxyTest extends ContextTest {
String context = SecretManagerProvider.instance.get().getContext();
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(DEVVRE_CONFIG_JSON);
String json = new BufferedReader(new InputStreamReader(inputStream)).lines().collect(Collectors.joining("\n"));
ServiceCatalogueConfiguration catalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(json);
ServiceCatalogueConfiguration catalogueConfiguration = ServiceCatalogueConfiguration.getServiceCatalogueConfiguration(json, ServiceCatalogueConfiguration.class);
GCoreISConfigurationProxy gCoreISConfigurationProxy = new GCoreISConfigurationProxy(context);
gCoreISConfigurationProxy.setCatalogueConfiguration(catalogueConfiguration);
gCoreISConfigurationProxy.createOnIS();