Item Corrections

This commit is contained in:
Fabio Sinibaldi 2021-11-10 14:35:41 +01:00
parent 44e057797c
commit f2ba354915
4 changed files with 33 additions and 33 deletions

View File

@ -1,6 +1,7 @@
package org.gcube.data.publishing.gCatFeeder.collectors.dm; package org.gcube.data.publishing.gCatFeeder.collectors.dm;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.Month;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.chrono.IsoChronology; import java.time.chrono.IsoChronology;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
@ -143,8 +144,8 @@ public class DMAlgorithmsInfoCollector implements DataCollector<InternalAlgorith
try{ try{
toSetCreationDate=LocalDateTime.parse(desc.getVersion(),versionDateParser); toSetCreationDate=LocalDateTime.parse(desc.getVersion(),versionDateParser);
}catch(Throwable t){ }catch(Throwable t){
log.debug("Version {} is not a date. Using Now as Creation date..",desc.getVersion()); log.debug("Version {} is not a date. Using 1900-01-01 as Creation date..",desc.getVersion());
toSetCreationDate = LocalDateTime.now(); toSetCreationDate = LocalDateTime.of(1900, Month.JANUARY,1,0,0);
} }
desc.setCreationDate(toSetCreationDate); desc.setCreationDate(toSetCreationDate);
@ -257,7 +258,7 @@ public class DMAlgorithmsInfoCollector implements DataCollector<InternalAlgorith
Matcher m=descriptionPattern.matcher(description); Matcher m=descriptionPattern.matcher(description);
if(m.find()) if(m.find())
return m.group(4); // group 0 == {...}, group 1 == Giancarlo Panichi, group 2 == giancarlo.panichi, group 4 == 2018/07/20 10:24 GMT return m.group(4); // group 0 == {...}, group 1 == Giancarlo Panichi, group 2 == giancarlo.panichi, group 4 == 2018/07/20 10:24 GMT
else return "n/a"; else return "n.d.";
} }
static final String getWPSBasePath() { static final String getWPSBasePath() {

View File

@ -60,11 +60,12 @@ public class GCatModel implements CatalogueFormatData {
public GCatModel(InternalAlgorithmDescriptor desc) { public GCatModel(InternalAlgorithmDescriptor desc) {
item=new CkanItem(); item=new CkanItem();
// item.setAuthor(desc.getAuthor()); item.setAuthor(desc.getAuthor().getFirstName()+" "+desc.getAuthor().getLastName());
item.setTitle(desc.getName()+" in "+ContextUtils.getCurrentScopeName()); item.setTitle(desc.getName()+" in "+ContextUtils.getCurrentScopeName());
item.setLicense_id("CC-BY-NC-SA-4.0"); item.setLicense_id("CC-BY-NC-SA-4.0");
// item.setMaintainer(desc.getMaintainer()); item.setMaintainer(desc.getMaintainer().getFirstName()+" "+desc.getMaintainer().getLastName());
item.setName(item.getTitle().toLowerCase().toLowerCase().replaceAll(" ", "_")); item.setName(item.getTitle().toLowerCase().toLowerCase().replaceAll(" ", "_"));
for(String tag:desc.getTags()) { for(String tag:desc.getTags()) {
item.getTags().add(new CkanItem.Tag(fixTag(tag))); item.getTags().add(new CkanItem.Tag(fixTag(tag)));

View File

@ -75,8 +75,8 @@ public class TranslationTest extends BaseCollectorTest{
@Test @Test
public void testEnvironment(){ public void testEnvironment(){
Assume.assumeTrue(isTestInfrastructureEnabled()); Assume.assumeTrue(isTestInfrastructureEnabled());
assertNotNull(DMAlgorithmsInfoCollector.getWPSBasePath()); //assertNotNull(DMAlgorithmsInfoCollector.getWPSBasePath());
assertNotNull(GCatModel.getItemUrl("fake")); //assertNotNull(GCatModel.getItemUrl("fake"));
System.out.println(getEnvironmentConfiguration().getCurrentConfiguration()); System.out.println(getEnvironmentConfiguration().getCurrentConfiguration());
} }
} }