minor fix
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/ckan-util-library@163065 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e9122ea2a8
commit
6d8c9a22bb
|
@ -25,14 +25,14 @@ import eu.trentorise.opendata.jackan.model.CkanResource;
|
|||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public interface DataCatalogue {
|
||||
|
||||
|
||||
/**
|
||||
* Returns the statistics for this catalogue
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
Statistics getStatistics() throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the main landing pages for this catalogue (i.e. type, orgs, groups and items pages)
|
||||
* @return
|
||||
|
@ -67,7 +67,7 @@ public interface DataCatalogue {
|
|||
* @return a list of groups
|
||||
*/
|
||||
List<CkanGroup> getGroupsByUser(String username);
|
||||
|
||||
|
||||
/**
|
||||
* Returns a group given its name
|
||||
* @return return a {@link CkanGroup} or null if no group with this name exists
|
||||
|
@ -203,8 +203,8 @@ public interface DataCatalogue {
|
|||
String createCKanDatasetMultipleCustomFields(String apiKey, String title, String name, String organizationNameOrId, String author,
|
||||
String authorMail, String maintainer, String maintainerMail, long version, String description, String licenseId,
|
||||
List<String> tags, Map<String, List<String>> customFields, List<ResourceBean> resources, boolean setPublic) throws Exception;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Update a dataset with those information. The method allows to have multiple values for the same custom field key.
|
||||
* @param apiKey
|
||||
|
@ -402,7 +402,7 @@ public interface DataCatalogue {
|
|||
*/
|
||||
boolean assignDatasetToGroup(String groupNameOrId, String datasetNameOrId,
|
||||
String apiKey);
|
||||
|
||||
|
||||
/**
|
||||
* Assign a dataset to a group and the group's parents (if any)
|
||||
* @param groupNameOrId the id or the name of the destination group.
|
||||
|
@ -440,7 +440,7 @@ public interface DataCatalogue {
|
|||
* @return
|
||||
*/
|
||||
CkanDataset getDataset(String datasetId, String apiKey);
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve a ckan dataset given its id. The CkanClient is used, without api key. The result
|
||||
* is null also when the dataset is private.
|
||||
|
@ -491,16 +491,16 @@ public interface DataCatalogue {
|
|||
*/
|
||||
boolean patchResource(String resourceId, String url, String name, String description, String urlType, String apiKey);
|
||||
|
||||
/**
|
||||
* Patch a product with product id productId by using the couples in toChange.
|
||||
/** Patch a product with product id productId by using the couples in customFieldsToChange.
|
||||
* NOTE: only the specified custom fields will be changed. If a custom field with a given key
|
||||
* already exists, the new values are added at the end of the list.
|
||||
* already exists, and removeOld is set to false, the new values are added at the end of the list. Otherwise they are lost.
|
||||
* @param productId
|
||||
* @param apiKey
|
||||
* @param toChange
|
||||
* @return true on success, false otherwise
|
||||
* @param customFieldsToChange
|
||||
* @param removeOld
|
||||
* @return
|
||||
*/
|
||||
boolean patchProductCustomFields(String productId, String apiKey, Map<String, List<String>> customFieldsToChange);
|
||||
boolean patchProductCustomFields(String productId, String apiKey, Map<String, List<String>> customFieldsToChange, boolean removeOld);
|
||||
|
||||
/**
|
||||
* Remove a custom field in the product that has a given key and value. If more than ones are present, the first one is removed.
|
||||
|
@ -604,13 +604,13 @@ public interface DataCatalogue {
|
|||
* @return
|
||||
*/
|
||||
Map<String, Map<CkanOrganization, RolesCkanGroupOrOrg>>getUserRoleByOrganization(String username, String apiKey);
|
||||
|
||||
|
||||
/**
|
||||
* Check if the users of the current context need to be alerted from a post creation or not. Default is false.
|
||||
* @return a boolean value
|
||||
*/
|
||||
boolean isNotificationToUsersEnabled();
|
||||
|
||||
|
||||
/**
|
||||
* Check if the user identified by username has to be registered in other organizations with some role.
|
||||
* @param username
|
||||
|
@ -618,7 +618,7 @@ public interface DataCatalogue {
|
|||
* @param currentRole
|
||||
*/
|
||||
void assignRolesOtherOrganization(String username, String sourceOrganization, RolesCkanGroupOrOrg currentRole);
|
||||
|
||||
|
||||
/**
|
||||
* Search for a package through Solr
|
||||
* @param apiKey
|
||||
|
@ -628,7 +628,7 @@ public interface DataCatalogue {
|
|||
* @return a list of matching datasets
|
||||
*/
|
||||
List<CkanDataset> searchForPackage(String apiKey, String query, int start, int offset) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Search for a package through Solr in a given organization
|
||||
* @param apiKey
|
||||
|
@ -638,13 +638,13 @@ public interface DataCatalogue {
|
|||
* @return a list of matching datasets
|
||||
*/
|
||||
List<CkanDataset> searchForPackageInOrganization(String apiKey, String query, int start, int offset, String organization) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve the catalogue email
|
||||
* @return an email address for sending email to this catalogue
|
||||
*/
|
||||
String getCatalogueEmail();
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve a resource by id
|
||||
*/
|
||||
|
|
|
@ -1886,7 +1886,7 @@ public class DataCatalogueImpl implements DataCatalogue{
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CkanResource getResource(String id, String apiKey) {
|
||||
logger.info("Request ckan resource with id " + id);
|
||||
|
@ -2095,7 +2095,7 @@ public class DataCatalogueImpl implements DataCatalogue{
|
|||
|
||||
@Override
|
||||
public boolean patchProductCustomFields(String productId, String apiKey,
|
||||
Map<String, List<String>> customFieldsToChange) {
|
||||
Map<String, List<String>> customFieldsToChange, boolean removeOld) {
|
||||
|
||||
// checks
|
||||
checkNotNull(productId);
|
||||
|
@ -2144,7 +2144,8 @@ public class DataCatalogueImpl implements DataCatalogue{
|
|||
Set<String> uniqueValues = new HashSet<String>();
|
||||
|
||||
if(fromCKANCustomFields.containsKey(key))
|
||||
uniqueValues.addAll(fromCKANCustomFields.get(key));
|
||||
if(!removeOld)
|
||||
uniqueValues.addAll(fromCKANCustomFields.get(key));
|
||||
|
||||
uniqueValues.addAll(newValues);
|
||||
fromCKANCustomFields.put(key, new ArrayList<String>(uniqueValues));
|
||||
|
@ -2938,7 +2939,7 @@ public class DataCatalogueImpl implements DataCatalogue{
|
|||
|
||||
int numGroups = getGroups().size();
|
||||
int numOrganizations = getOrganizationsNames().size();
|
||||
|
||||
|
||||
logger.debug("SOLR address is " + SOLR_URL);
|
||||
HttpSolrServer solr = new HttpSolrServer(SOLR_URL);
|
||||
|
||||
|
@ -2983,13 +2984,13 @@ public class DataCatalogueImpl implements DataCatalogue{
|
|||
stats.setNumItems(numItems);
|
||||
stats.setNumOrganizations(numOrganizations);
|
||||
stats.setNumTypes(numTypes);
|
||||
|
||||
|
||||
return stats;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LandingPages getLandingPages() throws Exception {
|
||||
|
||||
|
||||
LandingPages landingPages = new LandingPages();
|
||||
landingPages.setUrlGroups(PORTLET_URL_FOR_SCOPE + "?path=/group/");
|
||||
landingPages.setUrlItems(PORTLET_URL_FOR_SCOPE + "?path=/dataset/");
|
||||
|
@ -3000,9 +3001,9 @@ public class DataCatalogueImpl implements DataCatalogue{
|
|||
|
||||
@Override
|
||||
public String getCatalogueEmail() {
|
||||
|
||||
|
||||
return CKAN_EMAIL;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -440,7 +440,7 @@ public class TestDataCatalogueLib {
|
|||
DataCatalogueImpl instance = factory.getUtilsPerScope(scope);
|
||||
Map<String, List<String>> customFieldsToChange = new HashMap<String, List<String>>();
|
||||
customFieldsToChange.put("Status", Arrays.asList("Pending"));
|
||||
instance.patchProductCustomFields("a-test-to-ignore", instance.getApiKeyFromUsername("costantino_perciante"), customFieldsToChange);
|
||||
instance.patchProductCustomFields("a-test-to-ignore", instance.getApiKeyFromUsername("costantino_perciante"), customFieldsToChange, false);
|
||||
}
|
||||
|
||||
//@Test
|
||||
|
|
Loading…
Reference in New Issue