diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
index ee3adf4..e41db7d 100644
--- a/.settings/org.eclipse.wst.common.component
+++ b/.settings/org.eclipse.wst.common.component
@@ -47,6 +47,9 @@
+
+ uses
+
diff --git a/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
new file mode 100644
index 0000000..cc81385
--- /dev/null
+++ b/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java
index 5ec2a36..def5f97 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java
@@ -10,4 +10,6 @@ public class ConstantsGeoPortalDataEntryApp {
public static final String HOURS_MINUTES_SEPARATOR = ConstantsMPFormBuilder.HOURS_MINUTES_SEPARATOR;
+ public static final String ERROR_ON_INIZIALITAION_STAGE_PLEASE_CONTACT_THE_SUPPORT = "Error on inizialization stage, please contact the support!";
+
}
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 2c3b46d..3ab7e7b 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,7 @@ import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaDataEntryMainFo
import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaMainPanel;
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardModel;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
+import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
import org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilderServiceAsync;
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
@@ -33,6 +34,8 @@ import com.google.gwt.user.client.ui.RootPanel;
* Entry point classes define onModuleLoad()
.
*/
public class GeoPortalDataEntryApp implements EntryPoint {
+
+
/**
* The message displayed to the user when the server cannot be reached or
* returns an error.
@@ -64,14 +67,38 @@ public class GeoPortalDataEntryApp implements EntryPoint {
*/
public void onModuleLoad() {
- String scope = "/gcube/devsec/devVRE";
- String secondaryType = "GeoNaMetadata";
-
mainPanel = new GeonaMainPanel(appManagerBus);
mainPanel.setLoaderVisible("Loading...", true);
geoNaMainForm = new GeonaDataEntryMainForm(appManagerBus);
+ GreetingServiceAsync.Util.getInstance().getGeonaInitConfig(new AsyncCallback() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ Window.alert(ConstantsGeoPortalDataEntryApp.ERROR_ON_INIZIALITAION_STAGE_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(ConstantsGeoPortalDataEntryApp.ERROR_ON_INIZIALITAION_STAGE_PLEASE_CONTACT_THE_SUPPORT);
+
+ }
+ });
+
+ bindEvents();
+ mainPanel.addFormPanel(geoNaMainForm);
+ RootPanel.get(DIV_PORTLET_ID).add(mainPanel);
+
+ }
+
+
+ private void callGetMetadataProfiles(String scope, String secondaryType) {
+
MetadataProfileFormBuilderServiceAsync.Util.getInstance().getProfilesInTheScope(scope, secondaryType, new AsyncCallback>() {
@Override
@@ -85,11 +112,6 @@ public class GeoPortalDataEntryApp implements EntryPoint {
public void onFailure(Throwable caught) {
}
});
-
- bindEvents();
- mainPanel.addFormPanel(geoNaMainForm);
- RootPanel.get(DIV_PORTLET_ID).add(mainPanel);
-
}
private void buildNewCards(Collection orderedCards) {
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GreetingService.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GreetingService.java
index 62ec218..5bcc2df 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GreetingService.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GreetingService.java
@@ -3,6 +3,7 @@ package org.gcube.portlets.user.geoportaldataentry.client;
import java.util.List;
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
+import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@@ -14,4 +15,6 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
public interface GreetingService extends RemoteService {
String saveGeonaDataForms(List listGeonaFormObjects) throws Exception;
+
+ GeonaISConfig getGeonaInitConfig();
}
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GreetingServiceAsync.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GreetingServiceAsync.java
index dd7b3e1..07cbf76 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GreetingServiceAsync.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GreetingServiceAsync.java
@@ -3,6 +3,7 @@ package org.gcube.portlets.user.geoportaldataentry.client;
import java.util.List;
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
+import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -34,4 +35,7 @@ public interface GreetingServiceAsync
void saveGeonaDataForms(List listGeonaFormObjects, AsyncCallback callback);
+
+
+ void getGeonaInitConfig(AsyncCallback callback);
}
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GreetingServiceImpl.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GreetingServiceImpl.java
index 698c995..2d16bbd 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GreetingServiceImpl.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GreetingServiceImpl.java
@@ -17,6 +17,7 @@ import org.gcube.application.geoportal.model.content.WorkspaceContent;
import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitle;
import org.gcube.portlets.user.geoportaldataentry.client.GreetingService;
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
+import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploaded;
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
@@ -31,6 +32,7 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
@SuppressWarnings("serial")
public class GreetingServiceImpl extends RemoteServiceServlet implements GreetingService {
+ public static final String GEONA_GENERIC_RESOURCE_SECONDARY_TYPE = "GEONA_GENERIC_RESOURCE_SECONDARY_TYPE";
private static final Logger LOG = LoggerFactory.getLogger(GreetingServiceImpl.class);
@Override
@@ -177,6 +179,28 @@ public class GreetingServiceImpl extends RemoteServiceServlet implements Greetin
return "Project saved with errors";
}
+ @Override
+ public GeonaISConfig getGeonaInitConfig() {
+ LOG.info("getConfig called");
+
+ String scope = SessionUtil.getCurrentContext(this.getThreadLocalRequest(), false);
+ String theSecondaryType;
+ try {
+ theSecondaryType = this.getServletContext().getInitParameter(GEONA_GENERIC_RESOURCE_SECONDARY_TYPE);
+ } catch (Exception e) {
+ LOG.error("I cannot read the init parameter for: " + GEONA_GENERIC_RESOURCE_SECONDARY_TYPE, e);
+ theSecondaryType = "GeoNaMetadata";
+ }
+
+ LOG.warn("\n\n\nHARD-CABLING THE SCOPE, PLEASE REMOTE IT!!!!\n\n\n");
+ scope = "/gcube/devsec/devVRE";
+
+ GeonaISConfig configs = new GeonaISConfig(theSecondaryType, scope);
+ LOG.info("returning config: "+configs);
+ return configs;
+ }
+
+
private void prettyPrintClientDataEntryMap(HashMap> toMap) {
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/shared/GeonaISConfig.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/shared/GeonaISConfig.java
new file mode 100644
index 0000000..4e35d33
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/shared/GeonaISConfig.java
@@ -0,0 +1,55 @@
+package org.gcube.portlets.user.geoportaldataentry.shared;
+
+import java.io.Serializable;
+
+public class GeonaISConfig implements Serializable{
+
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -6700506811708315617L;
+
+ String gRSecondaryType;
+ String scope;
+
+ public GeonaISConfig() {
+ }
+
+ public GeonaISConfig(String gRSecondaryType, String scope) {
+ super();
+ this.gRSecondaryType = gRSecondaryType;
+ this.scope = scope;
+ }
+
+
+ public String getgRSecondaryType() {
+ return gRSecondaryType;
+ }
+
+ public void setgRSecondaryType(String gRSecondaryType) {
+ this.gRSecondaryType = gRSecondaryType;
+ }
+
+ public String getScope() {
+ return scope;
+ }
+
+ public void setScope(String scope) {
+ this.scope = scope;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("GeonaISConfig [gRSecondaryType=");
+ builder.append(gRSecondaryType);
+ builder.append(", scope=");
+ builder.append(scope);
+ builder.append("]");
+ return builder.toString();
+ }
+
+
+
+}
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
index 12efa8d..739b165 100644
--- a/src/main/webapp/WEB-INF/web.xml
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -35,6 +35,11 @@
/GeoPortalDataEntryApp/metadataProfileFormBuilderUploadServlet
+
+ GEONA_GENERIC_RESOURCE_SECONDARY_TYPE
+ GeoNaMetadata
+
+