diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/threads/ManageTimeSeriesThread.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/threads/ManageTimeSeriesThread.java index 4d3e435..bacf6f3 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/threads/ManageTimeSeriesThread.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/threads/ManageTimeSeriesThread.java @@ -181,7 +181,8 @@ public class ManageTimeSeriesThread extends Thread{ if(asList.get(0).getClass().equals(TimeSeriesBean.class)){ CustomField customAnnotation = field.getAnnotation(CustomField.class); - String resourceToAttachName = customAnnotation.key().replaceAll("\\s", "_") + CSV_FILE_FORMAT; + String resourceToAttachName = (productName + "_" + customAnnotation.key()).replaceAll("\\s", "_") + CSV_FILE_FORMAT; + String resourceToAttachDescription = productName + ":" + customAnnotation.key() + " time series"; logger.debug("A time series has been just found (from field " + customAnnotation.key() + ")"); File csvFile = CSVHelpers.listToCSV(asList); @@ -189,17 +190,17 @@ public class ManageTimeSeriesThread extends Thread{ if(csvFile != null){ // upload this file on ckan - CkanResourceBase ckanResource = uploadFileOnCatalogue(csvFile, packageName, catalogue, username, resourceToAttachName, customAnnotation.key() + " time series for this product", apiKeyUser); + CkanResourceBase ckanResource = uploadFileOnCatalogue(csvFile, packageName, catalogue, username, resourceToAttachName, resourceToAttachDescription, apiKeyUser); //upload this file on the folder of the vre (under .catalogue) and change the url of the resource if(ckanResource != null){ - ExternalFile createdFileOnWorkspace = uploadExternalFile(csvFolder, resourceToAttachName, customAnnotation.key() + " time series for this product", csvFile); + ExternalFile createdFileOnWorkspace = uploadExternalFile(csvFolder, resourceToAttachName, resourceToAttachDescription, csvFile); if(createdFileOnWorkspace != null){ String publicUrlToSetOnCkan = createdFileOnWorkspace.getPublicLink(true); logger.info("going to patch the created resource with id " + ckanResource.getId() + " with url " + publicUrlToSetOnCkan); - boolean updated = catalogue.patchResource(ckanResource.getId(), publicUrlToSetOnCkan, resourceToAttachName, customAnnotation.key() + " time series for this product", "", apiKeyUser); + boolean updated = catalogue.patchResource(ckanResource.getId(), publicUrlToSetOnCkan, resourceToAttachName, resourceToAttachDescription, "", apiKeyUser); if(updated) logger.info("Resource has been updated with the new url"); diff --git a/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JTests.java b/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JTests.java index 0c3a0f1..05dc4be 100644 --- a/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JTests.java +++ b/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JTests.java @@ -42,6 +42,7 @@ import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Status; import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Type_Fishery; import org.gcube.datacatalogue.ckanutillibrary.DataCatalogue; import org.gcube.datacatalogue.ckanutillibrary.DataCatalogueFactory; +import org.junit.Test; import org.slf4j.LoggerFactory; import com.fasterxml.jackson.core.JsonProcessingException; @@ -381,7 +382,7 @@ public class JTests { } - //@Test + // @Test public void sharedVREFolderWriteTest() throws Exception{ String token = ""; @@ -400,6 +401,10 @@ public class JTests { logger.debug("Catalogue folder retrieved " + catalogueFolder.getName()); + // WorkspaceItem stockFolder = catalogueFolder.find("stock"); + + // vreFolder.removeChild(stockFolder); + /** * Test is * .catalogue: