diff --git a/.classpath b/.classpath
index d8296e1..7f4685f 100644
--- a/.classpath
+++ b/.classpath
@@ -1,6 +1,6 @@
-
+
@@ -30,5 +30,5 @@
-
+
diff --git a/.settings/com.gwtplugins.gdt.eclipse.core.prefs b/.settings/com.gwtplugins.gdt.eclipse.core.prefs
index 876328d..6dbb288 100644
--- a/.settings/com.gwtplugins.gdt.eclipse.core.prefs
+++ b/.settings/com.gwtplugins.gdt.eclipse.core.prefs
@@ -1,5 +1,5 @@
eclipse.preferences.version=1
jarsExcludedFromWebInfLib=
-lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-2.1.0-SNAPSHOT
+lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-3.0.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false
diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
index 98ea8c3..c7b81da 100644
--- a/.settings/org.eclipse.wst.common.component
+++ b/.settings/org.eclipse.wst.common.component
@@ -1,5 +1,5 @@
-
+
@@ -22,8 +22,20 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -47,7 +59,13 @@
-
+
+
+
+
+
+
+
@@ -71,7 +89,13 @@
-
+
+
+
+
+
+
+
@@ -95,10 +119,22 @@
-
+
uses
-
+
+ uses
+
+
+ uses
+
+
+
+
+
+
+
+
@@ -122,7 +158,13 @@
-
+
+
+
+
+
+
+
@@ -146,7 +188,13 @@
-
+
+
+
+
+
+
+
@@ -170,7 +218,13 @@
-
+
+
+
+
+
+
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a69f535..021d906 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,13 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+
+## [v3.0.0-SNAPSHOT] - 2022-02-28
+
+#### Enhancements
+
+- [#22684] Porting to Profiled Document
+
## [v2.1.0] - 2021-11-24
#### Enhancements
diff --git a/pom.xml b/pom.xml
index d855017..c963a75 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,7 +14,7 @@
org.gcube.portlets.user
geoportal-data-entry-app
war
- 2.1.0
+ 3.0.0-SNAPSHOT
GeoPortal Data Entry App
The GeoPortal Data Entry App is an application to build the web forms for data entries needed to GeoNa project
@@ -87,6 +87,13 @@
${gwtVersion}
provided
+
+
+ org.ow2.asm
+ asm
+ provided
+ 7.1
+
com.google.gwt
gwt-servlet
@@ -101,7 +108,7 @@
org.gcube.portlets.widgets
metadata-profile-form-builder-widget
- [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)
+ [2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)
compile
@@ -139,7 +146,7 @@
org.gcube.application
geoportal-data-common
- [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)
+ [2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)
compile
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConcessioniFormCardTitle.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConcessioniFormCardTitle.java
index f75276f..288cd0a 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConcessioniFormCardTitle.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConcessioniFormCardTitle.java
@@ -1,41 +1,36 @@
package org.gcube.portlets.user.geoportaldataentry.client;
-
/**
* The Enum ConcessioniFormCardTitle.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
- * Nov 30, 2020
+ * Nov 30, 2020
*/
-public enum ConcessioniFormCardTitle {
-
- INFORMAZIONI_DI_PROGETTO("Informazioni", "Informazioni di Progetto", 1, false, null),
- ABSTRACT_RELAZIONE_DI_SCAVO("Abstract Relazione di Scavo", "Abstract Relazione di Scavo", 2, false, null),
- RELAZIONE_DI_SCAVO("Relazione di Scavo", "Relazione di Scavo", 3, false, null),
- IMMAGINI_RAPPRESENTATIVE("Immagini Rappresentative", "Immagini Rappresentative", 4, true, 8),
- POSIZIONAMENTO_DELL_AREA_DI_INDAGINE("Posizionamento", "Posizionamento dell'Area di Indagine", 5, false, null),
- PIANTA_DI_FINE_SCAVO("Pianta di Fine Scavo", "Pianta di Fine Scavo", 6, true, null);
-
+public class ConcessioniFormCardTitle {
+
private String key;
private String title;
private Integer order;
private boolean internalRepeatibleForm;
private Integer maxFormRepeatability;
-
+ private Integer minFormRepeatability;
+
/**
* Instantiates a new concessioni form card title.
*
- * @param key the key
- * @param title the title
- * @param order the order
+ * @param key the key
+ * @param title the title
+ * @param order the order
* @param internalRepeatibleForm the internal repeatible form
- * @param maxFormRepeatability the max form repeatability
+ * @param maxFormRepeatability the max form repeatability
*/
- private ConcessioniFormCardTitle(String key, String title, int order, boolean internalRepeatibleForm, Integer maxFormRepeatability) {
+ public ConcessioniFormCardTitle(String key, String title, int order, boolean internalRepeatibleForm,
+ Integer minFormRepeatability, Integer maxFormRepeatability) {
this.key = key;
this.title = title;
this.order = order;
+ this.minFormRepeatability = minFormRepeatability;
this.internalRepeatibleForm = internalRepeatibleForm;
this.maxFormRepeatability = maxFormRepeatability;
}
@@ -66,7 +61,7 @@ public enum ConcessioniFormCardTitle {
public Integer getOrder() {
return order;
}
-
+
/**
* Checks if is internal repeatible form.
*
@@ -75,7 +70,7 @@ public enum ConcessioniFormCardTitle {
public boolean isInternalRepeatibleForm() {
return internalRepeatibleForm;
}
-
+
/**
* Gets the max form repeatability.
*
@@ -85,5 +80,12 @@ public enum ConcessioniFormCardTitle {
return maxFormRepeatability;
}
+ public Integer getMinFormRepeatability() {
+ return minFormRepeatability;
+ }
+
+ public void setMinFormRepeatability(Integer minFormRepeatability) {
+ this.minFormRepeatability = minFormRepeatability;
+ }
}
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java
index 6afcf8c..85f1a9a 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java
@@ -15,6 +15,9 @@ import org.gcube.application.geoportalcommon.shared.config.ACTION_ON_ITEM;
import org.gcube.application.geoportalcommon.shared.config.GcubeUserRole;
import org.gcube.application.geoportalcommon.shared.config.RoleRights;
import org.gcube.application.geoportalcommon.shared.config.RoleRights.OPERATION_TYPE;
+import org.gcube.application.geoportalcommon.shared.geoportalconfig.ConfigurationVO;
+import org.gcube.application.geoportalcommon.shared.geoportalconfig.DocumentConfigVO;
+import org.gcube.application.geoportalcommon.shared.geoportalconfig.GcubeProfileVO;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV;
@@ -51,6 +54,7 @@ import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
import org.gcube.portlets.user.geoportaldataentry.shared.UserRights;
import org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilderServiceAsync;
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
+import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm.OPERATION;
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
import com.github.gwtbootstrap.client.ui.Alert;
@@ -112,6 +116,18 @@ public class GeoPortalDataEntryApp implements EntryPoint {
private List displayFields = new ArrayList();
private List sortByFields = new ArrayList();
private List searchByFields = new ArrayList();
+
+ private int numberOfCards = 0;
+
+ private int expectedCards = 0;
+
+ private synchronized void incrementNumberOfCards() {
+ numberOfCards++;
+ }
+
+ private synchronized int getNumberOfCards() {
+ return numberOfCards;
+ }
/**
* This is the entry point method.
@@ -120,46 +136,34 @@ public class GeoPortalDataEntryApp implements EntryPoint {
RootPanel.get(DIV_PORTLET_ID).add(loader);
- /*GeoportalDataEntryServiceAsync.Util.getInstance().listDisplayFields(new AsyncCallback>() {
+ GeoportalDataEntryServiceAsync.Util.getInstance().getGeonaInitConfig(new AsyncCallback() {
@Override
public void onFailure(Throwable caught) {
- Window.alert(caught.getMessage());
-
+ String errorMsg = "Sorry, an error occurrend when loading configurations. Please, contact the support";
+ Alert alert = new Alert(errorMsg, AlertType.ERROR);
+ alert.setClose(false);
+ try {
+ RootPanel.get(DIV_PORTLET_ID).remove(loader);
+ } catch (Exception e) {
+
+ }
+ RootPanel.get(DIV_PORTLET_ID).add(alert);
+ Window.alert(errorMsg);
}
@Override
- public void onSuccess(List result) {
+ public void onSuccess(GeonaISConfig result) {
- for (ItemField itemField : result) {
- if(itemField.isDisplayAsResult()) {
- displayFields.add(itemField);
- }
+ if (result!= null && result.getScope() != null) {
- if(itemField.isSearchable()) {
- searchByFields.add(itemField);
- }
-
- if(itemField.isSortable()) {
- sortByFields.add(itemField);
- }
- }
-
-
- GWT.log("List display fields: "+result);
- SearchingFilter initialSortFilter = new SearchingFilter();
- initialSortFilter.setOrder(ORDER.ASC);
- initialSortFilter.setOrderByFields(Arrays.asList(new ItemField("Name", Arrays.asList("name"), true, true, true)));
-
- displayFields = result;
- mainTabPanel = new GeonaMainTabPanel(appManagerBus, displayFields, sortByFields, searchByFields, initialSortFilter);
- mainTabPanel.setLoaderVisible("Loading...", true);
+ loadGeoportalConfigsAndBuildCards(result.getScope());
+ } else
+ Window.alert(
+ "Sorry, no scope found in the session. Re-login and try again");
- geoNaMainForm = new GeonaDataEntryMainForm(appManagerBus);
- mainTabPanel.addFormPanel(geoNaMainForm);
-
}
- });*/
+ });
GeoportalDataEntryServiceAsync.Util.getInstance().readDataViewerConfig(new AsyncCallback() {
@@ -240,105 +244,9 @@ public class GeoPortalDataEntryApp implements EntryPoint {
mainTabPanel.instanceAndShowListOfConcessioni();
return;
}
-
- GeoportalDataEntryServiceAsync.Util.getInstance().getGeonaInitConfig(new AsyncCallback() {
-
- @Override
- public void onFailure(Throwable caught) {
- Window.alert(
- "Sorry, an error occurrend when loading configurations. Please, contact the support");
- }
-
- @Override
- public void onSuccess(GeonaISConfig result) {
-
- if (result != null && result.getGenericResourceSecondaryType() != null
- && result.getScope() != null) {
- callGetMetadataProfiles(result.getScope(), result.getGenericResourceSecondaryType());
- } else
- Window.alert(
- "Sorry, no configuration found in the context. Please, contact the support");
-
- }
- });
}
});
-
-
-
-// GeoportalDataEntryServiceAsync.Util.getInstance().getMyRightsInTheContext(new AsyncCallback() {
-//
-// @Override
-// public void onFailure(Throwable caught) {
-// String errorMsg = "Sorry, an error occurrend on istancing the application. Please, contact the support";
-// Alert alert = new Alert(errorMsg, AlertType.ERROR);
-// alert.setClose(false);
-// try {
-// RootPanel.get(DIV_PORTLET_ID).remove(loader);
-// } catch (Exception e) {
-//
-// }
-// RootPanel.get(DIV_PORTLET_ID).add(alert);
-// Window.alert(errorMsg);
-//
-// }
-//
-// @Override
-// public void onSuccess(UserRights result) {
-// try {
-// RootPanel.get(DIV_PORTLET_ID).remove(loader);
-// } catch (Exception e) {
-//
-// }
-//
-// myRights = result;
-// initGUI();
-// GcubeUserRole userRole = myRights.getRoleRights().getUserRole();
-// String msg = "Logged in as ";
-// if(userRole != null && userRole.getName()!=null) {
-// msg+= userRole.getName().substring(userRole.getName().indexOf("-")+1, userRole.getName().length());
-// }else
-// msg+="Member";
-//
-// mainTabPanel.setRoleLabel(msg);
-//
-//
-// RoleRights roleRights = myRights.getRoleRights();
-// boolean canCreateNewItem = roleRights.getListPermessions().keySet().contains(ACTION_ON_ITEM.CREATE_NEW_PROJECT);
-//
-// if (!canCreateNewItem) {
-// // removing Tab "Create New Project"
-// mainTabPanel.removeTab(0);
-// // activating Tab "List of Project"
-// mainTabPanel.setTabActive(0);
-// mainTabPanel.instanceAndShowListOfConcessioni();
-// return;
-// }
-//
-// GeoportalDataEntryServiceAsync.Util.getInstance().getGeonaInitConfig(new AsyncCallback() {
-//
-// @Override
-// public void onFailure(Throwable caught) {
-// Window.alert(
-// "Sorry, an error occurrend when loading configurations. Please, contact the support");
-// }
-//
-// @Override
-// public void onSuccess(GeonaISConfig result) {
-//
-// if (result != null && result.getgRSecondaryType() != null
-// && result.getScope() != null) {
-// callGetMetadataProfiles(result.getScope(), result.getgRSecondaryType());
-// } else
-// Window.alert(
-// "Sorry, no configuration found in the context. Please, contact the support");
-//
-// }
-// });
-//
-// }
-// });
}
private void initGUI() {
@@ -359,6 +267,90 @@ public class GeoPortalDataEntryApp implements EntryPoint {
element.click();
}-*/;
+
+ private void loadGeoportalConfigsAndBuildCards(final String scope) {
+ GWT.log("loading GeoportalConfigsAndBuildCards in the scope: "+scope);
+ orderedCards = new ArrayList();
+ //TODO PASS THE RIGHT ID
+ GeoportalDataEntryServiceAsync.Util.getInstance().getDocumentConfigurationForId("id", new AsyncCallback() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ GWT.log("caught: "+caught);
+ Window.alert(caught.toString());
+ }
+
+ @Override
+ public void onSuccess(DocumentConfigVO result) {
+ GWT.log("DocumentConfigVO: "+result);
+
+ ConfigurationVO config = result.getConfiguration();
+
+ if(config==null) {
+ Window.alert("No Configuration found in this scope. Please contact the support");
+ return;
+ }
+
+ if(config.getGcubeProfiles()==null || config.getGcubeProfiles().size()==0) {
+ Window.alert("No GcubeProfiles found in the Configuration. Please contact the support");
+ return;
+ }
+
+ numberOfCards = 0;
+ expectedCards = config.getGcubeProfiles().size();
+ GWT.log("expectedCards are: " + expectedCards);
+ TreeMap treemapOrderedGeoNaProfiles = new TreeMap();
+
+ for (int i = 0; i>() {
+
+ @Override
+ public void onSuccess(List result) {
+ incrementNumberOfCards();
+ GWT.log("loaded "+getNumberOfCards()+" of "+expectedCards+" card/s");
+ GWT.log("Returned " + result.size() + " profile/s");
+ //orderedCards = setGeoNaFormsOrder(result);
+ for (MetaDataProfileBean metaDataProfileBean : result) {
+
+ String theMetaType = metaDataProfileBean.getType().toLowerCase();
+ GWT.log("Building form card for type: " + theMetaType);
+
+ //Managing Forms repeatability
+ int minOccurs = gcubeProfiles.getMinOccurs();
+ minOccurs = minOccurs<=0?0:minOccurs;
+ int maxOccurs = gcubeProfiles.getMaxOccurs();
+ maxOccurs = maxOccurs<=0?Integer.MAX_VALUE:maxOccurs;
+
+ //TODO MUST BE MANAGED MIN_OCCURS
+ ConcessioniFormCardTitle cct = new ConcessioniFormCardTitle(gcubeProfiles.getSectionName(), gcubeProfiles.getSectionTitle(), order, maxOccurs>1, minOccurs, maxOccurs);
+ GeoNaFormCardModel geonaForm = new GeoNaFormCardModel(metaDataProfileBean, null, cct, gcubeProfiles);
+
+ treemapOrderedGeoNaProfiles.put(order, geonaForm);
+ }
+
+ if(getNumberOfCards()==expectedCards) {
+ // ordered values
+ GWT.log("TreMap values: "+treemapOrderedGeoNaProfiles.values());
+ orderedCards.addAll(treemapOrderedGeoNaProfiles.values());
+ buildNewCards(orderedCards, OPERATION.UPDATE);
+ }
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ }
+ });
+
+ }
+
+ }
+ });
+
+ }
/**
* Update window size
*/
@@ -383,26 +375,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
}
- private void callGetMetadataProfiles(String scope, String secondaryType) {
- MetadataProfileFormBuilderServiceAsync.Util.getInstance().getProfilesInTheScope(scope, secondaryType,
- new AsyncCallback>() {
-
- @Override
- public void onSuccess(List result) {
- GWT.log("Returned " + result.size() + "profile/s");
- orderedCards = setGeoNaFormsOrder(result);
- // ordered values
- buildNewCards(orderedCards);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- }
- });
- }
-
- private void buildNewCards(Collection orderedCards) {
+ private void buildNewCards(Collection orderedCards, OPERATION operation) {
projectSavedWithSuccess = false; // resetting state of saving
mainTabPanel.setLoaderVisible("Loading...", true);
resetUI();
@@ -414,7 +388,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
GWT.log("Adding card: " + geonaForm.getFormCardTitle());
CreateMetadataForm baseForm = new CreateMetadataForm(Arrays.asList(geonaForm.getMetadataProfileBean()),
- appManagerBus);
+ appManagerBus, operation);
geonaForm.setMetadataForm(baseForm);
String key = geonaForm.getMetadataProfileBean().getType();
if (geonaForm.getFormCardTitle() != null) {
@@ -434,59 +408,6 @@ public class GeoPortalDataEntryApp implements EntryPoint {
mapForms.clear();
}
- private Collection setGeoNaFormsOrder(List listMetadataProfilesForGeona) {
-
- TreeMap treemapOrderedGeoNaProfiles = new TreeMap();
-
- List listUnknownType = new ArrayList();
-
- for (MetaDataProfileBean metaDataProfileBean : listMetadataProfilesForGeona) {
-
- String theMetaType = metaDataProfileBean.getType().toLowerCase();
- GWT.log("Building form card for type: " + theMetaType);
- GeoNaFormCardModel geonaForm = new GeoNaFormCardModel(metaDataProfileBean, null, null);
-
- if (theMetaType.contains(ConcessioniFormCardTitle.INFORMAZIONI_DI_PROGETTO.getKey().toLowerCase())) {
- geonaForm.setFormCardTitle(ConcessioniFormCardTitle.INFORMAZIONI_DI_PROGETTO);
- treemapOrderedGeoNaProfiles.put(ConcessioniFormCardTitle.INFORMAZIONI_DI_PROGETTO.getOrder(),
- geonaForm);
- } else if (theMetaType
- .contains(ConcessioniFormCardTitle.ABSTRACT_RELAZIONE_DI_SCAVO.getKey().toLowerCase())) {
- geonaForm.setFormCardTitle(ConcessioniFormCardTitle.ABSTRACT_RELAZIONE_DI_SCAVO);
- treemapOrderedGeoNaProfiles.put(ConcessioniFormCardTitle.ABSTRACT_RELAZIONE_DI_SCAVO.getOrder(),
- geonaForm);
- } else if (theMetaType.contains(ConcessioniFormCardTitle.RELAZIONE_DI_SCAVO.getKey().toLowerCase())) {
- geonaForm.setFormCardTitle(ConcessioniFormCardTitle.RELAZIONE_DI_SCAVO);
- treemapOrderedGeoNaProfiles.put(ConcessioniFormCardTitle.RELAZIONE_DI_SCAVO.getOrder(), geonaForm);
- } else if (theMetaType.contains(ConcessioniFormCardTitle.IMMAGINI_RAPPRESENTATIVE.getKey().toLowerCase())) {
- geonaForm.setFormCardTitle(ConcessioniFormCardTitle.IMMAGINI_RAPPRESENTATIVE);
- treemapOrderedGeoNaProfiles.put(ConcessioniFormCardTitle.IMMAGINI_RAPPRESENTATIVE.getOrder(),
- geonaForm);
- } else if (theMetaType
- .contains(ConcessioniFormCardTitle.POSIZIONAMENTO_DELL_AREA_DI_INDAGINE.getKey().toLowerCase())) {
- geonaForm.setFormCardTitle(ConcessioniFormCardTitle.POSIZIONAMENTO_DELL_AREA_DI_INDAGINE);
- treemapOrderedGeoNaProfiles
- .put(ConcessioniFormCardTitle.POSIZIONAMENTO_DELL_AREA_DI_INDAGINE.getOrder(), geonaForm);
- } else if (theMetaType.contains(ConcessioniFormCardTitle.PIANTA_DI_FINE_SCAVO.getKey().toLowerCase())) {
- geonaForm.setFormCardTitle(ConcessioniFormCardTitle.PIANTA_DI_FINE_SCAVO);
- treemapOrderedGeoNaProfiles.put(ConcessioniFormCardTitle.PIANTA_DI_FINE_SCAVO.getOrder(), geonaForm);
- } else {
- // adding to unknown list
- listUnknownType.add(geonaForm);
- }
- }
-
- // adding unknown types
- for (GeoNaFormCardModel geoNaFormCardModel : listUnknownType) {
- Integer highestKey = treemapOrderedGeoNaProfiles.lastKey();
- highestKey++;
- treemapOrderedGeoNaProfiles.put(highestKey, geoNaFormCardModel);
- }
-
- GWT.log("Map size: " + treemapOrderedGeoNaProfiles.size());
- return treemapOrderedGeoNaProfiles.values();
-
- }
private void bindEvents() {
@@ -630,15 +551,15 @@ public class GeoPortalDataEntryApp implements EntryPoint {
boolean confirm = Window.confirm(
"Creating a new project, the current project (is not saved) and will be lost, Confirm?");
if (confirm)
- buildNewCards(orderedCards);
+ buildNewCards(orderedCards, OPERATION.NEW);
} else if (projectSavedWithSuccess) {
// means the project has been saved
- buildNewCards(orderedCards);
+ buildNewCards(orderedCards, OPERATION.NEW);
} else {
// means the project reported one ore more errors after the submit
boolean confirm = Window.confirm("Creating a new project, the web-forms will be cleaned, Confirm?");
if (confirm)
- buildNewCards(orderedCards);
+ buildNewCards(orderedCards, OPERATION.NEW);
}
}
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryService.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryService.java
index d2d8bb0..030d159 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryService.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryService.java
@@ -5,6 +5,7 @@ import java.util.List;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
+import org.gcube.application.geoportalcommon.shared.geoportalconfig.DocumentConfigVO;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
@@ -139,4 +140,12 @@ public interface GeoportalDataEntryService extends RemoteService {
*/
GNADataEntryExtConfigProfile readDataViewerConfig() throws Exception;
+ /**
+ * Gets the document configuration for id.
+ *
+ * @param id the id
+ * @return the document configuration for id
+ */
+ DocumentConfigVO getDocumentConfigurationForId(String id);
+
}
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryServiceAsync.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryServiceAsync.java
index c3593de..36d8662 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryServiceAsync.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryServiceAsync.java
@@ -5,6 +5,7 @@ import java.util.List;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
+import org.gcube.application.geoportalcommon.shared.geoportalconfig.DocumentConfigVO;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
@@ -63,4 +64,6 @@ public interface GeoportalDataEntryServiceAsync {
void readDataViewerConfig(AsyncCallback asyncCallback);
+ void getDocumentConfigurationForId(String id, AsyncCallback callback);
+
}
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/card/GeoNaFormCardModel.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/card/GeoNaFormCardModel.java
index ef476e9..eee5c12 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/card/GeoNaFormCardModel.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/card/GeoNaFormCardModel.java
@@ -1,5 +1,6 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.card;
+import org.gcube.application.geoportalcommon.shared.geoportalconfig.GcubeProfileVO;
import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitle;
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
@@ -8,18 +9,20 @@ public class GeoNaFormCardModel {
private MetaDataProfileBean metadataProfileBean;
private CreateMetadataForm metadataForm;
- private ConcessioniFormCardTitle formCardTitle; //matching with metadata profile type
+ private ConcessioniFormCardTitle formCardTitle; // matching with metadata profile type
+ private GcubeProfileVO gcubeProfile;
public GeoNaFormCardModel() {
}
public GeoNaFormCardModel(MetaDataProfileBean metadataProfileBean, CreateMetadataForm metadataForm,
- ConcessioniFormCardTitle formCardTitle) {
+ ConcessioniFormCardTitle formCardTitle, GcubeProfileVO gcubeProfile) {
super();
this.metadataProfileBean = metadataProfileBean;
this.metadataForm = metadataForm;
this.formCardTitle = formCardTitle;
+ this.gcubeProfile = gcubeProfile;
}
public MetaDataProfileBean getMetadataProfileBean() {
@@ -46,10 +49,27 @@ public class GeoNaFormCardModel {
this.formCardTitle = formCardTitle;
}
+ public GcubeProfileVO getGcubeProfile() {
+ return gcubeProfile;
+ }
+
+ public void setGcubeProfile(GcubeProfileVO gcubeProfile) {
+ this.gcubeProfile = gcubeProfile;
+ }
+
@Override
public String toString() {
- return "GeoNaForm [metadataProfileBean=" + metadataProfileBean + ", metadataForm=" + metadataForm
- + ", formCardTitle=" + formCardTitle + "]";
+ StringBuilder builder = new StringBuilder();
+ builder.append("GeoNaFormCardModel [metadataProfileBean=");
+ builder.append(metadataProfileBean);
+ builder.append(", metadataForm=");
+ builder.append(metadataForm);
+ builder.append(", formCardTitle=");
+ builder.append(formCardTitle);
+ builder.append(", gcubeProfile=");
+ builder.append(gcubeProfile);
+ builder.append("]");
+ return builder.toString();
}
}
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/card/MetadataFormCard.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/card/MetadataFormCard.java
index 0f5ff46..b058969 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/card/MetadataFormCard.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/card/MetadataFormCard.java
@@ -138,7 +138,7 @@ public class MetadataFormCard {
if(listForms.size() < maxFormRepeatability) {
- CreateMetadataForm newForm = new CreateMetadataForm(createMetadataForm.getMetadataProfiles(),appManagerBus);
+ CreateMetadataForm newForm = new CreateMetadataForm(createMetadataForm.getMetadataProfiles(),appManagerBus, CreateMetadataForm.OPERATION.UPDATE);
//newForm.addListener(formCardEventHandler);
addNewForm(newForm);
}else
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/UpdateFileset.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/UpdateFileset.java
index ddfbaf5..20b4426 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/UpdateFileset.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/UpdateFileset.java
@@ -23,6 +23,7 @@ import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogConfirm;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.StringUtil;
import org.gcube.portlets.widgets.mpformbuilder.client.form.MetaDataField;
+import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm.OPERATION;
import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.MetaDataFieldSkeleton;
import org.gcube.portlets.widgets.mpformbuilder.client.ui.upload.DialogUpload;
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
@@ -500,7 +501,7 @@ public class UpdateFileset extends Composite {
uploadField.setMaxOccurs(1000);
try {
- fieldUploadWidget = new MetaDataField(uploadField, uiBus);
+ fieldUploadWidget = new MetaDataField(uploadField, uiBus, OPERATION.NEW);
uploadFileContainer.add(fieldUploadWidget);
buttonUpdate.setVisible(true);
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GeoportalDataEntryServiceImpl.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GeoportalDataEntryServiceImpl.java
index d6187d5..48889d8 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GeoportalDataEntryServiceImpl.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GeoportalDataEntryServiceImpl.java
@@ -5,18 +5,14 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.gcube.application.geoportal.common.model.legacy.AbstractRelazione;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
-import org.gcube.application.geoportal.common.model.legacy.Concessione.Paths;
-import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
-import org.gcube.application.geoportal.common.model.legacy.RelazioneScavo;
-import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
import org.gcube.application.geoportal.common.model.legacy.report.ValidationReport;
import org.gcube.application.geoportal.common.model.rest.AddSectionToConcessioneRequest;
+import org.gcube.application.geoportal.common.model.rest.TempFile;
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
-import org.gcube.application.geoportal.common.rest.TempFile;
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
import org.gcube.application.geoportalcommon.GeoportalCommon;
+import org.gcube.application.geoportalcommon.MockDocumentConfigurationReader;
import org.gcube.application.geoportalcommon.MongoServiceCommon;
import org.gcube.application.geoportalcommon.shared.GNADataEntryConfigProfile;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
@@ -28,6 +24,7 @@ import org.gcube.application.geoportalcommon.shared.config.GcubeUserRole;
import org.gcube.application.geoportalcommon.shared.config.RoleRights;
import org.gcube.application.geoportalcommon.shared.config.RoleRights.OPERATION_TYPE;
import org.gcube.application.geoportalcommon.shared.exception.GNAConfigException;
+import org.gcube.application.geoportalcommon.shared.geoportalconfig.DocumentConfigVO;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV;
@@ -130,6 +127,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
clientMongo = serviceUtil.getInstanceMongoConcessioni();
+ /*
// Saving Data
// Informazioni di Progetto
List list = toMap.get(ConcessioniFormCardTitle.INFORMAZIONI_DI_PROGETTO);
@@ -265,11 +263,14 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
// Building TempFile for ABSTRACT RELAZIONE
if (ardsFiles != null && ardsFiles.size() > 0) {
// saving into back-end
- AddSectionToConcessioneRequest request = new AddSectionToConcessioneRequest(Paths.ABSTRACT_RELAZIONE,
- ardsFiles);
+
+ //TODO MUST BE REVISITED
+
+ AddSectionToConcessioneRequest request = new AddSectionToConcessioneRequest(Paths.ABSTRACT_RELAZIONE, ardsFiles);
clientMongo.registerFileSet(mongoId, request);
LOG.info("Registered the mongoId " + mongoId + " request " + Paths.RELAZIONE + "with "
+ ardsFiles.size() + " file/s");
+
}
// Building TempFile for RELAZIONE DI SCAVO
@@ -278,10 +279,13 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
// Upload file to Concessione. Should be one file.
if (files != null && files.size() > 0) {
// saving into back-end
+ //TODO MUST BE REVISITED
+
AddSectionToConcessioneRequest request = new AddSectionToConcessioneRequest(Paths.RELAZIONE, files);
clientMongo.registerFileSet(mongoId, request);
LOG.info("Registered the mongoId " + mongoId + " request " + Paths.RELAZIONE + "with " + files.size()
+ " file/s");
+
}
// IMMAGINI RAPPRESENTATIVE
@@ -295,11 +299,16 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
// 'for' index
if (files != null && files.size() > 0) {
// saving into back-end
+
+ //TODO MUST BE REVISITED
+
AddSectionToConcessioneRequest request = new AddSectionToConcessioneRequest(Paths.imgByIndex(i),
files);
clientMongo.registerFileSet(mongoId, request);
LOG.info("Registered the mongoId " + mongoId + " request " + Paths.IMMAGINI + "with " + files.size()
+ " file/s");
+
+
}
}
@@ -311,11 +320,14 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
// Upload file to Concessione
if (files != null && files.size() > 0) {
// saving into back-end
+ //TODO MUST BE REVISITED
+
AddSectionToConcessioneRequest request = new AddSectionToConcessioneRequest(Paths.POSIZIONAMENTO,
files);
clientMongo.registerFileSet(mongoId, request);
LOG.info("Registered the mongoId " + mongoId + " request " + Paths.POSIZIONAMENTO + "with "
+ files.size() + " file/s");
+
}
// PIANTE FINE SCAVO
@@ -328,15 +340,18 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
// Upload file to Concessione Section by Path 'Relazione'
if (files != null && files.size() > 0) {
// saving into back-end
+ //TODO MUST BE REVISITED
+
AddSectionToConcessioneRequest request = new AddSectionToConcessioneRequest(
Paths.piantaByIndex(i), files);
clientMongo.registerFileSet(mongoId, request);
LOG.info("Registered the mongoId " + mongoId + " request " + Paths.PIANTE + "with "
+ files.size() + " file/s");
+
}
}
- }
+ }*/
} catch (Exception e) {
LOG.error("Error on converting form data: ", e);
@@ -689,9 +704,9 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
LOG.debug(newFiles.size() + " new file/s has/have been added to list of files");
}
-// if (files == null || files.isEmpty())
-// throw new Exception("Sorry, an error occurred on reading temp files. Refresh and try again");
-
+ //TODO MUST BE REVISITED
+
+ /*
if (section.contains("abstract_relazione")) {
toEditPath = Paths.ABSTRACT_RELAZIONE;
@@ -713,6 +728,10 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
toEditPath = Paths.piantaByIndex(pathIndex);
request = new AddSectionToConcessioneRequest(toEditPath, files);
}
+
+ */
+
+
// Unpublish
LOG.info("Unpublishing " + itemId);
clientMongo.unPublish(itemId);
@@ -838,4 +857,11 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
return gnaDEExtConfig;
}
}
+
+ @Override
+ public DocumentConfigVO getDocumentConfigurationForId(String id){
+ MockDocumentConfigurationReader mock = new MockDocumentConfigurationReader();
+ return mock.getDocumentConfigVO();
+
+ }
}
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/MongoServiceUtil.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/MongoServiceUtil.java
index a092374..72c6c70 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/MongoServiceUtil.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/MongoServiceUtil.java
@@ -12,8 +12,8 @@ import java.util.Comparator;
import java.util.List;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
+import org.gcube.application.geoportal.common.model.rest.TempFile;
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
-import org.gcube.application.geoportal.common.rest.TempFile;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;