revert to geoportal-logic. integrated with geoportal-data-common
This commit is contained in:
parent
1aba0ad5c9
commit
80e5cfe44e
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/geoportal-data-entry-app-1.0.2-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/geoportal-data-entry-app-1.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/geoportal-data-entry-app-1.0.2-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
<classpathentry excluding="**" kind="src" output="target/geoportal-data-entry-app-1.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
@ -35,5 +35,5 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/geoportal-data-entry-app-1.0.2-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/geoportal-data-entry-app-1.1.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
jarsExcludedFromWebInfLib=
|
jarsExcludedFromWebInfLib=
|
||||||
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-1.0.2-SNAPSHOT
|
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-1.1.0-SNAPSHOT
|
||||||
warSrcDir=src/main/webapp
|
warSrcDir=src/main/webapp
|
||||||
warSrcDirIsOutput=false
|
warSrcDirIsOutput=false
|
||||||
|
|
14
pom.xml
14
pom.xml
|
@ -116,10 +116,22 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.application</groupId>
|
<groupId>org.gcube.application</groupId>
|
||||||
<artifactId>geoportal-client</artifactId>
|
<artifactId>geoportal-data-common</artifactId>
|
||||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.application</groupId>
|
||||||
|
<artifactId>geoportal-logic</artifactId>
|
||||||
|
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>servlet-api</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>gcube-widgets</artifactId>
|
<artifactId>gcube-widgets</artifactId>
|
||||||
|
|
|
@ -12,7 +12,11 @@
|
||||||
|
|
||||||
<inherits name="com.google.gwt.json.JSON" />
|
<inherits name="com.google.gwt.json.JSON" />
|
||||||
|
|
||||||
<inherits name='org.gcube.portlets.widgets.mpformbuilder.MetadataProfileFormBuilder' />
|
<inherits
|
||||||
|
name='org.gcube.portlets.widgets.mpformbuilder.MetadataProfileFormBuilder' />
|
||||||
|
|
||||||
|
<inherits name='org.gcube.application.geoportalcommon.GeoportalDataCommon' />
|
||||||
|
|
||||||
|
|
||||||
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
|
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
|
||||||
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
|
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
|
||||||
|
@ -20,7 +24,8 @@
|
||||||
<!-- Other module inherits -->
|
<!-- Other module inherits -->
|
||||||
|
|
||||||
<!-- Specify the app entry point class. -->
|
<!-- Specify the app entry point class. -->
|
||||||
<entry-point class='org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp' />
|
<entry-point
|
||||||
|
class='org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp' />
|
||||||
|
|
||||||
<!-- Specify the paths for translatable code -->
|
<!-- Specify the paths for translatable code -->
|
||||||
<source path='client' />
|
<source path='client' />
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEvent;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEventHandler;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.SaveGeonaDataFormsEvent;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.SaveGeonaDataFormsEvent;
|
||||||
|
@ -30,6 +31,7 @@ import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.user.client.Window;
|
import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
import com.google.gwt.user.client.ui.RootPanel;
|
import com.google.gwt.user.client.ui.RootPanel;
|
||||||
|
|
||||||
|
@ -98,7 +100,6 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
bindEvents();
|
bindEvents();
|
||||||
mainPanel.addFormPanel(geoNaMainForm);
|
mainPanel.addFormPanel(geoNaMainForm);
|
||||||
RootPanel.get(DIV_PORTLET_ID).add(mainPanel);
|
RootPanel.get(DIV_PORTLET_ID).add(mainPanel);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -263,6 +264,29 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final HorizontalPanel hpLoader = new HorizontalPanel();
|
||||||
|
final LoaderIcon lc = new LoaderIcon("Get link...");
|
||||||
|
hpLoader.add(lc);
|
||||||
|
modal.add(hpLoader);
|
||||||
|
GeoportalDataEntryServiceAsync.Util.getInstance().getLinksFor(result.getRecordId(), "concessione", new AsyncCallback<GeoNaItemRef>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
hpLoader.clear();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(GeoNaItemRef result) {
|
||||||
|
hpLoader.clear();
|
||||||
|
String htmlLink = "<div>Go to record: <a href="+result.getRestrictedLink().getShortURL()+" target=\"_blank\">"+result.getRestrictedLink().getShortURL()+"</a></div>";
|
||||||
|
HTML html = new HTML(htmlLink);
|
||||||
|
modal.add(html);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
//geoNaMainForm.enableButtonSave(true);
|
//geoNaMainForm.enableButtonSave(true);
|
||||||
//resetUI();
|
//resetUI();
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.gcube.portlets.user.geoportaldataentry.client;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
|
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
|
||||||
|
@ -18,4 +19,14 @@ public interface GeoportalDataEntryService extends RemoteService {
|
||||||
CommitReport saveGeonaDataForms(List<GeoNaFormDataObject> listGeonaFormObjects) throws Exception;
|
CommitReport saveGeonaDataForms(List<GeoNaFormDataObject> listGeonaFormObjects) throws Exception;
|
||||||
|
|
||||||
GeonaISConfig getGeonaInitConfig();
|
GeonaISConfig getGeonaInitConfig();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the links for.
|
||||||
|
*
|
||||||
|
* @param itemId the item id
|
||||||
|
* @param recordType the record type
|
||||||
|
* @return the links for
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
GeoNaItemRef getLinksFor(Long itemId, String recordType) throws Exception;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.gcube.portlets.user.geoportaldataentry.client;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
|
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
|
||||||
|
@ -39,4 +40,7 @@ public interface GeoportalDataEntryServiceAsync
|
||||||
|
|
||||||
|
|
||||||
void getGeonaInitConfig(AsyncCallback<GeonaISConfig> callback);
|
void getGeonaInitConfig(AsyncCallback<GeonaISConfig> callback);
|
||||||
|
|
||||||
|
|
||||||
|
void getLinksFor(Long itemId, String recordType, AsyncCallback<GeoNaItemRef> callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,11 +8,11 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.application.geoportal.common.model.legacy.AccessPolicy;
|
import org.gcube.application.geoportal.model.AccessPolicy;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
import org.gcube.application.geoportal.model.concessioni.Concessione;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
|
import org.gcube.application.geoportal.model.concessioni.LayerConcessione;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.RelazioneScavo;
|
import org.gcube.application.geoportal.model.concessioni.RelazioneScavo;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
|
import org.gcube.application.geoportal.model.content.UploadedImage;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
||||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||||
|
|
|
@ -6,15 +6,19 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.validation.ValidationException;
|
import org.gcube.application.geoportal.managers.ConcessioneManager;
|
||||||
|
import org.gcube.application.geoportal.managers.ManagerFactory;
|
||||||
import org.gcube.application.geoportal.client.legacy.ConcessioniManager;
|
import org.gcube.application.geoportal.model.InputStreamDescriptor;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
import org.gcube.application.geoportal.model.concessioni.Concessione;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.InputStreamDescriptor;
|
import org.gcube.application.geoportal.model.concessioni.LayerConcessione;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
|
import org.gcube.application.geoportal.model.concessioni.RelazioneScavo;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.RelazioneScavo;
|
import org.gcube.application.geoportal.model.content.UploadedImage;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
|
import org.gcube.application.geoportal.model.content.WorkspaceContent;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.report.PublicationReport;
|
import org.gcube.application.geoportal.model.fault.PublishException;
|
||||||
|
import org.gcube.application.geoportal.model.fault.ValidationException;
|
||||||
|
import org.gcube.application.geoportal.utils.Serialization;
|
||||||
|
import org.gcube.application.geoportalcommon.GeoportalCommon;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitle;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitle;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryService;
|
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryService;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
||||||
|
@ -31,6 +35,10 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The server side implementation of the RPC service.
|
* The server side implementation of the RPC service.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
|
*
|
||||||
|
* Dec 1, 2020
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implements GeoportalDataEntryService {
|
public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implements GeoportalDataEntryService {
|
||||||
|
@ -38,12 +46,18 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
public static final String GEONA_GENERIC_RESOURCE_SECONDARY_TYPE = "GEONA_GENERIC_RESOURCE_SECONDARY_TYPE";
|
public static final String GEONA_GENERIC_RESOURCE_SECONDARY_TYPE = "GEONA_GENERIC_RESOURCE_SECONDARY_TYPE";
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(GeoportalDataEntryServiceImpl.class);
|
private static final Logger LOG = LoggerFactory.getLogger(GeoportalDataEntryServiceImpl.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save geona data forms.
|
||||||
|
*
|
||||||
|
* @param listGeonaFormObjects the list geona form objects
|
||||||
|
* @return the commit report
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public CommitReport saveGeonaDataForms(List<GeoNaFormDataObject> listGeonaFormObjects) throws Exception {
|
public CommitReport saveGeonaDataForms(List<GeoNaFormDataObject> listGeonaFormObjects) throws Exception {
|
||||||
LOG.info("saveGeonaDataForms called");
|
LOG.info("saveGeonaDataForms called");
|
||||||
|
|
||||||
HashMap<ConcessioniFormCardTitle, List<GeoNaFormDataObject>> toMap =
|
HashMap<ConcessioniFormCardTitle, List<GeoNaFormDataObject>> toMap = new HashMap<ConcessioniFormCardTitle, List<GeoNaFormDataObject>>();
|
||||||
new HashMap<ConcessioniFormCardTitle, List<GeoNaFormDataObject>>();
|
|
||||||
|
|
||||||
for (GeoNaFormDataObject geoNaFormDataObject : listGeonaFormObjects) {
|
for (GeoNaFormDataObject geoNaFormDataObject : listGeonaFormObjects) {
|
||||||
|
|
||||||
|
@ -64,32 +78,32 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
|
|
||||||
GCubeUser user = SessionUtil.getCurrentUser(this.getThreadLocalRequest());
|
GCubeUser user = SessionUtil.getCurrentUser(this.getThreadLocalRequest());
|
||||||
|
|
||||||
ConcessioniManager manager = new ConcessioniManager();
|
ConcessioneManager manager;
|
||||||
Concessione concessione = null;
|
|
||||||
boolean registered = false;
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// Saving Data
|
// Saving Data
|
||||||
// Informazioni di Progetto
|
// Informazioni di Progetto
|
||||||
List<GeoNaFormDataObject> list = toMap.get(ConcessioniFormCardTitle.INFORMAZIONI_DI_PROGETTO);
|
List<GeoNaFormDataObject> list = toMap.get(ConcessioniFormCardTitle.INFORMAZIONI_DI_PROGETTO);
|
||||||
if (list == null || list.isEmpty() || list.get(0) == null || list.get(0).getListGDB() == null)
|
if (list == null || list.isEmpty() || list.get(0) == null || list.get(0).getListGDB() == null)
|
||||||
throw new Exception("Error: no data found for "+ConcessioniFormCardTitle.INFORMAZIONI_DI_PROGETTO.getTitle());
|
throw new Exception(
|
||||||
|
"Error: no data found for " + ConcessioniFormCardTitle.INFORMAZIONI_DI_PROGETTO.getTitle());
|
||||||
|
|
||||||
List<GenericDatasetBean> listGDB = list.get(0).getListGDB();
|
List<GenericDatasetBean> listGDB = list.get(0).getListGDB();
|
||||||
GenericDatasetBean idp = listGDB.get(0);
|
GenericDatasetBean idp = listGDB.get(0);
|
||||||
LOG.debug("\n\n");
|
LOG.debug("\n\n");
|
||||||
LOG.debug(ConcessioniFormCardTitle.INFORMAZIONI_DI_PROGETTO + " building with client obj: " + idp);
|
LOG.debug(ConcessioniFormCardTitle.INFORMAZIONI_DI_PROGETTO + " building with client obj: " + idp);
|
||||||
concessione = ConvertToServiceModel.toConcessione(idp, user);
|
Concessione concessione = ConvertToServiceModel.toConcessione(idp, user);
|
||||||
LOG.debug("Built " + ConcessioniFormCardTitle.INFORMAZIONI_DI_PROGETTO + " as server obj: " + concessione);
|
LOG.debug("Built " + ConcessioniFormCardTitle.INFORMAZIONI_DI_PROGETTO + " as server obj: " + concessione);
|
||||||
|
|
||||||
// saving into back-end
|
// saving into back-end
|
||||||
concessione = manager.registerNew(concessione);
|
manager = ManagerFactory.registerNew(concessione);
|
||||||
registered = true;
|
|
||||||
|
|
||||||
// RELAZIONE_DI_SCAVO
|
// RELAZIONE_DI_SCAVO
|
||||||
list = toMap.get(ConcessioniFormCardTitle.RELAZIONE_DI_SCAVO);
|
list = toMap.get(ConcessioniFormCardTitle.RELAZIONE_DI_SCAVO);
|
||||||
if (list == null || list.isEmpty() || list.get(0) == null || list.get(0).getListGDB() == null)
|
if (list == null || list.isEmpty() || list.get(0) == null || list.get(0).getListGDB() == null)
|
||||||
throw new Exception("Error: no data found for "+ConcessioniFormCardTitle.RELAZIONE_DI_SCAVO.getTitle());
|
throw new Exception(
|
||||||
|
"Error: no data found for " + ConcessioniFormCardTitle.RELAZIONE_DI_SCAVO.getTitle());
|
||||||
|
|
||||||
listGDB = list.get(0).getListGDB();
|
listGDB = list.get(0).getListGDB();
|
||||||
GenericDatasetBean rds = listGDB.get(0);
|
GenericDatasetBean rds = listGDB.get(0);
|
||||||
|
@ -105,11 +119,11 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
manager.setRelazioneScavo(relazioneDiScavo, isd);
|
manager.setRelazioneScavo(relazioneDiScavo, isd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// IMMAGINI_RAPPRESENTATIVE
|
// IMMAGINI_RAPPRESENTATIVE
|
||||||
list = toMap.get(ConcessioniFormCardTitle.IMMAGINI_RAPPRESENTATIVE);
|
list = toMap.get(ConcessioniFormCardTitle.IMMAGINI_RAPPRESENTATIVE);
|
||||||
if (list == null || list.isEmpty() || list.get(0) == null || list.get(0).getListGDB() == null)
|
if (list == null || list.isEmpty() || list.get(0) == null || list.get(0).getListGDB() == null)
|
||||||
throw new Exception("Error: no data found for "+ConcessioniFormCardTitle.IMMAGINI_RAPPRESENTATIVE.getTitle());
|
throw new Exception(
|
||||||
|
"Error: no data found for " + ConcessioniFormCardTitle.IMMAGINI_RAPPRESENTATIVE.getTitle());
|
||||||
|
|
||||||
List<GenericDatasetBean> imgRaprsLst = list.get(0).getListGDB();
|
List<GenericDatasetBean> imgRaprsLst = list.get(0).getListGDB();
|
||||||
for (GenericDatasetBean imgRapr : imgRaprsLst) {
|
for (GenericDatasetBean imgRapr : imgRaprsLst) {
|
||||||
|
@ -129,14 +143,17 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
// POSIZIONAMENTO_DELL_AREA_DI_INDAGINE
|
// POSIZIONAMENTO_DELL_AREA_DI_INDAGINE
|
||||||
list = toMap.get(ConcessioniFormCardTitle.POSIZIONAMENTO_DELL_AREA_DI_INDAGINE);
|
list = toMap.get(ConcessioniFormCardTitle.POSIZIONAMENTO_DELL_AREA_DI_INDAGINE);
|
||||||
if (list == null || list.isEmpty() || list.get(0) == null || list.get(0).getListGDB() == null)
|
if (list == null || list.isEmpty() || list.get(0) == null || list.get(0).getListGDB() == null)
|
||||||
throw new Exception("Error: no data found for "+ConcessioniFormCardTitle.POSIZIONAMENTO_DELL_AREA_DI_INDAGINE.getTitle());
|
throw new Exception("Error: no data found for "
|
||||||
|
+ ConcessioniFormCardTitle.POSIZIONAMENTO_DELL_AREA_DI_INDAGINE.getTitle());
|
||||||
|
|
||||||
listGDB = list.get(0).getListGDB();
|
listGDB = list.get(0).getListGDB();
|
||||||
GenericDatasetBean pad = listGDB.get(0);
|
GenericDatasetBean pad = listGDB.get(0);
|
||||||
LOG.debug("\n\n");
|
LOG.debug("\n\n");
|
||||||
LOG.debug(ConcessioniFormCardTitle.POSIZIONAMENTO_DELL_AREA_DI_INDAGINE+" building with client obj: "+pad);
|
LOG.debug(ConcessioniFormCardTitle.POSIZIONAMENTO_DELL_AREA_DI_INDAGINE + " building with client obj: "
|
||||||
|
+ pad);
|
||||||
LayerConcessione layerPad = ConvertToServiceModel.toLayerConcessione(pad);
|
LayerConcessione layerPad = ConvertToServiceModel.toLayerConcessione(pad);
|
||||||
LOG.debug("Built "+ConcessioniFormCardTitle.POSIZIONAMENTO_DELL_AREA_DI_INDAGINE+" as server obj: "+layerPad);
|
LOG.debug("Built " + ConcessioniFormCardTitle.POSIZIONAMENTO_DELL_AREA_DI_INDAGINE + " as server obj: "
|
||||||
|
+ layerPad);
|
||||||
for (FileUploaded fileUploaded : pad.getFilesUploaded()) {
|
for (FileUploaded fileUploaded : pad.getFilesUploaded()) {
|
||||||
LOG.debug("Adding uploaded file: " + fileUploaded.getFileName() + " to " + layerPad);
|
LOG.debug("Adding uploaded file: " + fileUploaded.getFileName() + " to " + layerPad);
|
||||||
FileInputStream fis = new FileInputStream(fileUploaded.getTempSystemPath());
|
FileInputStream fis = new FileInputStream(fileUploaded.getTempSystemPath());
|
||||||
|
@ -148,7 +165,8 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
// PIANTA_DI_FINE_SCAVO
|
// PIANTA_DI_FINE_SCAVO
|
||||||
list = toMap.get(ConcessioniFormCardTitle.PIANTA_DI_FINE_SCAVO);
|
list = toMap.get(ConcessioniFormCardTitle.PIANTA_DI_FINE_SCAVO);
|
||||||
if (list == null || list.isEmpty() || list.get(0) == null || list.get(0).getListGDB() == null)
|
if (list == null || list.isEmpty() || list.get(0) == null || list.get(0).getListGDB() == null)
|
||||||
throw new Exception("Error: no data found for "+ConcessioniFormCardTitle.PIANTA_DI_FINE_SCAVO.getTitle());
|
throw new Exception(
|
||||||
|
"Error: no data found for " + ConcessioniFormCardTitle.PIANTA_DI_FINE_SCAVO.getTitle());
|
||||||
|
|
||||||
listGDB = list.get(0).getListGDB();
|
listGDB = list.get(0).getListGDB();
|
||||||
GenericDatasetBean pfs = listGDB.get(0);
|
GenericDatasetBean pfs = listGDB.get(0);
|
||||||
|
@ -161,43 +179,49 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
FileInputStream fis = new FileInputStream(fileUploaded.getTempSystemPath());
|
FileInputStream fis = new FileInputStream(fileUploaded.getTempSystemPath());
|
||||||
InputStreamDescriptor isd = new InputStreamDescriptor(fis, fileUploaded.getFileName());
|
InputStreamDescriptor isd = new InputStreamDescriptor(fis, fileUploaded.getFileName());
|
||||||
// saving into back-end
|
// saving into back-end
|
||||||
manager.addPiantaScavo(layerPfs, isd);
|
manager.addPiantaFineScavo(layerPfs, isd);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Error on converting form data: ", e);
|
LOG.error("Error on converting form data: ", e);
|
||||||
throw new Exception("Error occurred on saving data, try again or contact the support. Error: "+e.getMessage());
|
throw new Exception(
|
||||||
|
"Error occurred on saving data, try again or contact the support. Error: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
// If true -> data are published into the SDI
|
||||||
|
Boolean publish = true;
|
||||||
|
Concessione registered = manager.commit(publish);
|
||||||
|
LOG.info("Registered: " + registered);
|
||||||
|
String link = null;
|
||||||
|
try {
|
||||||
|
link = ((WorkspaceContent) registered.getRelazioneScavo().getActualContent().get(0)).getLink();
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.warn("Not able to check public link ", e);
|
||||||
|
}
|
||||||
|
|
||||||
CommitReport cRep = null;
|
// String link = "toTest";
|
||||||
|
CommitReport cRep = new CommitReport();
|
||||||
if(registered) {
|
cRep.setRecordId(registered.getId());
|
||||||
PublicationReport report = manager.commitRegistered();
|
if (link != null) {
|
||||||
LOG.info("Registered: "+report);
|
|
||||||
|
|
||||||
cRep = new CommitReport();
|
|
||||||
cRep.setRecordId(report.getTheRecord().getId());
|
|
||||||
cRep.setReport(report.toString());
|
|
||||||
if(report.getTheRecord()!=null ) {
|
|
||||||
cRep.setState(STATE.OK);
|
cRep.setState(STATE.OK);
|
||||||
cRep.setMsg("Project saved successfully");
|
cRep.setMsg("Project saved successfully");
|
||||||
|
} else {
|
||||||
|
cRep.setState(STATE.WARN);
|
||||||
|
cRep.setMsg("Project saved with errors");
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
cRep.setState(STATE.ERROR);
|
|
||||||
cRep.setMsg("Project not saved correctly");
|
|
||||||
}
|
|
||||||
}else
|
|
||||||
throw new Exception("Sorry, the record has not been registred correclty. Try again");
|
|
||||||
|
|
||||||
return cRep;
|
return cRep;
|
||||||
} catch (ValidationException e1) {
|
} catch (ValidationException e1) {
|
||||||
LOG.error("Error on validating data: ", e1);
|
LOG.error("Error on validating data: ", e1);
|
||||||
throw new Exception("Error on validating data: ", e1);
|
throw new Exception("Error on validating data: " + Serialization.prettyPrint(e1.getReport()));
|
||||||
|
} catch (PublishException e2) {
|
||||||
|
LOG.error("Error on publishing data: ", e2);
|
||||||
|
throw new Exception("Error on publishing data: " + e2.getMessage());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Error on commiting data: ", e);
|
LOG.error("Error on commiting data: ", e);
|
||||||
throw new Exception("Error occurred on saving data, try again or contact the support. Error: "+e.getMessage());
|
throw new Exception(
|
||||||
|
"Error occurred on saving data, try again or contact the support. Error: " + e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
// if(manager!=null) {
|
// if(manager!=null) {
|
||||||
// try {
|
// try {
|
||||||
|
@ -208,8 +232,14 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the geona init config.
|
||||||
|
*
|
||||||
|
* @return the geona init config
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public GeonaISConfig getGeonaInitConfig() {
|
public GeonaISConfig getGeonaInitConfig() {
|
||||||
LOG.info("getConfig called");
|
LOG.info("getConfig called");
|
||||||
|
@ -231,8 +261,31 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
return configs;
|
return configs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the links for.
|
||||||
|
*
|
||||||
|
* @param itemId the item id
|
||||||
|
* @param recordType the record type
|
||||||
|
* @return the links for
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public GeoNaItemRef getLinksFor(Long itemId, String recordType) throws Exception {
|
||||||
|
LOG.info("getLinksFor called");
|
||||||
|
|
||||||
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
|
GeoportalCommon gc = new GeoportalCommon();
|
||||||
|
GeoNaItemRef item = new GeoNaItemRef(itemId, recordType);
|
||||||
|
item = gc.getPublicLinksFor(item);
|
||||||
|
LOG.info("Returning: " + item);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pretty print client data entry map.
|
||||||
|
*
|
||||||
|
* @param toMap the to map
|
||||||
|
*/
|
||||||
private void prettyPrintClientDataEntryMap(HashMap<ConcessioniFormCardTitle, List<GeoNaFormDataObject>> toMap) {
|
private void prettyPrintClientDataEntryMap(HashMap<ConcessioniFormCardTitle, List<GeoNaFormDataObject>> toMap) {
|
||||||
|
|
||||||
for (ConcessioniFormCardTitle theType : toMap.keySet()) {
|
for (ConcessioniFormCardTitle theType : toMap.keySet()) {
|
||||||
|
|
|
@ -12,7 +12,11 @@
|
||||||
|
|
||||||
<inherits name="com.google.gwt.json.JSON" />
|
<inherits name="com.google.gwt.json.JSON" />
|
||||||
|
|
||||||
<inherits name='org.gcube.portlets.widgets.mpformbuilder.MetadataProfileFormBuilder' />
|
<inherits
|
||||||
|
name='org.gcube.portlets.widgets.mpformbuilder.MetadataProfileFormBuilder' />
|
||||||
|
|
||||||
|
<inherits name='org.gcube.application.geoportalcommon.GeoportalDataCommon' />
|
||||||
|
|
||||||
|
|
||||||
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
|
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
|
||||||
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
|
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
|
||||||
|
@ -20,7 +24,8 @@
|
||||||
<!-- Other module inherits -->
|
<!-- Other module inherits -->
|
||||||
|
|
||||||
<!-- Specify the app entry point class. -->
|
<!-- Specify the app entry point class. -->
|
||||||
<entry-point class='org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp' />
|
<entry-point
|
||||||
|
class='org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp' />
|
||||||
|
|
||||||
<!-- Specify the paths for translatable code -->
|
<!-- Specify the paths for translatable code -->
|
||||||
<source path='client' />
|
<source path='client' />
|
||||||
|
|
Loading…
Reference in New Issue