starting integration #19991
This commit is contained in:
parent
98baf36d3e
commit
3533c69d96
|
@ -27,8 +27,6 @@
|
|||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="org.eclipse.jst.component.dependency"
|
||||
value="/WEB-INF/lib" />
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
|
|
|
@ -1,40 +1,46 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<wb-module deploy-name="geoportal-data-entry-app-1.0.0-SNAPSHOT">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -44,26 +50,30 @@
|
|||
<dependent-module archiveName="metadata-profile-form-builder-widget-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/metadata-profile-form-builder-widget/metadata-profile-form-builder-widget">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<property name="context-root" value="geoportal-data-entry-app"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</wb-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
8
pom.xml
8
pom.xml
|
@ -74,13 +74,13 @@
|
|||
<dependency>
|
||||
<groupId>com.github.gwtbootstrap</groupId>
|
||||
<artifactId>gwt-bootstrap</artifactId>
|
||||
<version>2.3.2.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>metadata-profile-form-builder-widget</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
|
@ -115,6 +115,12 @@
|
|||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- END FWS -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.application</groupId>
|
||||
<artifactId>geoportal-logic</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>gcube-widgets</artifactId>
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client;
|
||||
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ConstantsMPFormBuilder;
|
||||
|
||||
public class ConstantsGeoPortalDataEntryApp {
|
||||
|
||||
public static final String DATE_FORMAT = ConstantsMPFormBuilder.DATE_FORMAT;
|
||||
|
||||
public static final String TIME_FORMAT = ConstantsMPFormBuilder.TIME_FORMAT;
|
||||
}
|
|
@ -0,0 +1,247 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.server;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.application.geoportal.model.AccessPolicy;
|
||||
import org.gcube.application.geoportal.model.concessioni.Concessione;
|
||||
import org.gcube.application.geoportal.model.concessioni.RelazioneScavo;
|
||||
import org.gcube.application.geoportal.model.content.UploadedImage;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploaded;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||
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
|
||||
*/
|
||||
public class ConvertToServiceModel {
|
||||
|
||||
public static final DateFormat dateFormat = new SimpleDateFormat(ConstantsGeoPortalDataEntryApp.DATE_FORMAT+" "+ConstantsGeoPortalDataEntryApp.TIME_FORMAT);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ConvertToServiceModel.class);
|
||||
|
||||
/**
|
||||
* To concessione.
|
||||
*
|
||||
* @param gdb the gdb
|
||||
* @param user the user
|
||||
* @return the concessione
|
||||
*/
|
||||
public static Concessione toConcessione(GenericDatasetBean gdb, GCubeUser user) {
|
||||
|
||||
Map<String, List<String>> mapFields = gdb.getFormDataEntryFields();
|
||||
|
||||
Concessione concessione = new Concessione();
|
||||
|
||||
List<String> authors = mapFields.get("Autore");
|
||||
if(authors!=null) {
|
||||
concessione.setAuthors(authors);
|
||||
}
|
||||
|
||||
|
||||
//TODO
|
||||
//concessione.setCentroidLat(centroidLat);
|
||||
// concessione.setCentroidLong(centroidLong);
|
||||
|
||||
List<String> contributors = mapFields.get("Contributore");
|
||||
if(contributors!=null) {
|
||||
for (String contributor : contributors) {
|
||||
concessione.setContributore(contributor);
|
||||
}
|
||||
}
|
||||
|
||||
//concessione.setCreationTime(Instant.now());
|
||||
concessione.setCreationUser(user.getUsername());
|
||||
|
||||
//TODO
|
||||
// concessione.setDataFineScavo(dataFineScavo);
|
||||
// concessione.setDataInizioScavo(dataInizioScavo);
|
||||
|
||||
List<String> dataInizProgettoList = mapFields.get("Data inizio Progetto");
|
||||
if(dataInizProgettoList!=null && dataInizProgettoList.size()>0) {
|
||||
String inizioProgetto = dataInizProgettoList.get(0);
|
||||
Instant theIstant = toInstant(inizioProgetto);
|
||||
concessione.setDataInizioProgetto(theIstant);
|
||||
}
|
||||
|
||||
List<String> dataFineProgettoList = mapFields.get("Data fine Progetto");
|
||||
if(dataFineProgettoList!=null && dataFineProgettoList.size()>0) {
|
||||
String fineProgetto = dataFineProgettoList.get(0);
|
||||
Instant theIstant = toInstant(fineProgetto);
|
||||
concessione.setDataFineProgetto(theIstant);
|
||||
}
|
||||
|
||||
|
||||
List<String> descrizioneLst = mapFields.get("Descrizione del contenuto");
|
||||
if(descrizioneLst!=null && descrizioneLst.size()>0) {
|
||||
concessione.setDescrizioneContenuto(descrizioneLst.get(0));
|
||||
}
|
||||
|
||||
List<String> editors = mapFields.get("Editore");
|
||||
if(editors!=null) {
|
||||
for (String editor : editors) {
|
||||
concessione.setEditore(editor);
|
||||
}
|
||||
}
|
||||
|
||||
List<String> fontiFinanziamento = mapFields.get("Fonti del finanziamento");
|
||||
if(fontiFinanziamento!=null) {
|
||||
concessione.setFontiFinanziamento(fontiFinanziamento);
|
||||
}
|
||||
|
||||
List<String> licenzaLst = mapFields.get("Licenza");
|
||||
if(licenzaLst!=null && licenzaLst.size()>0) {
|
||||
//TODO FABIO
|
||||
//concessione.setLicenza()
|
||||
}
|
||||
|
||||
List<String> introduzioneLst = mapFields.get("Introduzione");
|
||||
if(introduzioneLst!=null && introduzioneLst.size()>0) {
|
||||
concessione.setIntroduzione(introduzioneLst.get(0));
|
||||
}
|
||||
|
||||
//TODO
|
||||
// concessione.setLastUpdateTime(lastUpdateTime);
|
||||
// concessione.setLastUpdateUser(lastUpdateUser);
|
||||
|
||||
List<String> nomeLst = mapFields.get("Nome del progetto");
|
||||
if(nomeLst!=null && nomeLst.size()>0) {
|
||||
concessione.setNome(nomeLst.get(0));
|
||||
}
|
||||
|
||||
List<String> paroleChiaveLibereLst = mapFields.get("Parola chiave a scelta libera");
|
||||
if(paroleChiaveLibereLst!=null){
|
||||
concessione.setParoleChiaveLibere(paroleChiaveLibereLst);
|
||||
}
|
||||
|
||||
List<String> setParoleChiaveICCDLst = mapFields.get("Parola chiave relativa alla cronologia");
|
||||
if(setParoleChiaveICCDLst!=null){
|
||||
concessione.setParoleChiaveICCD(paroleChiaveLibereLst);
|
||||
}
|
||||
|
||||
List<String> risorsaCorrelataLst = mapFields.get("Risorsa correlata");
|
||||
if(risorsaCorrelataLst!=null){
|
||||
concessione.setRisorseCorrelate(risorsaCorrelataLst);
|
||||
}
|
||||
|
||||
List<String> responsabileLst = mapFields.get("Responsabile");
|
||||
if(responsabileLst!=null && responsabileLst.size()>0){
|
||||
concessione.setResponsabile(responsabileLst.get(0));
|
||||
}
|
||||
|
||||
List<String> soggettoLst = mapFields.get("Soggetto");
|
||||
if(soggettoLst!=null){
|
||||
concessione.setSoggetto(soggettoLst);
|
||||
}
|
||||
|
||||
List<String> titolareCopyrightLst = mapFields.get("Titolare Copyright");
|
||||
if(titolareCopyrightLst!=null && titolareCopyrightLst.size()>0){
|
||||
concessione.setTitolareCopyright(titolareCopyrightLst.get(0));
|
||||
}
|
||||
|
||||
List<String> titolareLicenzaLst = mapFields.get("Titolare Licenza");
|
||||
if(titolareLicenzaLst!=null && titolareLicenzaLst.size()>0){
|
||||
concessione.setTitolareLicenza(titolareLicenzaLst.get(0));
|
||||
}
|
||||
|
||||
List<String> titolareDatiLst = mapFields.get("Titolare dei dati");
|
||||
if(titolareDatiLst!=null){
|
||||
concessione.setTitolari(titolareDatiLst);
|
||||
}
|
||||
|
||||
return concessione;
|
||||
|
||||
}
|
||||
|
||||
public static RelazioneScavo toRelazioneScavo(GenericDatasetBean gdb){
|
||||
|
||||
Map<String, List<String>> mapFields = gdb.getFormDataEntryFields();
|
||||
|
||||
RelazioneScavo relazioneScavo = new RelazioneScavo();
|
||||
|
||||
List<String> abstractLst = mapFields.get("Abstract");
|
||||
if(abstractLst!=null && abstractLst.size()>0) {
|
||||
relazioneScavo.setAbstractSection(abstractLst.get(0));
|
||||
}
|
||||
|
||||
List<String> responsabiliLst = mapFields.get("Responsabile del documento");
|
||||
if(responsabiliLst!=null) {
|
||||
relazioneScavo.setResponsabili(responsabiliLst);
|
||||
}
|
||||
|
||||
|
||||
List<String> licenzaIdList = mapFields.get("Licenza");
|
||||
if(licenzaIdList!=null && licenzaIdList.size()>0) {
|
||||
relazioneScavo.setLicenseID(licenzaIdList.get(0));
|
||||
}
|
||||
|
||||
//TODO
|
||||
//relazioneScavo.setCreationTime(creationTime);
|
||||
//TODO
|
||||
//relazioneScavo.setPolicy(policy);
|
||||
//TODO
|
||||
//Auto by library
|
||||
//relazioneScavo.setTitolo(titolo);
|
||||
|
||||
return relazioneScavo;
|
||||
}
|
||||
|
||||
public static UploadedImage toImmaginiRappresentative(GenericDatasetBean gdb){
|
||||
|
||||
Map<String, List<String>> mapFields = gdb.getFormDataEntryFields();
|
||||
|
||||
UploadedImage uplaodedImage = new UploadedImage();
|
||||
|
||||
List<String> titoloLst = mapFields.get("Titolo");
|
||||
if(titoloLst!=null && titoloLst.size()>0) {
|
||||
uplaodedImage.setTitolo(titoloLst.get(0));
|
||||
}
|
||||
|
||||
List<String> didascaliaLst = mapFields.get("Didascalia");
|
||||
if(didascaliaLst!=null && didascaliaLst.size()>0) {
|
||||
uplaodedImage.setDidascalia(didascaliaLst.get(0));
|
||||
}
|
||||
|
||||
|
||||
List<String> responsabileLst = mapFields.get("Responsabile");
|
||||
if(responsabileLst!=null) {
|
||||
uplaodedImage.setResponsabili(responsabileLst);
|
||||
}
|
||||
|
||||
//TODO???
|
||||
List<String> autoreLst = mapFields.get("Autore");
|
||||
if(autoreLst!=null) {
|
||||
|
||||
}
|
||||
|
||||
return uplaodedImage;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static Instant toInstant(String date) {
|
||||
Instant theInst = null;
|
||||
try {
|
||||
Date theDate = dateFormat.parse(date);
|
||||
theInst = theDate.toInstant();
|
||||
} catch (ParseException e) {
|
||||
LOG.error("No able to parse: "+date, e);
|
||||
}
|
||||
return theInst;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue