Managed min/max form repeatability
This commit is contained in:
parent
3b8883b1fa
commit
11f751e96c
15
pom.xml
15
pom.xml
|
@ -68,6 +68,14 @@
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- ASM required for GWT 2.9-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.ow2.asm</groupId>
|
||||||
|
<artifactId>asm</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
<version>7.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- needed to compile with gwt > 2.7 -->
|
<!-- needed to compile with gwt > 2.7 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>xml-apis</groupId>
|
<groupId>xml-apis</groupId>
|
||||||
|
@ -87,13 +95,6 @@
|
||||||
<version>${gwtVersion}</version>
|
<version>${gwtVersion}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- REMOVE THIS -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.ow2.asm</groupId>
|
|
||||||
<artifactId>asm</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
<version>7.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.gwt</groupId>
|
<groupId>com.google.gwt</groupId>
|
||||||
<artifactId>gwt-servlet</artifactId>
|
<artifactId>gwt-servlet</artifactId>
|
||||||
|
|
|
@ -229,9 +229,6 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
// TWICE BECAUSE THE MAIN PANEL COULD BE NULL BEFORE
|
// TWICE BECAUSE THE MAIN PANEL COULD BE NULL BEFORE
|
||||||
setListDocumentConfig(listDocumentConfigs);
|
setListDocumentConfig(listDocumentConfigs);
|
||||||
|
|
||||||
// if (dataEntryProjectCreated)
|
|
||||||
// mainTabPanel.setLoaderVisible("Loading...", true);
|
|
||||||
|
|
||||||
geoNaMainForm = new GeonaDataEntryMainForm(appManagerBus);
|
geoNaMainForm = new GeonaDataEntryMainForm(appManagerBus);
|
||||||
mainTabPanel.addFormPanel(geoNaMainForm);
|
mainTabPanel.addFormPanel(geoNaMainForm);
|
||||||
|
|
||||||
|
@ -311,12 +308,15 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setListDocumentConfig(List<DocumentConfigDV> listDocumentConfigs) {
|
private synchronized void setListDocumentConfig(List<DocumentConfigDV> listDocumentConfigs) {
|
||||||
GWT.log("Setting setListDocumentConfig: " + listDocumentConfigs);
|
GWT.log("Setting setListDocumentConfig: " + listDocumentConfigs);
|
||||||
if (listDocumentConfigs != null) {
|
if (listDocumentConfigs != null) {
|
||||||
|
|
||||||
if (mainTabPanel != null) {
|
if (mainTabPanel != null) {
|
||||||
mainTabPanel.setListDocumentConfig(listDocumentConfigs);
|
//Just to be sure that its set once
|
||||||
|
if(mainTabPanel.getListDocumentConfig()==null) {
|
||||||
|
mainTabPanel.setListDocumentConfig(listDocumentConfigs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -364,7 +364,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
numberOfCards = 0;
|
numberOfCards = 0;
|
||||||
expectedCards = config.getGcubeProfiles().size();
|
expectedCards = config.getGcubeProfiles().size();
|
||||||
GWT.log("expectedCards are: " + expectedCards);
|
GWT.log("expectedCards are: " + expectedCards);
|
||||||
TreeMap<Integer, GeoNaFormCardModel> treemapOrderedGeoNaProfiles = new TreeMap<Integer, GeoNaFormCardModel>();
|
TreeMap<Integer, GeoNaFormCardModel> treemapOrderedGNAProfiles = new TreeMap<Integer, GeoNaFormCardModel>();
|
||||||
|
|
||||||
for (int i = 0; i < expectedCards; i++) {
|
for (int i = 0; i < expectedCards; i++) {
|
||||||
GcubeProfileDV gcubeProfiles = config.getGcubeProfiles().get(i);
|
GcubeProfileDV gcubeProfiles = config.getGcubeProfiles().get(i);
|
||||||
|
@ -394,19 +394,19 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
maxOccurs = maxOccurs <= 0 ? Integer.MAX_VALUE : maxOccurs;
|
maxOccurs = maxOccurs <= 0 ? Integer.MAX_VALUE : maxOccurs;
|
||||||
|
|
||||||
// TODO MUST BE MANAGED MIN_OCCURS
|
// TODO MUST BE MANAGED MIN_OCCURS
|
||||||
ConcessioniFormCardTitle cct = new ConcessioniFormCardTitle(
|
ProjectFormCard cct = new ProjectFormCard(
|
||||||
gcubeProfiles.getSectionName(), gcubeProfiles.getSectionTitle(), order,
|
gcubeProfiles.getSectionName(), gcubeProfiles.getSectionTitle(), order,
|
||||||
maxOccurs > 1, minOccurs, maxOccurs);
|
maxOccurs > 1, minOccurs, maxOccurs);
|
||||||
GeoNaFormCardModel geonaForm = new GeoNaFormCardModel(metaDataProfileBean, null, cct,
|
GeoNaFormCardModel geonaForm = new GeoNaFormCardModel(metaDataProfileBean, null, cct,
|
||||||
gcubeProfiles);
|
gcubeProfiles);
|
||||||
|
|
||||||
treemapOrderedGeoNaProfiles.put(order, geonaForm);
|
treemapOrderedGNAProfiles.put(order, geonaForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getNumberOfCards() == expectedCards) {
|
if (getNumberOfCards() == expectedCards) {
|
||||||
mainTabPanel.setLoaderVisible("Loading...", false);
|
mainTabPanel.setLoaderVisible("Loading...", false);
|
||||||
// ordered values
|
// ordered values
|
||||||
Collection<GeoNaFormCardModel> gnaCardsModels = treemapOrderedGeoNaProfiles.values();
|
Collection<GeoNaFormCardModel> gnaCardsModels = treemapOrderedGNAProfiles.values();
|
||||||
GWT.log("TreMap values: " + gnaCardsModels);
|
GWT.log("TreMap values: " + gnaCardsModels);
|
||||||
orderedCards.addAll(gnaCardsModels);
|
orderedCards.addAll(gnaCardsModels);
|
||||||
mapGcubeProfilePerItemType.put(dcDV.getItemType(),
|
mapGcubeProfilePerItemType.put(dcDV.getItemType(),
|
||||||
|
@ -434,15 +434,15 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
for (GeoNaFormCardModel geonaForm : orderedCards) {
|
for (GeoNaFormCardModel geonaForm : orderedCards) {
|
||||||
|
|
||||||
// TODO TO TEST
|
// TODO TO TEST
|
||||||
// if(geonaForm.getFormCardTitle().equals(ConcessioniFormCardTitle.IMMAGINI_RAPPRESENTATIVE)){
|
// if(geonaForm.getFormCardTitle().equals(ProjectFormCard.IMMAGINI_RAPPRESENTATIVE)){
|
||||||
|
|
||||||
GWT.log("Adding card: " + geonaForm.getFormCardTitle());
|
GWT.log("Adding card: " + geonaForm.getFormCard());
|
||||||
CreateMetadataForm baseForm = new CreateMetadataForm(Arrays.asList(geonaForm.getMetadataProfileBean()),
|
CreateMetadataForm baseForm = new CreateMetadataForm(Arrays.asList(geonaForm.getMetadataProfileBean()),
|
||||||
appManagerBus, operation);
|
appManagerBus, operation);
|
||||||
geonaForm.setMetadataForm(baseForm);
|
geonaForm.setMetadataForm(baseForm);
|
||||||
String key = geonaForm.getMetadataProfileBean().getType();
|
String key = geonaForm.getMetadataProfileBean().getType();
|
||||||
if (geonaForm.getFormCardTitle() != null) {
|
if (geonaForm.getFormCard() != null) {
|
||||||
key = geonaForm.getFormCardTitle().getTitle();
|
key = geonaForm.getFormCard().getTitle();
|
||||||
}
|
}
|
||||||
geoNaMainForm.addForm(key, geonaForm);
|
geoNaMainForm.addForm(key, geonaForm);
|
||||||
mapForms.put(key, geonaForm);
|
mapForms.put(key, geonaForm);
|
||||||
|
@ -603,7 +603,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
// means the form was not submitted
|
// means the form was not submitted
|
||||||
if (savedMap.size() == 0) {
|
if (savedMap.size() == 0) {
|
||||||
|
|
||||||
DialogConfirm confirm = new DialogConfirm(null, "Creating a New Project...",
|
DialogConfirm confirm = new DialogConfirm(null, "Creating New Project...",
|
||||||
"The current project (is not saved) and will be lost. Confirm?");
|
"The current project (is not saved) and will be lost. Confirm?");
|
||||||
|
|
||||||
confirm.getYesButton().addClickHandler(new ClickHandler() {
|
confirm.getYesButton().addClickHandler(new ClickHandler() {
|
||||||
|
@ -625,7 +625,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
// buildNewCards(orderedCards, OPERATION.NEW);
|
// buildNewCards(orderedCards, OPERATION.NEW);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
DialogConfirm confirm = new DialogConfirm(null, "Creating a New Project...",
|
DialogConfirm confirm = new DialogConfirm(null, "Creating New Project...",
|
||||||
"The data entry form/s will be cleaned. Confirm?");
|
"The data entry form/s will be cleaned. Confirm?");
|
||||||
|
|
||||||
confirm.getYesButton().addClickHandler(new ClickHandler() {
|
confirm.getYesButton().addClickHandler(new ClickHandler() {
|
||||||
|
|
|
@ -1,37 +1,38 @@
|
||||||
package org.gcube.portlets.user.geoportaldataentry.client;
|
package org.gcube.portlets.user.geoportaldataentry.client;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Enum ConcessioniFormCardTitle.
|
* The Class ProjectFormCard.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
* Nov 30, 2020
|
* Mar 4, 2022
|
||||||
*/
|
*/
|
||||||
public class ConcessioniFormCardTitle {
|
public class ProjectFormCard {
|
||||||
|
|
||||||
private String key;
|
private String key;
|
||||||
private String title;
|
private String title; //is the profile title (read from geoportal config)
|
||||||
private Integer order;
|
private Integer order;
|
||||||
private boolean internalRepeatibleForm;
|
private boolean internalRepeatibleForm;
|
||||||
private Integer maxFormRepeatability;
|
private Integer maxFormRepeatability;
|
||||||
private Integer minFormRepeatability;
|
private Integer minFormRepeatability;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new concessioni form card title.
|
* Instantiates a new project form card.
|
||||||
*
|
*
|
||||||
* @param key the key
|
* @param key the key
|
||||||
* @param title the title
|
* @param title the title
|
||||||
* @param order the order
|
* @param order the order
|
||||||
* @param internalRepeatibleForm the internal repeatible form
|
* @param internalRepeatibleForm the internal repeatible form
|
||||||
|
* @param minFormRepeatability the min form repeatability
|
||||||
* @param maxFormRepeatability the max form repeatability
|
* @param maxFormRepeatability the max form repeatability
|
||||||
*/
|
*/
|
||||||
public ConcessioniFormCardTitle(String key, String title, int order, boolean internalRepeatibleForm,
|
public ProjectFormCard(String key, String title, int order, boolean internalRepeatibleForm,
|
||||||
Integer minFormRepeatability, Integer maxFormRepeatability) {
|
Integer minFormRepeatability, Integer maxFormRepeatability) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.order = order;
|
this.order = order;
|
||||||
this.minFormRepeatability = minFormRepeatability;
|
|
||||||
this.internalRepeatibleForm = internalRepeatibleForm;
|
this.internalRepeatibleForm = internalRepeatibleForm;
|
||||||
|
this.minFormRepeatability = minFormRepeatability;
|
||||||
this.maxFormRepeatability = maxFormRepeatability;
|
this.maxFormRepeatability = maxFormRepeatability;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,10 +81,20 @@ public class ConcessioniFormCardTitle {
|
||||||
return maxFormRepeatability;
|
return maxFormRepeatability;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the min form repeatability.
|
||||||
|
*
|
||||||
|
* @return the min form repeatability
|
||||||
|
*/
|
||||||
public Integer getMinFormRepeatability() {
|
public Integer getMinFormRepeatability() {
|
||||||
return minFormRepeatability;
|
return minFormRepeatability;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the min form repeatability.
|
||||||
|
*
|
||||||
|
* @param minFormRepeatability the new min form repeatability
|
||||||
|
*/
|
||||||
public void setMinFormRepeatability(Integer minFormRepeatability) {
|
public void setMinFormRepeatability(Integer minFormRepeatability) {
|
||||||
this.minFormRepeatability = minFormRepeatability;
|
this.minFormRepeatability = minFormRepeatability;
|
||||||
}
|
}
|
|
@ -34,6 +34,8 @@ import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.IconSize;
|
import com.github.gwtbootstrap.client.ui.constants.IconSize;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.core.client.Scheduler;
|
||||||
|
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.event.dom.client.KeyPressEvent;
|
import com.google.gwt.event.dom.client.KeyPressEvent;
|
||||||
|
@ -488,6 +490,7 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setListDocumentConfig(List<DocumentConfigDV> listDocumentConfig) {
|
public void setListDocumentConfig(List<DocumentConfigDV> listDocumentConfig) {
|
||||||
|
GWT.log("Setting listDocumentConfig: "+listDocumentConfig);
|
||||||
this.listDocumentConfig = listDocumentConfig;
|
this.listDocumentConfig = listDocumentConfig;
|
||||||
ddCreateNewProject.clear();
|
ddCreateNewProject.clear();
|
||||||
for (DocumentConfigDV documentConfigDV : listDocumentConfig) {
|
for (DocumentConfigDV documentConfigDV : listDocumentConfig) {
|
||||||
|
@ -511,11 +514,30 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
|
|
||||||
ddCreateNewProject.add(link);
|
ddCreateNewProject.add(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//IF one type of document is available, fire CreateNewProjectEvent(documentConfigDV));
|
||||||
|
if(listDocumentConfig.size()==1) {
|
||||||
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
GWT.log("One Config loaded. Firing CreateNewProjectEvent");
|
||||||
|
appManagerBus.fireEvent(new CreateNewProjectEvent(listDocumentConfig.get(0)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPageHeader(DocumentConfigDV dcDV) {
|
public void setPageHeader(DocumentConfigDV dcDV) {
|
||||||
this.pageHeaderDataEntry.setText("");
|
this.pageHeaderDataEntry.setText("");
|
||||||
this.pageHeaderDataEntry.setSubtext("New: "+dcDV.getItemType());
|
this.pageHeaderDataEntry.setSubtext("New: "+dcDV.getItemType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DocumentConfigDV> getListDocumentConfig() {
|
||||||
|
return listDocumentConfig;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.gcube.portlets.user.geoportaldataentry.client.ui.card;
|
package org.gcube.portlets.user.geoportaldataentry.client.ui.card;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportalconfig.GcubeProfileDV;
|
import org.gcube.application.geoportalcommon.shared.geoportalconfig.GcubeProfileDV;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitle;
|
import org.gcube.portlets.user.geoportaldataentry.client.ProjectFormCard;
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
|
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ public class GeoNaFormCardModel {
|
||||||
|
|
||||||
private MetaDataProfileBean metadataProfileBean;
|
private MetaDataProfileBean metadataProfileBean;
|
||||||
private CreateMetadataForm metadataForm;
|
private CreateMetadataForm metadataForm;
|
||||||
private ConcessioniFormCardTitle formCardTitle; // matching with metadata profile type
|
private ProjectFormCard formCard; // matching with metadata profile
|
||||||
private GcubeProfileDV gcubeProfile;
|
private GcubeProfileDV gcubeProfile;
|
||||||
|
|
||||||
public GeoNaFormCardModel() {
|
public GeoNaFormCardModel() {
|
||||||
|
@ -17,11 +17,11 @@ public class GeoNaFormCardModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public GeoNaFormCardModel(MetaDataProfileBean metadataProfileBean, CreateMetadataForm metadataForm,
|
public GeoNaFormCardModel(MetaDataProfileBean metadataProfileBean, CreateMetadataForm metadataForm,
|
||||||
ConcessioniFormCardTitle formCardTitle, GcubeProfileDV gcubeProfile) {
|
ProjectFormCard formCard, GcubeProfileDV gcubeProfile) {
|
||||||
super();
|
super();
|
||||||
this.metadataProfileBean = metadataProfileBean;
|
this.metadataProfileBean = metadataProfileBean;
|
||||||
this.metadataForm = metadataForm;
|
this.metadataForm = metadataForm;
|
||||||
this.formCardTitle = formCardTitle;
|
this.formCard = formCard;
|
||||||
this.gcubeProfile = gcubeProfile;
|
this.gcubeProfile = gcubeProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,12 +41,12 @@ public class GeoNaFormCardModel {
|
||||||
this.metadataForm = metadataForm;
|
this.metadataForm = metadataForm;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConcessioniFormCardTitle getFormCardTitle() {
|
public ProjectFormCard getFormCard() {
|
||||||
return formCardTitle;
|
return formCard;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFormCardTitle(ConcessioniFormCardTitle formCardTitle) {
|
public void setFormCard(ProjectFormCard formCard) {
|
||||||
this.formCardTitle = formCardTitle;
|
this.formCard = formCard;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GcubeProfileDV getGcubeProfile() {
|
public GcubeProfileDV getGcubeProfile() {
|
||||||
|
@ -64,8 +64,8 @@ public class GeoNaFormCardModel {
|
||||||
builder.append(metadataProfileBean);
|
builder.append(metadataProfileBean);
|
||||||
builder.append(", metadataForm=");
|
builder.append(", metadataForm=");
|
||||||
builder.append(metadataForm);
|
builder.append(metadataForm);
|
||||||
builder.append(", formCardTitle=");
|
builder.append(", formCard=");
|
||||||
builder.append(formCardTitle);
|
builder.append(formCard);
|
||||||
builder.append(", gcubeProfile=");
|
builder.append(", gcubeProfile=");
|
||||||
builder.append(gcubeProfile);
|
builder.append(gcubeProfile);
|
||||||
builder.append("]");
|
builder.append("]");
|
||||||
|
|
|
@ -3,63 +3,70 @@ package org.gcube.portlets.user.geoportaldataentry.client.ui.card;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ProjectFormCard;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.AlertClosable;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform;
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
|
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.GenericFormEvents.GenericFormEventsListener;
|
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.GenericFormEvents.GenericFormEventsListener;
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Button;
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
import com.github.gwtbootstrap.client.ui.Tab;
|
import com.github.gwtbootstrap.client.ui.Tab;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
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.ui.FlowPanel;
|
import com.google.gwt.user.client.ui.FlowPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Image;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class MetadataFormCard.
|
* The Class MetadataFormCard.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
*
|
*
|
||||||
* Oct 12, 2020
|
* Oct 12, 2020
|
||||||
*/
|
*/
|
||||||
public class MetadataFormCard {
|
public class MetadataFormCard {
|
||||||
|
|
||||||
/** The heading. */
|
/** The heading. */
|
||||||
private String heading;
|
private String heading;
|
||||||
|
|
||||||
/** The tab. */
|
/** The tab. */
|
||||||
private Tab tab;
|
private Tab tab;
|
||||||
|
|
||||||
/** The repeatible. */
|
/** The repeatible. */
|
||||||
private boolean repeatible;
|
private boolean repeatible;
|
||||||
|
|
||||||
/** The list forms. */
|
/** The list forms. */
|
||||||
private List<CreateMetadataForm> listForms = new ArrayList<CreateMetadataForm>();
|
private List<CreateMetadataForm> listForms = new ArrayList<CreateMetadataForm>();
|
||||||
|
|
||||||
/** The form card event handler. */
|
/** The form card event handler. */
|
||||||
private MetadataFormCardEventHandler formCardEventHandler = new MetadataFormCardEventHandler();
|
private MetadataFormCardEventHandler formCardEventHandler = new MetadataFormCardEventHandler();
|
||||||
|
|
||||||
/** The geona form model. */
|
/** The geona form model. */
|
||||||
private GeoNaFormCardModel geonaFormModel;
|
private GeoNaFormCardModel geonaFormModel;
|
||||||
|
|
||||||
private HandlerManager appManagerBus;
|
private HandlerManager appManagerBus;
|
||||||
|
|
||||||
private Integer maxFormRepeatability;
|
private Integer maxFormRepeatability;
|
||||||
|
|
||||||
private FlowPanel tabContainer = new FlowPanel();
|
private FlowPanel tabContainer = new FlowPanel();
|
||||||
|
|
||||||
|
private int minFormRepeatability;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class MetadataFormCardEventHandler.
|
* The Class MetadataFormCardEventHandler.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
*
|
*
|
||||||
* Oct 12, 2020
|
* Oct 12, 2020
|
||||||
*/
|
*/
|
||||||
private class MetadataFormCardEventHandler implements GenericFormEventsListener{
|
private class MetadataFormCardEventHandler implements GenericFormEventsListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On form data valid.
|
* On form data valid.
|
||||||
*
|
*
|
||||||
|
@ -68,7 +75,7 @@ public class MetadataFormCard {
|
||||||
@Override
|
@Override
|
||||||
public void onFormDataValid(GenericDatasetBean genericDatasetBean) {
|
public void onFormDataValid(GenericDatasetBean genericDatasetBean) {
|
||||||
setTabStatus();
|
setTabStatus();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,7 +84,7 @@ public class MetadataFormCard {
|
||||||
@Override
|
@Override
|
||||||
public void onFormDataEdit() {
|
public void onFormDataEdit() {
|
||||||
resetTabStatus();
|
resetTabStatus();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -86,38 +93,58 @@ public class MetadataFormCard {
|
||||||
@Override
|
@Override
|
||||||
public void onFormAborted() {
|
public void onFormAborted() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On validation error.
|
* On validation error.
|
||||||
*
|
*
|
||||||
* @param throwable the throwable
|
* @param throwable the throwable
|
||||||
* @param errorMsg the error msg
|
* @param errorMsg the error msg
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onValidationError(Throwable throwable, String errorMsg) {
|
public void onValidationError(Throwable throwable, String errorMsg) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new metadata form card.
|
* Instantiates a new metadata form card.
|
||||||
*
|
*
|
||||||
* @param tab the tab
|
* @param tab the tab
|
||||||
* @param geonaFormModel the geona form model
|
* @param geonaFormModel the geona form model
|
||||||
* @param appManagerBus the app manager bus
|
* @param appManagerBus the app manager bus
|
||||||
*/
|
*/
|
||||||
public MetadataFormCard(Tab tab, GeoNaFormCardModel geonaFormModel, HandlerManager appManagerBus) {
|
public MetadataFormCard(Tab tab, GeoNaFormCardModel geonaFormModel, HandlerManager appManagerBus) {
|
||||||
this.tab = tab;
|
this.tab = tab;
|
||||||
this.geonaFormModel = geonaFormModel;
|
this.geonaFormModel = geonaFormModel;
|
||||||
this.appManagerBus = appManagerBus;
|
this.appManagerBus = appManagerBus;
|
||||||
this.repeatible = geonaFormModel.getFormCardTitle().isInternalRepeatibleForm();
|
ProjectFormCard formCard = geonaFormModel.getFormCard();
|
||||||
this.maxFormRepeatability = geonaFormModel.getFormCardTitle().getMaxFormRepeatability()!=null?geonaFormModel.getFormCardTitle().getMaxFormRepeatability():Integer.MAX_VALUE;
|
this.repeatible = formCard.isInternalRepeatibleForm();
|
||||||
this.buildCard(geonaFormModel.getMetadataForm());
|
this.minFormRepeatability = formCard.getMinFormRepeatability() != null
|
||||||
//geonaFormModel.getMetadataForm().addListener(formCardEventHandler);
|
? geonaFormModel.getFormCard().getMinFormRepeatability()
|
||||||
|
: 1;
|
||||||
|
this.maxFormRepeatability = formCard.getMaxFormRepeatability() != null
|
||||||
|
? geonaFormModel.getFormCard().getMaxFormRepeatability()
|
||||||
|
: Integer.MAX_VALUE;
|
||||||
|
|
||||||
|
boolean repeatibleFormIsRemovable = true;
|
||||||
|
if (minFormRepeatability > 1) {
|
||||||
|
repeatibleFormIsRemovable = false;
|
||||||
|
for (int i = 1; i < minFormRepeatability; i++) {
|
||||||
|
CreateMetadataForm newForm = new CreateMetadataForm(
|
||||||
|
geonaFormModel.getMetadataForm().getMetadataProfiles(), appManagerBus,
|
||||||
|
CreateMetadataForm.OPERATION.UPDATE);
|
||||||
|
// newForm.addListener(formCardEventHandler);
|
||||||
|
// here removableForm is false because the min > 1 must be respected
|
||||||
|
addNewForm(newForm, repeatibleFormIsRemovable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.buildCard(geonaFormModel.getMetadataForm(), repeatibleFormIsRemovable);
|
||||||
|
// geonaFormModel.getMetadataForm().addListener(formCardEventHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -125,62 +152,74 @@ public class MetadataFormCard {
|
||||||
*
|
*
|
||||||
* @param createMetadataForm the create metadata form
|
* @param createMetadataForm the create metadata form
|
||||||
*/
|
*/
|
||||||
private void buildCard(final CreateMetadataForm createMetadataForm) {
|
private void buildCard(final CreateMetadataForm createMetadataForm, boolean repeatibleFormIsRemovable) {
|
||||||
|
|
||||||
if(repeatible) {
|
if (repeatible) {
|
||||||
Button buttonAddNew = new Button("Add New...");
|
Button buttonAddNew = new Button("Add New...");
|
||||||
tab.add(buttonAddNew);
|
tab.add(buttonAddNew);
|
||||||
|
|
||||||
buttonAddNew.addClickHandler(new ClickHandler() {
|
buttonAddNew.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
|
|
||||||
if(listForms.size() < maxFormRepeatability) {
|
if (listForms.size() < maxFormRepeatability) {
|
||||||
|
|
||||||
CreateMetadataForm newForm = new CreateMetadataForm(createMetadataForm.getMetadataProfiles(),appManagerBus, CreateMetadataForm.OPERATION.UPDATE);
|
CreateMetadataForm newForm = new CreateMetadataForm(createMetadataForm.getMetadataProfiles(),
|
||||||
//newForm.addListener(formCardEventHandler);
|
appManagerBus, CreateMetadataForm.OPERATION.UPDATE);
|
||||||
addNewForm(newForm);
|
// newForm.addListener(formCardEventHandler);
|
||||||
}else
|
addNewForm(newForm, true);
|
||||||
Window.alert("Maximun number of data reached for "+geonaFormModel.getFormCardTitle().getTitle());
|
} else {
|
||||||
//newForm.getCreateButton().setFocus(true);
|
DialogInform di = new DialogInform(new Image(Images.ICONS.accessDenied()), "Maximun reached",
|
||||||
|
"Maximun number of data reached for " + geonaFormModel.getFormCard().getTitle());
|
||||||
|
di.center();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
tab.add(tabContainer);
|
tab.add(tabContainer);
|
||||||
addNewForm(createMetadataForm);
|
addNewForm(createMetadataForm, repeatibleFormIsRemovable);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the new form.
|
* Adds the new form.
|
||||||
*
|
*
|
||||||
* @param newForm the new form
|
* @param newForm the new form
|
||||||
*/
|
*/
|
||||||
private void addNewForm(final CreateMetadataForm newForm) {
|
private void addNewForm(final CreateMetadataForm newForm, boolean repeatibleFormIsRemovable) {
|
||||||
tabContainer.insert(newForm,0);
|
tabContainer.insert(newForm, 0);
|
||||||
listForms.add(newForm);
|
listForms.add(newForm);
|
||||||
|
|
||||||
if(listForms.size()>1) {
|
if (listForms.size() > 1 && repeatibleFormIsRemovable) {
|
||||||
final Button buttonRemoveLatestForm = new Button("Remove");
|
final Button buttonRemoveLatestForm = new Button("Remove");
|
||||||
buttonRemoveLatestForm.setIcon(IconType.TRASH);
|
buttonRemoveLatestForm.setIcon(IconType.TRASH);
|
||||||
tabContainer.insert(buttonRemoveLatestForm,1);
|
tabContainer.insert(buttonRemoveLatestForm, 1);
|
||||||
|
|
||||||
buttonRemoveLatestForm.addClickHandler(new ClickHandler() {
|
buttonRemoveLatestForm.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
tabContainer.remove(newForm);
|
tabContainer.remove(newForm);
|
||||||
listForms.remove(newForm);
|
listForms.remove(newForm);
|
||||||
tabContainer.remove(buttonRemoveLatestForm);
|
tabContainer.remove(buttonRemoveLatestForm);
|
||||||
|
|
||||||
|
AlertClosable alertCloasable = new AlertClosable();
|
||||||
|
alertCloasable.setHTML("Data Entry form removed");
|
||||||
|
alertCloasable.setAnimation(true);
|
||||||
|
alertCloasable.setType(AlertType.DEFAULT);
|
||||||
|
alertCloasable.setClose(true);
|
||||||
|
alertCloasable.closeAfter(3000);
|
||||||
|
alertCloasable.getElement().getStyle().setMarginTop(5, Unit.PX);
|
||||||
|
tabContainer.insert(alertCloasable,0);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
newForm.addListener(formCardEventHandler);
|
newForm.addListener(formCardEventHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the list forms.
|
* Gets the list forms.
|
||||||
*
|
*
|
||||||
|
@ -189,7 +228,7 @@ public class MetadataFormCard {
|
||||||
public List<CreateMetadataForm> getListForms() {
|
public List<CreateMetadataForm> getListForms() {
|
||||||
return listForms;
|
return listForms;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the heading.
|
* Gets the heading.
|
||||||
*
|
*
|
||||||
|
@ -199,7 +238,6 @@ public class MetadataFormCard {
|
||||||
return heading;
|
return heading;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate form.
|
* Validate form.
|
||||||
*
|
*
|
||||||
|
@ -208,8 +246,8 @@ public class MetadataFormCard {
|
||||||
public boolean validateForm() {
|
public boolean validateForm() {
|
||||||
for (CreateMetadataForm createMetadataForm : listForms) {
|
for (CreateMetadataForm createMetadataForm : listForms) {
|
||||||
boolean isFormDataValid = createMetadataForm.isFormDataValid();
|
boolean isFormDataValid = createMetadataForm.isFormDataValid();
|
||||||
GWT.log("Is form data valid: "+isFormDataValid);
|
GWT.log("Is form data valid: " + isFormDataValid);
|
||||||
if(!isFormDataValid) {
|
if (!isFormDataValid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -222,43 +260,41 @@ public class MetadataFormCard {
|
||||||
* @param bool the new valid card
|
* @param bool the new valid card
|
||||||
*/
|
*/
|
||||||
public void setValidCard(boolean bool) {
|
public void setValidCard(boolean bool) {
|
||||||
if(bool) {
|
if (bool) {
|
||||||
tab.setIcon(IconType.OK_SIGN);
|
tab.setIcon(IconType.OK_SIGN);
|
||||||
tab.asWidget().getElement().removeClassName("red-text");
|
tab.asWidget().getElement().removeClassName("red-text");
|
||||||
tab.asWidget().getElement().addClassName("green-text");
|
tab.asWidget().getElement().addClassName("green-text");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
tab.setIcon(IconType.MINUS_SIGN);
|
tab.setIcon(IconType.MINUS_SIGN);
|
||||||
tab.asWidget().getElement().removeClassName("green-text");
|
tab.asWidget().getElement().removeClassName("green-text");
|
||||||
tab.asWidget().getElement().addClassName("red-text");
|
tab.asWidget().getElement().addClassName("red-text");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the tab status.
|
* Sets the tab status.
|
||||||
*/
|
*/
|
||||||
private void setTabStatus() {
|
private void setTabStatus() {
|
||||||
boolean isValid = validateForm();
|
boolean isValid = validateForm();
|
||||||
if(isValid) {
|
if (isValid) {
|
||||||
tab.setIcon(IconType.OK_SIGN);
|
tab.setIcon(IconType.OK_SIGN);
|
||||||
tab.asWidget().getElement().removeClassName("red-text");
|
tab.asWidget().getElement().removeClassName("red-text");
|
||||||
tab.asWidget().getElement().addClassName("green-text");
|
tab.asWidget().getElement().addClassName("green-text");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
tab.setIcon(IconType.MINUS_SIGN);
|
tab.setIcon(IconType.MINUS_SIGN);
|
||||||
tab.asWidget().getElement().removeClassName("red-text");
|
tab.asWidget().getElement().removeClassName("red-text");
|
||||||
tab.asWidget().getElement().addClassName("red-text");
|
tab.asWidget().getElement().addClassName("red-text");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset tab status.
|
* Reset tab status.
|
||||||
*/
|
*/
|
||||||
private void resetTabStatus() {
|
private void resetTabStatus() {
|
||||||
tab.setIcon(null);
|
tab.setIcon(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GeoNaFormCardModel getGeonaFormModel() {
|
public GeoNaFormCardModel getGeonaFormModel() {
|
||||||
return geonaFormModel;
|
return geonaFormModel;
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,7 +168,7 @@ public class GeonaDataEntryMainForm extends Composite {
|
||||||
listGDB.add(form.getFormDataBean());
|
listGDB.add(form.getFormDataBean());
|
||||||
|
|
||||||
}
|
}
|
||||||
listGeonaFormObjects.add(new GeoNaFormDataObject(listGDB, card.getGeonaFormModel().getFormCardTitle()));
|
listGeonaFormObjects.add(new GeoNaFormDataObject(listGDB, card.getGeonaFormModel().getFormCard()));
|
||||||
}
|
}
|
||||||
appManagerBus.fireEvent(new SaveGeonaDataFormsEvent(listGeonaFormObjects));
|
appManagerBus.fireEvent(new SaveGeonaDataFormsEvent(listGeonaFormObjects));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Alert;
|
||||||
|
import com.google.gwt.user.client.Timer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class AlertClosable.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Mar 4, 2022
|
||||||
|
*/
|
||||||
|
public class AlertClosable extends Alert {
|
||||||
|
|
||||||
|
private AlertClosable instance = this;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new alert closable.
|
||||||
|
*/
|
||||||
|
public AlertClosable() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close after.
|
||||||
|
*
|
||||||
|
* @param depayMillis the depay millis
|
||||||
|
*/
|
||||||
|
public void closeAfter(int depayMillis) {
|
||||||
|
Timer timer = new Timer() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
instance.close();
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
timer.schedule(depayMillis);
|
||||||
|
}
|
||||||
|
}
|
|
@ -30,9 +30,9 @@ import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceCo
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
|
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
|
||||||
import org.gcube.common.portal.PortalContext;
|
import org.gcube.common.portal.PortalContext;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitle;
|
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryService;
|
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryService;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ProjectFormCard;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GNADataEntryExtConfigProfile;
|
import org.gcube.portlets.user.geoportaldataentry.shared.GNADataEntryExtConfigProfile;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
||||||
|
@ -98,11 +98,11 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
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 = new HashMap<ConcessioniFormCardTitle, List<GeoNaFormDataObject>>();
|
HashMap<ProjectFormCard, List<GeoNaFormDataObject>> toMap = new HashMap<ProjectFormCard, List<GeoNaFormDataObject>>();
|
||||||
|
|
||||||
for (GeoNaFormDataObject geoNaFormDataObject : listGeonaFormObjects) {
|
for (GeoNaFormDataObject geoNaFormDataObject : listGeonaFormObjects) {
|
||||||
|
|
||||||
ConcessioniFormCardTitle theType = geoNaFormDataObject.getTheType();
|
ProjectFormCard theType = geoNaFormDataObject.getTheType();
|
||||||
List<GeoNaFormDataObject> listForm = toMap.get(theType);
|
List<GeoNaFormDataObject> listForm = toMap.get(theType);
|
||||||
if (listForm == null) {
|
if (listForm == null) {
|
||||||
listForm = new ArrayList<GeoNaFormDataObject>();
|
listForm = new ArrayList<GeoNaFormDataObject>();
|
||||||
|
@ -130,56 +130,56 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
/*
|
/*
|
||||||
// Saving Data
|
// Saving Data
|
||||||
// Informazioni di Progetto
|
// Informazioni di Progetto
|
||||||
List<GeoNaFormDataObject> list = toMap.get(ConcessioniFormCardTitle.INFORMAZIONI_DI_PROGETTO);
|
List<GeoNaFormDataObject> list = toMap.get(ProjectFormCard.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(
|
throw new Exception(
|
||||||
"Error: no data found for " + ConcessioniFormCardTitle.INFORMAZIONI_DI_PROGETTO.getTitle());
|
"Error: no data found for " + ProjectFormCard.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(ProjectFormCard.INFORMAZIONI_DI_PROGETTO + " building with client obj: " + idp);
|
||||||
Concessione 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 " + ProjectFormCard.INFORMAZIONI_DI_PROGETTO + " as server obj: " + concessione);
|
||||||
|
|
||||||
// Register New Concessione
|
// Register New Concessione
|
||||||
concessioneNew = clientMongo.createNew(concessione);
|
concessioneNew = clientMongo.createNew(concessione);
|
||||||
|
|
||||||
// ABSTRACT_RELAZIONE_DI_SCAVO
|
// ABSTRACT_RELAZIONE_DI_SCAVO
|
||||||
list = toMap.get(ConcessioniFormCardTitle.ABSTRACT_RELAZIONE_DI_SCAVO);
|
list = toMap.get(ProjectFormCard.ABSTRACT_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(
|
throw new Exception(
|
||||||
"Error: no data found for " + ConcessioniFormCardTitle.ABSTRACT_RELAZIONE_DI_SCAVO.getTitle());
|
"Error: no data found for " + ProjectFormCard.ABSTRACT_RELAZIONE_DI_SCAVO.getTitle());
|
||||||
|
|
||||||
listGDB = list.get(0).getListGDB();
|
listGDB = list.get(0).getListGDB();
|
||||||
GenericDatasetBean ards = listGDB.get(0);
|
GenericDatasetBean ards = listGDB.get(0);
|
||||||
LOG.debug("\n\n");
|
LOG.debug("\n\n");
|
||||||
LOG.debug(ConcessioniFormCardTitle.ABSTRACT_RELAZIONE_DI_SCAVO + " building with client obj: " + ards);
|
LOG.debug(ProjectFormCard.ABSTRACT_RELAZIONE_DI_SCAVO + " building with client obj: " + ards);
|
||||||
AbstractRelazione abstractRelazioneDiScavo = ConvertToServiceModel.toAbstractRelazioneScavo(ards);
|
AbstractRelazione abstractRelazioneDiScavo = ConvertToServiceModel.toAbstractRelazioneScavo(ards);
|
||||||
// Setting Abstract Relazione
|
// Setting Abstract Relazione
|
||||||
concessioneNew.setAbstractRelazione(abstractRelazioneDiScavo);
|
concessioneNew.setAbstractRelazione(abstractRelazioneDiScavo);
|
||||||
|
|
||||||
// RELAZIONE_DI_SCAVO
|
// RELAZIONE_DI_SCAVO
|
||||||
list = toMap.get(ConcessioniFormCardTitle.RELAZIONE_DI_SCAVO);
|
list = toMap.get(ProjectFormCard.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(
|
throw new Exception(
|
||||||
"Error: no data found for " + ConcessioniFormCardTitle.RELAZIONE_DI_SCAVO.getTitle());
|
"Error: no data found for " + ProjectFormCard.RELAZIONE_DI_SCAVO.getTitle());
|
||||||
|
|
||||||
listGDB = list.get(0).getListGDB();
|
listGDB = list.get(0).getListGDB();
|
||||||
GenericDatasetBean rds = listGDB.get(0);
|
GenericDatasetBean rds = listGDB.get(0);
|
||||||
LOG.debug("\n\n");
|
LOG.debug("\n\n");
|
||||||
LOG.debug(ConcessioniFormCardTitle.RELAZIONE_DI_SCAVO + " building with client obj: " + rds);
|
LOG.debug(ProjectFormCard.RELAZIONE_DI_SCAVO + " building with client obj: " + rds);
|
||||||
RelazioneScavo relazioneDiScavo = ConvertToServiceModel.toRelazioneScavo(rds);
|
RelazioneScavo relazioneDiScavo = ConvertToServiceModel.toRelazioneScavo(rds);
|
||||||
LOG.debug("Built " + ConcessioniFormCardTitle.RELAZIONE_DI_SCAVO + " as server obj: " + relazioneDiScavo);
|
LOG.debug("Built " + ProjectFormCard.RELAZIONE_DI_SCAVO + " as server obj: " + relazioneDiScavo);
|
||||||
|
|
||||||
// Setting Relazione
|
// Setting Relazione
|
||||||
concessioneNew.setRelazioneScavo(relazioneDiScavo);
|
concessioneNew.setRelazioneScavo(relazioneDiScavo);
|
||||||
|
|
||||||
// IMMAGINI_RAPPRESENTATIVE
|
// IMMAGINI_RAPPRESENTATIVE
|
||||||
list = toMap.get(ConcessioniFormCardTitle.IMMAGINI_RAPPRESENTATIVE);
|
list = toMap.get(ProjectFormCard.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(
|
throw new Exception(
|
||||||
"Error: no data found for " + ConcessioniFormCardTitle.IMMAGINI_RAPPRESENTATIVE.getTitle());
|
"Error: no data found for " + ProjectFormCard.IMMAGINI_RAPPRESENTATIVE.getTitle());
|
||||||
|
|
||||||
List<GenericDatasetBean> imgRaprsLst = list.get(0).getListGDB();
|
List<GenericDatasetBean> imgRaprsLst = list.get(0).getListGDB();
|
||||||
List<UploadedImage> immaginiRappresentativeService = null;
|
List<UploadedImage> immaginiRappresentativeService = null;
|
||||||
|
@ -187,10 +187,10 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
immaginiRappresentativeService = new ArrayList<UploadedImage>(imgRaprsLst.size());
|
immaginiRappresentativeService = new ArrayList<UploadedImage>(imgRaprsLst.size());
|
||||||
for (GenericDatasetBean imgRapr : imgRaprsLst) {
|
for (GenericDatasetBean imgRapr : imgRaprsLst) {
|
||||||
LOG.debug("\n\n");
|
LOG.debug("\n\n");
|
||||||
LOG.debug(ConcessioniFormCardTitle.IMMAGINI_RAPPRESENTATIVE + " building with client obj: "
|
LOG.debug(ProjectFormCard.IMMAGINI_RAPPRESENTATIVE + " building with client obj: "
|
||||||
+ imgRapr);
|
+ imgRapr);
|
||||||
UploadedImage img = ConvertToServiceModel.toImmaginiRappresentative(imgRapr);
|
UploadedImage img = ConvertToServiceModel.toImmaginiRappresentative(imgRapr);
|
||||||
LOG.debug("Built " + ConcessioniFormCardTitle.IMMAGINI_RAPPRESENTATIVE + " as server obj: " + img);
|
LOG.debug("Built " + ProjectFormCard.IMMAGINI_RAPPRESENTATIVE + " as server obj: " + img);
|
||||||
immaginiRappresentativeService.add(img);
|
immaginiRappresentativeService.add(img);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,20 +201,20 @@ 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(ProjectFormCard.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 "
|
throw new Exception("Error: no data found for "
|
||||||
+ ConcessioniFormCardTitle.POSIZIONAMENTO_DELL_AREA_DI_INDAGINE.getTitle());
|
+ ProjectFormCard.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);
|
||||||
LayerConcessione layerPad = null;
|
LayerConcessione layerPad = null;
|
||||||
if (pad != null) {
|
if (pad != null) {
|
||||||
LOG.debug("\n\n");
|
LOG.debug("\n\n");
|
||||||
LOG.debug(ConcessioniFormCardTitle.POSIZIONAMENTO_DELL_AREA_DI_INDAGINE + " building with client obj: "
|
LOG.debug(ProjectFormCard.POSIZIONAMENTO_DELL_AREA_DI_INDAGINE + " building with client obj: "
|
||||||
+ pad);
|
+ pad);
|
||||||
layerPad = ConvertToServiceModel.toLayerConcessione(pad);
|
layerPad = ConvertToServiceModel.toLayerConcessione(pad);
|
||||||
LOG.debug("Built " + ConcessioniFormCardTitle.POSIZIONAMENTO_DELL_AREA_DI_INDAGINE + " as server obj: "
|
LOG.debug("Built " + ProjectFormCard.POSIZIONAMENTO_DELL_AREA_DI_INDAGINE + " as server obj: "
|
||||||
+ layerPad);
|
+ layerPad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,10 +224,10 @@ 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(ProjectFormCard.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(
|
throw new Exception(
|
||||||
"Error: no data found for " + ConcessioniFormCardTitle.PIANTA_DI_FINE_SCAVO.getTitle());
|
"Error: no data found for " + ProjectFormCard.PIANTA_DI_FINE_SCAVO.getTitle());
|
||||||
|
|
||||||
listGDB = list.get(0).getListGDB();
|
listGDB = list.get(0).getListGDB();
|
||||||
List<GenericDatasetBean> listPfs = listGDB;
|
List<GenericDatasetBean> listPfs = listGDB;
|
||||||
|
@ -237,9 +237,9 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
pianteFineScavo = new ArrayList<LayerConcessione>(listPfs.size());
|
pianteFineScavo = new ArrayList<LayerConcessione>(listPfs.size());
|
||||||
for (GenericDatasetBean pfs : listPfs) {
|
for (GenericDatasetBean pfs : listPfs) {
|
||||||
LOG.debug("\n\n");
|
LOG.debug("\n\n");
|
||||||
LOG.debug(ConcessioniFormCardTitle.PIANTA_DI_FINE_SCAVO + " building with client obj: " + pfs);
|
LOG.debug(ProjectFormCard.PIANTA_DI_FINE_SCAVO + " building with client obj: " + pfs);
|
||||||
LayerConcessione layerPfs = ConvertToServiceModel.toLayerConcessione(pfs);
|
LayerConcessione layerPfs = ConvertToServiceModel.toLayerConcessione(pfs);
|
||||||
LOG.debug("Built " + ConcessioniFormCardTitle.PIANTA_DI_FINE_SCAVO + " as server obj: " + layerPfs);
|
LOG.debug("Built " + ProjectFormCard.PIANTA_DI_FINE_SCAVO + " as server obj: " + layerPfs);
|
||||||
pianteFineScavo.add(layerPfs);
|
pianteFineScavo.add(layerPfs);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -486,9 +486,9 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
*
|
*
|
||||||
* @param toMap the to map
|
* @param toMap the to map
|
||||||
*/
|
*/
|
||||||
private void prettyPrintClientDataEntryMap(HashMap<ConcessioniFormCardTitle, List<GeoNaFormDataObject>> toMap) {
|
private void prettyPrintClientDataEntryMap(HashMap<ProjectFormCard, List<GeoNaFormDataObject>> toMap) {
|
||||||
|
|
||||||
for (ConcessioniFormCardTitle theType : toMap.keySet()) {
|
for (ProjectFormCard theType : toMap.keySet()) {
|
||||||
LOG.debug("\n\n");
|
LOG.debug("\n\n");
|
||||||
LOG.debug(theType.toString());
|
LOG.debug(theType.toString());
|
||||||
List<GeoNaFormDataObject> list = toMap.get(theType);
|
List<GeoNaFormDataObject> list = toMap.get(theType);
|
||||||
|
|
|
@ -3,7 +3,7 @@ package org.gcube.portlets.user.geoportaldataentry.shared;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitle;
|
import org.gcube.portlets.user.geoportaldataentry.client.ProjectFormCard;
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
||||||
|
|
||||||
public class GeoNaFormDataObject implements Serializable{
|
public class GeoNaFormDataObject implements Serializable{
|
||||||
|
@ -14,13 +14,13 @@ public class GeoNaFormDataObject implements Serializable{
|
||||||
private static final long serialVersionUID = 3620244260086172039L;
|
private static final long serialVersionUID = 3620244260086172039L;
|
||||||
|
|
||||||
private List<GenericDatasetBean> listGDB;
|
private List<GenericDatasetBean> listGDB;
|
||||||
private ConcessioniFormCardTitle theType;
|
private ProjectFormCard theType;
|
||||||
|
|
||||||
public GeoNaFormDataObject(){
|
public GeoNaFormDataObject(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GeoNaFormDataObject(List<GenericDatasetBean> listGDB, ConcessioniFormCardTitle theType) {
|
public GeoNaFormDataObject(List<GenericDatasetBean> listGDB, ProjectFormCard theType) {
|
||||||
super();
|
super();
|
||||||
this.listGDB = listGDB;
|
this.listGDB = listGDB;
|
||||||
this.theType = theType;
|
this.theType = theType;
|
||||||
|
@ -33,10 +33,10 @@ public class GeoNaFormDataObject implements Serializable{
|
||||||
public void setListGDB(List<GenericDatasetBean> listGDB) {
|
public void setListGDB(List<GenericDatasetBean> listGDB) {
|
||||||
this.listGDB = listGDB;
|
this.listGDB = listGDB;
|
||||||
}
|
}
|
||||||
public ConcessioniFormCardTitle getTheType() {
|
public ProjectFormCard getTheType() {
|
||||||
return theType;
|
return theType;
|
||||||
}
|
}
|
||||||
public void setTheType(ConcessioniFormCardTitle theType) {
|
public void setTheType(ProjectFormCard theType) {
|
||||||
this.theType = theType;
|
this.theType = theType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue