diff --git a/.settings/com.gwtplugins.gdt.eclipse.core.prefs b/.settings/com.gwtplugins.gdt.eclipse.core.prefs
index 3f6f7f3..0fd92a7 100644
--- a/.settings/com.gwtplugins.gdt.eclipse.core.prefs
+++ b/.settings/com.gwtplugins.gdt.eclipse.core.prefs
@@ -1,5 +1,5 @@
eclipse.preferences.version=1
jarsExcludedFromWebInfLib=
-lastWarOutDir=/home/francesco/git/geoportal-data-entry-app/target/geoportal-data-entry-app-1.0.0-SNAPSHOT
+lastWarOutDir=/home/francesco-mangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-1.0.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false
diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
index e41db7d..ee3adf4 100644
--- a/.settings/org.eclipse.wst.common.component
+++ b/.settings/org.eclipse.wst.common.component
@@ -47,9 +47,6 @@
-
- uses
-
diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml
index 265a820..d5270ce 100644
--- a/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ b/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -3,4 +3,5 @@
+
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java
index d04c5fd..5ec2a36 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java
@@ -10,5 +10,4 @@ public class ConstantsGeoPortalDataEntryApp {
public static final String HOURS_MINUTES_SEPARATOR = ConstantsMPFormBuilder.HOURS_MINUTES_SEPARATOR;
- public static final String FILE_UPLOADED_SESSION_ATTR = ConstantsMPFormBuilder.FILE_UPLOADED_SESSION_ATTR;
}
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java
index 33d1c8f..2c3b46d 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java
@@ -77,20 +77,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
@Override
public void onSuccess(List result) {
orderedCards = setGeoNaFormsOrder(result);
-
//ordered values
buildNewCards(orderedCards);
- /*for (GeoNaFormCardModel geonaForm : orderedCards) {
- CreateMetadataForm baseForm = new CreateMetadataForm(Arrays.asList(geonaForm.getMetadataProfileBean()),appManagerBus);
- geonaForm.setMetadataForm(baseForm);
- String key = geonaForm.getMetadataProfileBean().getType();
- if(geonaForm.getFormCardTitle()!=null) {
- key = geonaForm.getFormCardTitle().getTitle();
- }
- geoNaMainForm.addForm(key, geonaForm);
- mapForms.put(key, geonaForm);
- }
- mainPanel.setLoaderVisible("", false);*/
}
@Override
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/ConvertToServiceModel.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/ConvertToServiceModel.java
index a058694..fd4e676 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/ConvertToServiceModel.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/ConvertToServiceModel.java
@@ -2,7 +2,8 @@ package org.gcube.portlets.user.geoportaldataentry.server;
import java.text.ParseException;
import java.text.SimpleDateFormat;
-import java.time.Instant;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -19,19 +20,30 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-// TODO: Auto-generated Javadoc
/**
* The Class ConvertToServiceModel.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
- * Oct 19, 2020
+ * Oct 21, 2020
*/
public class ConvertToServiceModel {
/** The Constant LOG. */
private static final Logger LOG = LoggerFactory.getLogger(ConvertToServiceModel.class);
+ public static final String HOURS_MINUTES_SEPARATOR = ConstantsGeoPortalDataEntryApp.HOURS_MINUTES_SEPARATOR;
+
+ public static final String DATE_FORMAT = ConstantsGeoPortalDataEntryApp.DATE_FORMAT;
+
+ public static final String TIME_FORMAT = ConstantsGeoPortalDataEntryApp.TIME_FORMAT;
+
+// public static final String DATE_FORMAT = "yyyy-MM-dd";
+//
+// public static final String HOURS_MINUTES_SEPARATOR = ":";
+//
+// public static final String TIME_FORMAT = "HH"+HOURS_MINUTES_SEPARATOR+"mm";
+
/**
* To concessione.
@@ -64,15 +76,15 @@ public class ConvertToServiceModel {
List dataInizProgettoList = mapFields.get("Data inizio Progetto");
if(dataInizProgettoList!=null && dataInizProgettoList.size()>0) {
String inizioProgetto = dataInizProgettoList.get(0);
- Instant theIstant = toInstant(inizioProgetto);
- concessione.setDataInizioProgetto(theIstant);
+ LocalDateTime theLDT = toLocalDateTime(inizioProgetto);
+ concessione.setDataInizioProgetto(theLDT);
}
List dataFineProgettoList = mapFields.get("Data fine Progetto");
if(dataFineProgettoList!=null && dataFineProgettoList.size()>0) {
String fineProgetto = dataFineProgettoList.get(0);
- Instant theIstant = toInstant(fineProgetto);
- concessione.setDataFineProgetto(theIstant);
+ LocalDateTime theLDT = toLocalDateTime(fineProgetto);
+ concessione.setDataFineProgetto(theLDT);
}
@@ -286,28 +298,42 @@ public class ConvertToServiceModel {
return layerConcessione;
}
+
/**
- * To instant.
+ * To local date time.
*
* @param date the date
- * @return the instant
+ * @return the local date time
*/
- public static Instant toInstant(String date) {
- Instant theInst = null;
+ public static LocalDateTime toLocalDateTime(String date) {
+ LocalDateTime theLocalDT = null;
try {
date = date.trim();
SimpleDateFormat dateFormat = null;
- if(date.contains(ConstantsGeoPortalDataEntryApp.HOURS_MINUTES_SEPARATOR)) {
- dateFormat = new SimpleDateFormat(ConstantsGeoPortalDataEntryApp.DATE_FORMAT+" "+ConstantsGeoPortalDataEntryApp.TIME_FORMAT);
+ if(date.contains(HOURS_MINUTES_SEPARATOR)) {
+ dateFormat = new SimpleDateFormat(DATE_FORMAT+" "+TIME_FORMAT);
}else
- dateFormat = new SimpleDateFormat(ConstantsGeoPortalDataEntryApp.DATE_FORMAT);
-
+ dateFormat = new SimpleDateFormat(DATE_FORMAT);
+
Date theDate = dateFormat.parse(date);
- theInst = theDate.toInstant();
+ theLocalDT = convertToLocalDateTimeViaInstant(theDate);
} catch (ParseException e) {
LOG.error("No able to parse: "+date, e);
}
- return theInst;
+ return theLocalDT;
+ }
+
+
+ /**
+ * Convert to local date time via instant.
+ *
+ * @param dateToConvert the date to convert
+ * @return the local date time
+ */
+ public static LocalDateTime convertToLocalDateTimeViaInstant(Date dateToConvert) {
+ return dateToConvert.toInstant()
+ .atZone(ZoneId.systemDefault())
+ .toLocalDateTime();
}
}
diff --git a/src/test/java/org/gcube/portlets/user/geoportaldataentry/client/TestClass.java b/src/test/java/org/gcube/portlets/user/geoportaldataentry/client/TestClass.java
index a669fe5..0422679 100644
--- a/src/test/java/org/gcube/portlets/user/geoportaldataentry/client/TestClass.java
+++ b/src/test/java/org/gcube/portlets/user/geoportaldataentry/client/TestClass.java
@@ -1,6 +1,6 @@
package org.gcube.portlets.user.geoportaldataentry.client;
-import java.time.Instant;
+import java.time.LocalDateTime;
import org.gcube.portlets.user.geoportaldataentry.server.ConvertToServiceModel;
@@ -9,11 +9,15 @@ public class TestClass {
public static void main(String[] args) {
- Instant instant = ConvertToServiceModel.toInstant("2020-10-01 10:20");
- System.out.println(instant.toString());
+ LocalDateTime ldt = ConvertToServiceModel.toLocalDateTime("2020-10-01 10:20");
+ System.out.println(ldt.toString());
String latitudine = "-899.2986";
- System.out.println(latitudine.matches("^[-]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$"));
+ //System.out.println(latitudine.matches("^[-]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$"));
+
+
+ String longitude = "0";
+ System.out.println(longitude.matches("\\s*[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$"));
}
diff --git a/src/test/resources/.gitignore b/src/test/resources/.gitignore
index d49a204..bd6e80c 100644
--- a/src/test/resources/.gitignore
+++ b/src/test/resources/.gitignore
@@ -6,3 +6,10 @@
/log4j.properties
/pred4s.gcubekey
/preprod.gcubekey
+/CNR.it.gcubekey
+/EUBrazilOpenBio.gcubekey
+/Ecosystem.gcubekey
+/FARM.gcubekey
+/ISTI.gcubekey
+/d4science.research-infrastructures.eu.gcubekey
+/howto.txt