#22838 added a mock configuration

This commit is contained in:
Francesco Mangiacrapa 2022-02-17 10:50:05 +01:00
parent 361a1dffcb
commit 35dd97843b
6 changed files with 511 additions and 345 deletions

View File

@ -0,0 +1,2 @@
disabled=06target
eclipse.preferences.version=1

View File

@ -5,10 +5,13 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.1.0-SNAPSHOT] - 2021-06-14
## [v1.1.0-SNAPSHOT] - 2022-01-27
**New Features**
[#21643] Integrated with the content-moderator-system facilities
* [#21643] Integrated with the content-moderator-system facilities
* [#22838] Integrated the collection provided by gCat to read the service configurations
## [v1.0.3] - 2022-01-21

View File

@ -10,6 +10,7 @@ import java.util.Map;
import javax.ws.rs.WebApplicationException;
import javax.xml.ws.WebServiceException;
import org.gcube.datacatalogue.utillibrary.shared.Configuration;
import org.gcube.gcat.api.moderation.CMItemStatus;
import org.gcube.gcat.api.moderation.Moderated;
import org.gcube.gcat.client.Group;
@ -27,6 +28,7 @@ import org.slf4j.LoggerFactory;
public class GCatCaller {
private String catalogueURL;
private Configuration serviceConfiguration;
private static final Logger LOG = LoggerFactory.getLogger(GCatCaller.class);
@ -193,7 +195,8 @@ public class GCatCaller {
new Item().delete(datasetName, purge);
return;
}
/**
* Gets the list items for CM status.
*
@ -285,4 +288,25 @@ public class GCatCaller {
return new Item().list(queryParams);
}
/**
* Gets the configuration.
*
* @param reload the reload
* @return the configuration
*/
public Configuration getConfiguration(boolean reload) {
LOG.debug("getConfiguration called");
LOG.info("Calling get configuration");
if(reload || serviceConfiguration==null) {
//Must be loa
LOG.warn("\n\n\nI'M USING A MOCK CONFIGURATION\n\n\n\n");
serviceConfiguration = new Configuration();
}
return serviceConfiguration;
}
}

View File

@ -77,12 +77,20 @@ public interface DataCatalogue {
String getUriResolverUrl();
/**
* Return the manage product property.
* Return the manage product property (used in the GRSF[-ADMIN] contexts).
*
* @return the manage product property
*/
boolean isManageProductEnabled();
/**
* Checks if is moderation enabled.
*
* @param reloadConfig the reload config from service
* @return true, if is moderation enabled
*/
boolean isModerationEnabled(boolean reloadConfig);
/**
* Return the catalogue portlet for this context(i.e. scope)
*
@ -332,6 +340,7 @@ public interface DataCatalogue {
* @param organizationName the organization name
* @param username the username
* @return String the id of the resource on success, null otherwise
* @throws Exception the exception
*/
String addResourceToDataset(ResourceBean resourceBean, String organizationName, String username) throws Exception;
@ -339,7 +348,7 @@ public interface DataCatalogue {
* Remove the resource with id resourceId from dataset in which it is.
*
* @param resourceId the resource id
* @param username the username
* @param username the username
* @return true on success, false otherwise.
* @throws Exception the exception
*/
@ -408,9 +417,9 @@ public interface DataCatalogue {
* false, the new values are added at the end of the list. Otherwise they are
* lost.
*
* @param productId the product id
* @param customFieldsToChange the custom fields to change
* @param removeOld the remove old
* @param username the username
* @param sourceOrganization the source organization
* @param currentRole the current role
* @return true, if successful
*/
// boolean patchProductCustomFields(String productId, Map<String, List<String>> customFieldsToChange,
@ -440,4 +449,6 @@ public interface DataCatalogue {
*/
void assignRolesOtherOrganization(String username, String sourceOrganization, RolesCkanGroupOrOrg currentRole);
}

View File

@ -0,0 +1,16 @@
package org.gcube.datacatalogue.utillibrary.shared;
//THIS IS A MOCK
public class Configuration {
boolean moderationEnabled = true;
public Configuration(){
}
public boolean isModerationEnabled() {
return moderationEnabled;
}
}