Loading from (mock of) geoportal configuration, done

This commit is contained in:
Francesco Mangiacrapa 2022-03-03 18:44:21 +01:00
parent 0cd6880a54
commit 4a725573c9
14 changed files with 306 additions and 256 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry including="**/*.java" kind="src" output="target/geoportal-data-entry-app-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry including="**/*.java" kind="src" output="target/geoportal-data-entry-app-3.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
@ -30,5 +30,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/geoportal-data-entry-app-2.1.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/geoportal-data-entry-app-3.0.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -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

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
@ -22,8 +22,20 @@
<wb-module deploy-name="geoportal-data-entry-app-2.1.0-SNAPSHOT">
<wb-module deploy-name="geoportal-data-entry-app-3.0.0-SNAPSHOT">
@ -47,7 +59,13 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
@ -71,7 +89,13 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
@ -95,10 +119,22 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<dependent-module archiveName="geoportal-data-common-1.3.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
<dependent-module archiveName="metadata-profile-form-builder-widget-2.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/metadata-profile-form-builder-widget/metadata-profile-form-builder-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="metadata-profile-discovery-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/metadata-profile-discovery/metadata-profile-discovery">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="geoportal-data-common-2.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
<dependency-type>uses</dependency-type>
</dependent-module>
@ -122,7 +158,13 @@
<property name="context-root" value="geoportal-data-entry-app"/>
@ -146,7 +188,13 @@
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/>
@ -170,7 +218,13 @@
</wb-module>

View File

@ -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

13
pom.xml
View File

@ -14,7 +14,7 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>geoportal-data-entry-app</artifactId>
<packaging>war</packaging>
<version>2.1.0</version>
<version>3.0.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>
@ -87,6 +87,13 @@
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<!-- REMOVE THIS -->
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<scope>provided</scope>
<version>7.1</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
@ -101,7 +108,7 @@
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>metadata-profile-form-builder-widget</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
@ -139,7 +146,7 @@
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-data-common</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>

View File

@ -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;
}
}

View File

@ -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<ItemField> displayFields = new ArrayList<ItemField>();
private List<ItemField> sortByFields = new ArrayList<ItemField>();
private List<ItemField> searchByFields = new ArrayList<ItemField>();
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<List<ItemField>>() {
GeoportalDataEntryServiceAsync.Util.getInstance().getGeonaInitConfig(new AsyncCallback<GeonaISConfig>() {
@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<ItemField> 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<GNADataEntryExtConfigProfile>() {
@ -240,105 +244,9 @@ public class GeoPortalDataEntryApp implements EntryPoint {
mainTabPanel.instanceAndShowListOfConcessioni();
return;
}
GeoportalDataEntryServiceAsync.Util.getInstance().getGeonaInitConfig(new AsyncCallback<GeonaISConfig>() {
@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<UserRights>() {
//
// @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<GeonaISConfig>() {
//
// @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<GeoNaFormCardModel>();
//TODO PASS THE RIGHT ID
GeoportalDataEntryServiceAsync.Util.getInstance().getDocumentConfigurationForId("id", new AsyncCallback<DocumentConfigVO>() {
@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<Integer, GeoNaFormCardModel> treemapOrderedGeoNaProfiles = new TreeMap<Integer, GeoNaFormCardModel>();
for (int i = 0; i<expectedCards; i++) {
GcubeProfileVO gcubeProfiles = config.getGcubeProfiles().get(i);
final int order = i;
GWT.log("calling getProfilesInTheScope for secondaryType: "+gcubeProfiles.getGcubeSecondaryType()+", name: "+gcubeProfiles.getGcubeName());
MetadataProfileFormBuilderServiceAsync.Util.getInstance().getProfilesInTheScopeForName(scope, gcubeProfiles.getGcubeSecondaryType(), gcubeProfiles.getGcubeName(),
new AsyncCallback<List<MetaDataProfileBean>>() {
@Override
public void onSuccess(List<MetaDataProfileBean> 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<List<MetaDataProfileBean>>() {
@Override
public void onSuccess(List<MetaDataProfileBean> 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<GeoNaFormCardModel> orderedCards) {
private void buildNewCards(Collection<GeoNaFormCardModel> 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<GeoNaFormCardModel> setGeoNaFormsOrder(List<MetaDataProfileBean> listMetadataProfilesForGeona) {
TreeMap<Integer, GeoNaFormCardModel> treemapOrderedGeoNaProfiles = new TreeMap<Integer, GeoNaFormCardModel>();
List<GeoNaFormCardModel> listUnknownType = new ArrayList<GeoNaFormCardModel>();
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);
}
}

View File

@ -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);
}

View File

@ -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<GNADataEntryExtConfigProfile> asyncCallback);
void getDocumentConfigurationForId(String id, AsyncCallback<DocumentConfigVO> callback);
}

View File

@ -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();
}
}

View File

@ -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

View File

@ -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);

View File

@ -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<GeoNaFormDataObject> 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();
}
}

View File

@ -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;