minor fixes

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@134967 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-11-28 13:14:23 +00:00
parent 817eb34a01
commit 68998f3577
2 changed files with 11 additions and 5 deletions

View File

@ -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");

View File

@ -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: