merged with branch task #20210

This commit is contained in:
Francesco Mangiacrapa 2020-12-01 18:15:13 +01:00
parent 053bb4d72d
commit 66f34a7390
15 changed files with 401 additions and 284 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/geoportal-data-entry-app-1.0.1-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>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/geoportal-data-entry-app-1.0.1-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>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@ -35,5 +35,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/geoportal-data-entry-app-1.0.1-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/geoportal-data-entry-app-1.1.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -1,129 +1,10 @@
<?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"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<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"/>
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-1.0.0-SNAPSHOT/WEB-INF/classes"/>
</wb-module>
</project-modules>

View File

@ -3,5 +3,5 @@
<installed facet="jst.web" version="2.3"/>
<installed facet="com.gwtplugins.gwt.facet" version="1.0"/>
<installed facet="java" version="1.7"/>
<installed facet="jst.jaxrs" version="2.0"/>
<installed facet="jst.jaxrs" version="1.1"/>
</faceted-project>

View File

@ -11,6 +11,27 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
[#20063] Fixes for data-entry components
## [v1.1.0-SNAPSHOT] - 2020-12-1
#### Enhancements
[#20210] Updating required for data entry facility after the first feedback by domain experts
## [v1.0.2-SNAPSHOT] - 2020-11-09
#### Bug fixes
[#20092] Repeatible form: validate the card after the create event is fired
## [v1.0.1] - 2020-11-04
#### Bug fixes
[#20063] Fixes for data-entry components
## [v1.0.0] - 2020-10-07
[#19916] First release

View File

@ -14,7 +14,7 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>geoportal-data-entry-app</artifactId>
<packaging>war</packaging>
<version>1.0.1</version>
<version>1.1.0-SNAPSHOT</version>
<name>GeoPortal Data Entry App</name>
<description>The GeoPortal Data Entry App is an application to build the web forms for data entries needed to GeoNa project</description>
<scm>
@ -114,7 +114,12 @@
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<!-- END FWS -->
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-data-common</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-logic</artifactId>

View File

@ -12,7 +12,11 @@
<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.dark.Dark'/> -->
@ -20,7 +24,8 @@
<!-- Other module inherits -->
<!-- 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 -->
<source path='client' />

View File

@ -1,40 +1,88 @@
package org.gcube.portlets.user.geoportaldataentry.client;
/**
* The Enum ConcessioniFormCardTitle.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 30, 2020
*/
public enum ConcessioniFormCardTitle {
INFORMAZIONI_DI_PROGETTO("Informazioni", "Informazioni di Progetto", 1, false),
RELAZIONE_DI_SCAVO("Relazione di Scavo", "Relazione di Scavo", 2, false),
IMMAGINI_RAPPRESENTATIVE("Immagini Rappresentative", "Immagini Rappresentative", 3, true),
POSIZIONAMENTO_DELL_AREA_DI_INDAGINE("Posizionamento", "Posizionamento dell'Area di Indagine", 4, false),
PIANTA_DI_FINE_SCAVO("Pianta di Fine Scavo", "Pianta di Fine Scavo", 5, true);
INFORMAZIONI_DI_PROGETTO("Informazioni", "Informazioni di Progetto", 1, false, null),
RELAZIONE_DI_SCAVO("Relazione di Scavo", "Relazione di Scavo", 2, false, null),
IMMAGINI_RAPPRESENTATIVE("Immagini Rappresentative", "Immagini Rappresentative", 3, true, 8),
POSIZIONAMENTO_DELL_AREA_DI_INDAGINE("Posizionamento", "Posizionamento dell'Area di Indagine", 4, false, null),
PIANTA_DI_FINE_SCAVO("Pianta di Fine Scavo", "Pianta di Fine Scavo", 5, true, null);
private String key;
private String title;
private Integer order;
private boolean internalRepeatibleForm;
private Integer maxFormRepeatability;
private ConcessioniFormCardTitle(String key, String title, int order, boolean internalRepeatibleForm) {
/**
* Instantiates a new concessioni form card title.
*
* @param key the key
* @param title the title
* @param order the order
* @param internalRepeatibleForm the internal repeatible form
* @param maxFormRepeatability the max form repeatability
*/
private ConcessioniFormCardTitle(String key, String title, int order, boolean internalRepeatibleForm, Integer maxFormRepeatability) {
this.key = key;
this.title = title;
this.order = order;
this.internalRepeatibleForm = internalRepeatibleForm;
this.maxFormRepeatability = maxFormRepeatability;
}
/**
* Gets the key.
*
* @return the key
*/
public String getKey() {
return key;
}
/**
* Gets the title.
*
* @return the title
*/
public String getTitle() {
return title;
}
/**
* Gets the order.
*
* @return the order
*/
public Integer getOrder() {
return order;
}
/**
* Checks if is internal repeatible form.
*
* @return true, if is internal repeatible form
*/
public boolean isInternalRepeatibleForm() {
return internalRepeatibleForm;
}
/**
* Gets the max form repeatability.
*
* @return the max form repeatability
*/
public Integer getMaxFormRepeatability() {
return maxFormRepeatability;
}
}

View File

@ -7,6 +7,7 @@ import java.util.LinkedHashMap;
import java.util.List;
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.CreateNewProjectEventHandler;
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.user.client.Window;
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.RootPanel;
@ -98,7 +100,6 @@ public class GeoPortalDataEntryApp implements EntryPoint {
bindEvents();
mainPanel.addFormPanel(geoNaMainForm);
RootPanel.get(DIV_PORTLET_ID).add(mainPanel);
}
@ -127,7 +128,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
for (GeoNaFormCardModel geonaForm : orderedCards) {
//TODO TO TEST
//if(geonaForm.getFormCardTitle().equals(ConcessioniFormCardTitle.RELAZIONE_DI_SCAVO)){
//if(geonaForm.getFormCardTitle().equals(ConcessioniFormCardTitle.IMMAGINI_RAPPRESENTATIVE)){
CreateMetadataForm baseForm = new CreateMetadataForm(Arrays.asList(geonaForm.getMetadataProfileBean()),appManagerBus);
geonaForm.setMetadataForm(baseForm);
@ -263,6 +264,29 @@ public class GeoPortalDataEntryApp implements EntryPoint {
}catch (Exception e) {
// 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);
//resetUI();

View File

@ -2,6 +2,7 @@ package org.gcube.portlets.user.geoportaldataentry.client;
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.GeoNaFormDataObject;
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
@ -18,4 +19,14 @@ public interface GeoportalDataEntryService extends RemoteService {
CommitReport saveGeonaDataForms(List<GeoNaFormDataObject> listGeonaFormObjects) throws Exception;
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;
}

View File

@ -2,6 +2,7 @@ package org.gcube.portlets.user.geoportaldataentry.client;
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.GeoNaFormDataObject;
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
@ -39,4 +40,7 @@ public interface GeoportalDataEntryServiceAsync
void getGeonaInitConfig(AsyncCallback<GeonaISConfig> callback);
void getLinksFor(Long itemId, String recordType, AsyncCallback<GeoNaItemRef> callback);
}

View File

@ -10,9 +10,11 @@ import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Tab;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.Window;
/**
@ -44,6 +46,8 @@ public class MetadataFormCard {
private HandlerManager appManagerBus;
private Integer maxFormRepeatability;
/**
* The Class MetadataFormCardEventHandler.
*
@ -108,8 +112,9 @@ public class MetadataFormCard {
this.geonaFormModel = geonaFormModel;
this.appManagerBus = appManagerBus;
this.repeatible = geonaFormModel.getFormCardTitle().isInternalRepeatibleForm();
this.maxFormRepeatability = geonaFormModel.getFormCardTitle().getMaxFormRepeatability()!=null?geonaFormModel.getFormCardTitle().getMaxFormRepeatability():Integer.MAX_VALUE;
this.buildCard(geonaFormModel.getMetadataForm());
geonaFormModel.getMetadataForm().addListener(formCardEventHandler);
//geonaFormModel.getMetadataForm().addListener(formCardEventHandler);
}
/**
@ -127,8 +132,14 @@ public class MetadataFormCard {
@Override
public void onClick(ClickEvent event) {
if(listForms.size() < maxFormRepeatability) {
CreateMetadataForm newForm = new CreateMetadataForm(createMetadataForm.getMetadataProfiles(),appManagerBus);
//newForm.addListener(formCardEventHandler);
addNewForm(newForm);
}else
Window.alert("Maximun number of data reached for "+geonaFormModel.getFormCardTitle().getTitle());
//newForm.getCreateButton().setFocus(true);
}
});
@ -162,6 +173,8 @@ public class MetadataFormCard {
}
});
}
newForm.addListener(formCardEventHandler);
}
/**
@ -190,9 +203,12 @@ public class MetadataFormCard {
*/
public boolean validateForm() {
for (CreateMetadataForm createMetadataForm : listForms) {
if(!createMetadataForm.isFormDataValid())
boolean isFormDataValid = createMetadataForm.isFormDataValid();
GWT.log("Is form data valid: "+isFormDataValid);
if(!isFormDataValid) {
return false;
}
}
return true;
}
@ -209,6 +225,7 @@ public class MetadataFormCard {
}
else {
tab.setIcon(IconType.MINUS_SIGN);
tab.asWidget().getElement().removeClassName("green-text");
tab.asWidget().getElement().addClassName("red-text");
}
@ -226,6 +243,7 @@ public class MetadataFormCard {
}
else {
tab.setIcon(IconType.MINUS_SIGN);
tab.asWidget().getElement().removeClassName("red-text");
tab.asWidget().getElement().addClassName("red-text");
}
}

View File

@ -140,13 +140,13 @@ public class ConvertToServiceModel {
}
List<String> titolareCopyrightLst = mapFields.get("Titolare Copyright");
if(titolareCopyrightLst!=null && titolareCopyrightLst.size()>0){
concessione.setTitolareCopyright(titolareCopyrightLst.get(0));
if(titolareCopyrightLst!=null){
concessione.setTitolareCopyright(titolareCopyrightLst);
}
List<String> titolareLicenzaLst = mapFields.get("Titolare Licenza");
if(titolareLicenzaLst!=null && titolareLicenzaLst.size()>0){
concessione.setTitolareLicenza(titolareLicenzaLst.get(0));
if(titolareLicenzaLst!=null){
concessione.setTitolareLicenza(titolareLicenzaLst);
}
List<String> titolareDatiLst = mapFields.get("Titolare dei dati");
@ -256,6 +256,16 @@ public class ConvertToServiceModel {
//TODO
}
List<String> politicaDiAccessoLst = mapFields.get("Politica di accesso");
if(politicaDiAccessoLst!=null && politicaDiAccessoLst.size()>0) {
try {
AccessPolicy ap = AccessPolicy.valueOf(politicaDiAccessoLst.get(0));
uplaodedImage.setPolicy(ap);
}catch (Exception e) {
LOG.warn("I cannot cast "+politicaDiAccessoLst.get(0) +" to "+AccessPolicy.values(),e);
}
}
List<String> licenzaIdList = mapFields.get("ID Licenza");
if(licenzaIdList!=null && licenzaIdList.size()>0) {
uplaodedImage.setLicenseID(licenzaIdList.get(0));
@ -312,6 +322,11 @@ public class ConvertToServiceModel {
layerConcessione.setScalaAcquisizione(scalaAcquisizioneLst.get(0));
}
List<String> licenzaIdList = mapFields.get("ID Licenza");
if(licenzaIdList!=null && licenzaIdList.size()>0) {
layerConcessione.setLicenseID(licenzaIdList.get(0));
}
List<String> autoreLst = mapFields.get("Autore");
if(autoreLst!=null) {
layerConcessione.setAuthors(autoreLst);

View File

@ -17,6 +17,8 @@ import org.gcube.application.geoportal.model.content.WorkspaceContent;
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.GeoportalDataEntryService;
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
@ -33,6 +35,10 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
/**
* The server side implementation of the RPC service.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Dec 1, 2020
*/
@SuppressWarnings("serial")
public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implements GeoportalDataEntryService {
@ -40,12 +46,18 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
public static final String GEONA_GENERIC_RESOURCE_SECONDARY_TYPE = "GEONA_GENERIC_RESOURCE_SECONDARY_TYPE";
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
public CommitReport saveGeonaDataForms(List<GeoNaFormDataObject> listGeonaFormObjects) throws Exception {
LOG.info("saveGeonaDataForms called");
HashMap<ConcessioniFormCardTitle, List<GeoNaFormDataObject>> toMap =
new HashMap<ConcessioniFormCardTitle, List<GeoNaFormDataObject>>();
HashMap<ConcessioniFormCardTitle, List<GeoNaFormDataObject>> toMap = new HashMap<ConcessioniFormCardTitle, List<GeoNaFormDataObject>>();
for (GeoNaFormDataObject geoNaFormDataObject : listGeonaFormObjects) {
@ -67,13 +79,15 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
GCubeUser user = SessionUtil.getCurrentUser(this.getThreadLocalRequest());
ConcessioneManager manager;
try {
// Saving Data
// 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)
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();
GenericDatasetBean idp = listGDB.get(0);
@ -88,7 +102,8 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
// RELAZIONE_DI_SCAVO
list = toMap.get(ConcessioniFormCardTitle.RELAZIONE_DI_SCAVO);
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();
GenericDatasetBean rds = listGDB.get(0);
@ -104,11 +119,11 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
manager.setRelazioneScavo(relazioneDiScavo, isd);
}
// IMMAGINI_RAPPRESENTATIVE
list = toMap.get(ConcessioniFormCardTitle.IMMAGINI_RAPPRESENTATIVE);
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();
for (GenericDatasetBean imgRapr : imgRaprsLst) {
@ -128,14 +143,17 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
// 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)
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();
GenericDatasetBean pad = listGDB.get(0);
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);
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()) {
LOG.debug("Adding uploaded file: " + fileUploaded.getFileName() + " to " + layerPad);
FileInputStream fis = new FileInputStream(fileUploaded.getTempSystemPath());
@ -147,7 +165,8 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
// 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)
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();
GenericDatasetBean pfs = listGDB.get(0);
@ -164,7 +183,8 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
}
} catch (Exception 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 {
@ -186,8 +206,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
if (link != null) {
cRep.setState(STATE.OK);
cRep.setMsg("Project saved successfully");
}
else {
} else {
cRep.setState(STATE.WARN);
cRep.setMsg("Project saved with errors");
}
@ -201,7 +220,8 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
throw new Exception("Error on publishing data: " + e2.getMessage());
} catch (Exception 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 {
// if(manager!=null) {
// try {
@ -212,8 +232,14 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
//
// }
}
}
/**
* Gets the geona init config.
*
* @return the geona init config
*/
@Override
public GeonaISConfig getGeonaInitConfig() {
LOG.info("getConfig called");
@ -235,8 +261,31 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
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) {
for (ConcessioniFormCardTitle theType : toMap.keySet()) {

View File

@ -8,17 +8,15 @@ import java.io.Serializable;
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 21, 2020
* Nov 30, 2020
*/
public class CommitReport implements Serializable {
/**
*
*/
private static final long serialVersionUID = -9519707669761939L;
/**
* The Enum STATE.
*
@ -26,11 +24,14 @@ public class CommitReport implements Serializable{
*
* Oct 21, 2020
*/
public enum STATE{ERROR, WARN, OK, UNKNOWN}
public enum STATE {
ERROR, WARN, OK, UNKNOWN
}
public STATE state = STATE.UNKNOWN;
public long recordId;
public String msg;
public String report;
/**
* Instantiates a new commit report.
@ -45,16 +46,16 @@ public class CommitReport implements Serializable{
* @param state the state
* @param recordId the record id
* @param msg the msg
* @param report the report
*/
public CommitReport(STATE state, long recordId, String msg) {
public CommitReport(STATE state, long recordId, String msg, String report) {
super();
this.state = state;
this.recordId = recordId;
this.msg = msg;
this.report = report;
}
/**
* Gets the state.
*
@ -82,6 +83,24 @@ public class CommitReport implements Serializable{
return recordId;
}
/**
* Gets the report.
*
* @return the report
*/
public String getReport() {
return report;
}
/**
* Sets the report.
*
* @param report the new report
*/
public void setReport(String report) {
this.report = report;
}
/**
* Sets the record id.
*
@ -109,10 +128,10 @@ public class CommitReport implements Serializable{
this.msg = msg;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
@ -123,8 +142,11 @@ public class CommitReport implements Serializable{
builder.append(recordId);
builder.append(", msg=");
builder.append(msg);
builder.append(", report=");
builder.append(report);
builder.append("]");
return builder.toString();
}
}

View File

@ -12,6 +12,20 @@
<inherits name="com.google.gwt.json.JSON" />
<inherits
name='org.gcube.portlets.widgets.mpformbuilder.MetadataProfileFormBuilder' />
<inherits name='org.gcube.application.geoportalcommon.GeoportalDataCommon' />
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<!--<inherits name='com.google.gwt.user.theme.standard.Standard' /> -->
<inherits name="com.github.gwtbootstrap.Bootstrap" />
<inherits name="com.google.gwt.json.JSON" />
<inherits name='org.gcube.portlets.widgets.mpformbuilder.MetadataProfileFormBuilder' />
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->