diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 9be15b3..3c45b18 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,5 +1,6 @@ - + + @@ -45,7 +46,8 @@ - + + @@ -91,7 +93,8 @@ - + + @@ -137,7 +140,8 @@ - + + @@ -192,7 +196,8 @@ uses - + + @@ -238,7 +243,8 @@ - + + @@ -284,7 +290,8 @@ - + + @@ -330,7 +337,8 @@ - + + 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 e53951e..af6c3e5 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 @@ -3,7 +3,7 @@ package org.gcube.portlets.user.geoportaldataentry.client; import java.util.Arrays; import java.util.List; -import org.gcube.application.geoportalcommon.shared.geoportal.GEOPORTAL_DATA_HANDLER; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER; import org.gcube.portlets.widgets.mpformbuilder.client.ConstantsMPFormBuilder; /** 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 8c995d7..80feee0 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 @@ -18,11 +18,12 @@ import org.gcube.application.geoportalcommon.shared.config.RoleRights; import org.gcube.application.geoportalcommon.shared.config.RoleRights.OPERATION_TYPE; import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV; import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV; -import org.gcube.application.geoportalcommon.shared.geoportal.HandlerDeclarationDV; -import org.gcube.application.geoportalcommon.shared.geoportal.LifecycleInformationDV; -import org.gcube.application.geoportalcommon.shared.geoportal.UseCaseDescriptorDV; +import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV; import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV; import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV; +import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV; import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV; import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_PERFORMED_ON_ITEM; import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent; @@ -898,7 +899,7 @@ public class GeoPortalDataEntryApp implements EntryPoint { List listItemFields = (List) configurationDV.getConfiguration(); // The projection - Map projection = new HashMap(); + LinkedHashMap projection = new LinkedHashMap(); for (ItemFieldDV itemField : listItemFields) { if (itemField.isDisplayAsResult()) { 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 cef9208..523a414 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,7 +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.geoportal.UseCaseDescriptorDV; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV; 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; 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 153cf74..f207a93 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,7 +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.geoportal.UseCaseDescriptorDV; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV; 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; diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/CreateNewProjectEvent.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/CreateNewProjectEvent.java index 39b874e..b3f2c14 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/CreateNewProjectEvent.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/CreateNewProjectEvent.java @@ -2,8 +2,8 @@ package org.gcube.portlets.user.geoportaldataentry.client.events; import java.util.List; -import org.gcube.application.geoportalcommon.shared.geoportal.HandlerDeclarationDV; import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV; import com.google.gwt.event.shared.GwtEvent; diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.java index 539d620..9bd6ce3 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.java @@ -11,11 +11,11 @@ import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER; import org.gcube.application.geoportalcommon.shared.WhereClause; import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV; import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV; -import org.gcube.application.geoportalcommon.shared.geoportal.GEOPORTAL_DATA_HANDLER; -import org.gcube.application.geoportalcommon.shared.geoportal.HandlerDeclarationDV; -import org.gcube.application.geoportalcommon.shared.geoportal.UseCaseDescriptorDV; import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV; import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV; import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEvent; import org.gcube.portlets.user.geoportaldataentry.client.events.GetListOfRecordsEvent; import org.gcube.portlets.user.geoportaldataentry.client.ui.form.GeonaDataEntryMainForm; diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaRecordsPaginatedView.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaRecordsPaginatedView.java index 3b99d42..19be7be 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaRecordsPaginatedView.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaRecordsPaginatedView.java @@ -6,8 +6,8 @@ import java.util.List; import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData; import org.gcube.application.geoportalcommon.shared.SearchingFilter; import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV; -import org.gcube.application.geoportalcommon.shared.geoportal.ProjectDV; import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV; +import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV; import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp; import org.gcube.portlets.user.geoportaldataentry.client.ui.table.ItemsTable; import org.gcube.portlets.user.geoportaldataentry.client.ui.table.SortedCellTable; @@ -163,17 +163,17 @@ public class GeonaRecordsPaginatedView { SelectionModel sm = getCellTable().getSelectionModel(); if (sm instanceof SingleSelectionModel) { - SingleSelectionModel ssm = (SingleSelectionModel) sm; + SingleSelectionModel ssm = (SingleSelectionModel) sm; ssm.clear(); } else if (sm instanceof MultiSelectionModel) { - MultiSelectionModel msm = (MultiSelectionModel) sm; + MultiSelectionModel msm = (MultiSelectionModel) sm; msm.clear(); } getTableDataProvider().updateRowCount((int) result.getTotalItems(), true); // TODO MUST USE PROJECT - getTableDataProvider().updateRowData(result.getClientStartIndex(), toListDocumentDV(result.getData())); + getTableDataProvider().updateRowData(result.getClientStartIndex(),(List) result.getData()); if (result.getData().size() == 0) { getCellTable().setLoadingIndicator(new Label("No data")); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/EditModeRecord.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/EditModeRecord.java index c49f780..17a785c 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/EditModeRecord.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/EditModeRecord.java @@ -1,18 +1,11 @@ package org.gcube.portlets.user.geoportaldataentry.client.ui.edit; -import java.util.List; - +import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV; import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV; -import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV; -import org.gcube.application.geoportalcommon.shared.products.model.RecordDV; -import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV; -import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_PERFORMED_ON_ITEM; import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE; -import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp; import org.gcube.portlets.user.geoportaldataentry.client.events.ActionPerformedOnItemEvent; import org.gcube.portlets.user.geoportaldataentry.client.events.ActionPerformedOnItemEventHandler; import org.gcube.portlets.user.geoportaldataentry.client.ui.edit.jseditor.JSONEditorWrapper; -import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform; import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon; import com.github.gwtbootstrap.client.ui.Button; @@ -24,9 +17,7 @@ import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.Random; -import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HTMLPanel; @@ -99,6 +90,9 @@ public class EditModeRecord extends Composite { } private void instanceUpdateFilesetEditor() { + + Window.alert("instanceJSONEditor must be revisited"); + /* GeoPortalDataEntryApp.geoportalDataEntryService.readFileSetPaths(new AsyncCallback() { @Override @@ -113,7 +107,7 @@ public class EditModeRecord extends Composite { fileSetPaths.getFileSetPaths()); filesUpdatePanel.add(updateFileset); } - }); + });*/ } @@ -124,7 +118,10 @@ public class EditModeRecord extends Composite { fp.getElement().setId("jsoneditor" + Random.nextInt()); fp.setHeight("410px"); rawUpdatePanel.add(fp); + + Window.alert("instanceJSONEditor must be revisited"); + /* GeoPortalDataEntryApp.geoportalDataEntryService.getJSONRecord(selectedConcessione.getItemId(), recordType, new AsyncCallback() { @@ -151,7 +148,7 @@ public class EditModeRecord extends Composite { Window.alert(caught.getMessage()); } - }); + });*/ } /** @@ -167,6 +164,9 @@ public class EditModeRecord extends Composite { buttonJSONUpdate.setEnabled(false); final LoaderIcon loader = new LoaderIcon("Updating the project..."); tabRawUpdate.add(loader); + + Window.alert("buttonJSONUpdate addClickHandler must be revisited"); + /* GeoPortalDataEntryApp.geoportalDataEntryService.updateRecord(selectedConcessione.getItemId(), jsEditor.getText(), recordType, new AsyncCallback() { @@ -181,10 +181,11 @@ public class EditModeRecord extends Composite { } Window.alert("buttonJSONUpdate must be revisited"); - /* - editorManagerBus.fireEvent(new ActionPerformedOnItemEvent(null, - ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT)); - */ + + editorManagerBus.fireEvent(new + ActionPerformedOnItemEvent(null, + ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT)); + } @@ -202,14 +203,14 @@ public class EditModeRecord extends Composite { "Project '" + result.getNome() + "' updated correctly"); di.setZIndex(100000); di.center(); - + Window.alert("buttonJSONUpdate ConcessioneDV must be revisited"); - /* - editorManagerBus.fireEvent(new ActionPerformedOnItemEvent( - Arrays.asList(result), ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT)); - */ + + editorManagerBus.fireEvent(new ActionPerformedOnItemEvent( + Arrays.asList(result), ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT)); + } - }); + });*/ } }); @@ -217,25 +218,30 @@ public class EditModeRecord extends Composite { editorManagerBus.addHandler(ActionPerformedOnItemEvent.TYPE, new ActionPerformedOnItemEventHandler() { @Override - public void onDoActionPerformedFired( + public void onDoActionPerformedFired( ActionPerformedOnItemEvent actionPerformedOnItemEvent) { - ACTION_PERFORMED_ON_ITEM action = actionPerformedOnItemEvent.getAction(); - List items = actionPerformedOnItemEvent.getSelectItems(); - if (items != null) { - selectedConcessione = (BaseConcessioneDV) items.get(0); - instanceJSONEditor(); + Window.alert("ActionPerformedOnItemEvent must be revisited"); - if (action.equals(ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT)) { - - Window.alert("ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT ConcessioneDV must be revisited"); - - /* - appManagerBus.fireEvent(new ActionPerformedOnItemEvent( - (List) items, ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT)); - */ - } - } + /* + * ACTION_PERFORMED_ON_ITEM action = actionPerformedOnItemEvent.getAction(); + * List items = actionPerformedOnItemEvent.getSelectItems(); + * + * if (items != null) { selectedConcessione = (BaseConcessioneDV) items.get(0); + * instanceJSONEditor(); + * + * if (action.equals(ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT)) { + * + * Window. + * alert("ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT ConcessioneDV must be revisited" + * ); + * + * + * appManagerBus.fireEvent(new ActionPerformedOnItemEvent( + * (List) items, ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT)); + * + * } } + */ } }); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/ItemsTable.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/ItemsTable.java index 44005d2..e0fa80e 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/ItemsTable.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/ItemsTable.java @@ -16,7 +16,6 @@ import org.gcube.application.geoportalcommon.shared.products.model.ValidationRep import com.github.gwtbootstrap.client.ui.ButtonCell; import com.github.gwtbootstrap.client.ui.Pagination; import com.google.gwt.core.shared.GWT; -import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.safehtml.shared.SafeHtml; @@ -190,17 +189,17 @@ public class ItemsTable extends AbstractItemsCellTable }; }; - if(i==0) { - //name - sortedCellTable.setColumnWidth(col, 20, Unit.PCT); - }else if (i == 1) { - // intro - sortedCellTable.setColumnWidth(col, 30, Unit.PCT); - } else if (i == 2) { - sortedCellTable.setColumnWidth(col, 15, Unit.PCT); - }else if(i==displayFields.size()-1) { - sortedCellTable.setColumnWidth(col, 120, Unit.PX); - } +// if(i==0) { +// //name +// sortedCellTable.setColumnWidth(col, 20, Unit.PCT); +// }else if (i == 1) { +// // intro +// sortedCellTable.setColumnWidth(col, 30, Unit.PCT); +// } else if (i == 2) { +// sortedCellTable.setColumnWidth(col, 15, Unit.PCT); +// }else if(i==displayFields.size()-1) { +// sortedCellTable.setColumnWidth(col, 120, Unit.PX); +// } sortedCellTable.addColumn(col, itemField.getDisplayName(), true); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/utils/UCD_Util.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/utils/UCD_Util.java index 262b427..5ee645a 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/utils/UCD_Util.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/utils/UCD_Util.java @@ -2,9 +2,9 @@ package org.gcube.portlets.user.geoportaldataentry.client.ui.utils; import java.util.List; -import org.gcube.application.geoportalcommon.shared.geoportal.GEOPORTAL_DATA_HANDLER; -import org.gcube.application.geoportalcommon.shared.geoportal.HandlerDeclarationDV; -import org.gcube.application.geoportalcommon.shared.geoportal.UseCaseDescriptorDV; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV; public class UCD_Util { 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 c5bc4ac..1509d87 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 @@ -4,6 +4,7 @@ import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; @@ -17,7 +18,6 @@ import org.gcube.application.geoportal.common.rest.MongoConcessioni; import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel; import org.gcube.application.geoportalcommon.ConvertToDataViewModel; import org.gcube.application.geoportalcommon.GeoportalCommon; -import org.gcube.application.geoportalcommon.ProjectDVBuilder; import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller; import org.gcube.application.geoportalcommon.geoportal.ProjectsCaller; import org.gcube.application.geoportalcommon.geoportal.UseCaseDescriptorCaller; @@ -31,12 +31,13 @@ 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.geoportal.GEOPORTAL_DATA_HANDLER; -import org.gcube.application.geoportalcommon.shared.geoportal.LifecycleInformationDV; -import org.gcube.application.geoportalcommon.shared.geoportal.ProjectDV; -import org.gcube.application.geoportalcommon.shared.geoportal.UseCaseDescriptorDV; +import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV; +import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV; import org.gcube.application.geoportalcommon.shared.geoportal.config.FilePathDV; import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV; +import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV; 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; @@ -380,54 +381,39 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen ProjectsCaller client = GeoportalClientCaller.projects(); SessionUtil.getCurrentContext(getThreadLocalRequest(), true); - List listProjectDV = SessionUtil.getListOfProjectsForProfileID(getThreadLocalRequest(), + Integer totalProjectForProfile = SessionUtil.getTotalDocumentForProfileID(getThreadLocalRequest(), theProfileID); - ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true); - - //TODO Must be completed. Waiting for https://support.d4science.org/issues/22487 - /* - if (reloadFromService || listProjectDV == null) { - List listProject = client.getListForProfileID(theProfileID); - - listProjectDV = new ArrayList(listProject.size()); - for (Project project : listProject) { - listProjectDV.add(ConvertToDataValueObjectModel.toProjectDV(project, projectBuilder)); - } - SessionUtil.setListOfProjectsForProfileID(getThreadLocalRequest(), theProfileID, listProjectDV); + if (totalProjectForProfile == null) { + totalProjectForProfile = client.getTotalDocument(theProfileID); + SessionUtil.setTotalDocumentForProfileID(getThreadLocalRequest(), theProfileID, totalProjectForProfile); } - int listProjectSize = listProjectDV.size(); - */ - + LOG.info("Total Docs read from config: " + totalProjectForProfile); - int listProjectSize = 50; - LOG.info("WARN HARD_CODING COUNT: "+listProjectSize); + Iterator projects = client.queryOnMongo(theProfileID, totalProjectForProfile, start, limit, + filter); - ResultSetPaginatedData searchedData = client.queryOnMongo(theProfileID, listProjectSize, start, limit, - filter, projectBuilder); + ResultSetPaginatedData searchedData = new ResultSetPaginatedData(start, limit, false); + searchedData.setTotalItems(totalProjectForProfile); -// public ResultSetPaginatedData queryOnMongo(String profileID, Integer totalItems, Integer offset, Integer limit, -// SearchingFilter filter, String recordType, ProjectDVBuilder projectDVBuilder) throws Exception { + List toReturnList = ConvertToDataValueObjectModel.toListResultDocument(projects); - /* - * SessionUtil.getCurrentContext(getThreadLocalRequest(), true); - * MongoServiceCommon serviceCommon = new MongoServiceCommon(); - * - * // TODO MUST BE REPLACED BY COUNT List listOfConcessioni = - * SessionUtil.getListOfConcessioni(getThreadLocalRequest(), reloadFromService); - * int listConcessioniSize = listOfConcessioni.size(); - * - * ResultSetPaginatedData searchedData = - * serviceCommon.queryOnMongo(listConcessioniSize, start, limit, filter, - * "concessione"); return searchedData; - */ + searchedData.setData(toReturnList); + + if (totalProjectForProfile == limit || totalProjectForProfile == 0) { + LOG.debug("Page completed returning " + totalProjectForProfile + " projects"); + int newOffset = start + limit; + searchedData.setServerSearchFinished(newOffset > totalProjectForProfile || totalProjectForProfile == 0); + LOG.debug("is Search finished: " + searchedData.isServerSearchFinished()); + + } if (LOG.isDebugEnabled()) { LOG.debug("returning {}", searchedData.getData()); } - List data = searchedData.getData(); + List data = searchedData.getData(); if (data != null) { LOG.info("returning {} project/s", data.size()); } @@ -897,8 +883,8 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen handlersIds = Arrays.asList(GEOPORTAL_DATA_HANDLER.geoportal_data_entry.getId()); LOG.info("handlersIds is null, so using default: " + handlersIds); } - - //TODO MUST BE USED THE FOLLOWING ONE + + // TODO MUST BE USED THE FOLLOWING ONE // listUseCaseDescriptor = client.getListForHandlerIds(handlersIds); listUseCaseDescriptor = client.getList(); 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 4a7943e..721692a 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 @@ -69,7 +69,8 @@ public class MongoServiceUtil { } public void registerFileSet(String profileID, Project project, String parentPath, String fieldName, - String fieldDefinition, File... files) throws RemoteException, FileNotFoundException, JsonProcessingException, InvalidRequestException { + String fieldDefinition, File... files) + throws RemoteException, FileNotFoundException, JsonProcessingException, InvalidRequestException { LOG.debug("registerFileSet called for profileID: " + profileID); Projects client = getProjectsClient(profileID); @@ -81,6 +82,7 @@ public class MongoServiceUtil { LOG.debug("Resulting Project as JSON: " + Serialization.write(project)); } + /** * Gets the instance mongo concessioni. * diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/SessionUtil.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/SessionUtil.java index 9cee468..4d501f2 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/SessionUtil.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/SessionUtil.java @@ -15,7 +15,7 @@ import org.gcube.application.geoportal.common.rest.MongoConcessioni; import org.gcube.application.geoportalcommon.GeoportalCommon; import org.gcube.application.geoportalcommon.shared.GNADataEntryConfigProfile; import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile; -import org.gcube.application.geoportalcommon.shared.geoportal.ProjectDV; +import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV; import org.gcube.common.authorization.library.provider.SecurityTokenProvider; import org.gcube.common.portal.PortalContext; import org.gcube.common.scope.api.ScopeProvider; @@ -46,6 +46,7 @@ public class SessionUtil { private static final String LIST_OF_CONCESSIONI = "LIST_OF_CONCESSIONI"; private static final String LIST_OF_PROJECTS = "LIST_OF_PROJECTS"; + private static final String COUNT_DOCS_FOR_PROFILE_ID = "COUNT_DOCS_FOR_PROFILE_ID"; /** The log. */ private static Logger LOG = LoggerFactory.getLogger(SessionUtil.class); @@ -134,7 +135,7 @@ public class SessionUtil { * Gets the list of projects for profile ID. * * @param httpServletRequest the http servlet request - * @param profileID the profile ID + * @param profileID the profile ID * @return the list of projects for profile ID * @throws Exception the exception */ @@ -144,16 +145,43 @@ public class SessionUtil { return (List) session.getAttribute(LIST_OF_PROJECTS + profileID); } + /** + * Gets the total document for profile ID. + * + * @param httpServletRequest the http servlet request + * @param theProfileID the the profile ID + * @return the total document for profile ID + */ + public static Integer getTotalDocumentForProfileID(HttpServletRequest httpServletRequest, String theProfileID) { + HttpSession session = httpServletRequest.getSession(); + return (Integer) session.getAttribute(COUNT_DOCS_FOR_PROFILE_ID + theProfileID); + + } + + /** + * Sets the total document for profile ID. + * + * @param httpServletRequest the http servlet request + * @param theProfileID the the profile ID + * @param countForProfileId the count for profile id + */ + public static void setTotalDocumentForProfileID(HttpServletRequest httpServletRequest, String theProfileID, + Integer countForProfileId) { + HttpSession session = httpServletRequest.getSession(); + session.setAttribute(COUNT_DOCS_FOR_PROFILE_ID + theProfileID, countForProfileId); + + } + /** * Sets the list of projects for profile ID. * * @param httpServletRequest the http servlet request - * @param profileID the profile ID - * @param listOfProjects the list of projects + * @param profileID the profile ID + * @param listOfProjects the list of projects * @throws Exception the exception */ - public static void setListOfProjectsForProfileID(HttpServletRequest httpServletRequest, - String profileID, List listOfProjects) throws Exception { + public static void setListOfProjectsForProfileID(HttpServletRequest httpServletRequest, String profileID, + List listOfProjects) throws Exception { HttpSession session = httpServletRequest.getSession(); session.setAttribute(LIST_OF_PROJECTS + profileID, listOfProjects); } @@ -268,4 +296,5 @@ public class SessionUtil { HttpSession session = httpServletRequest.getSession(); session.setAttribute(GNA_DATAENTRY_CONFIG_PROFILE, gNADEConfigProfile); } + } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/shared/CommitReport.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/shared/CommitReport.java index f32afd5..6022964 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/shared/CommitReport.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/shared/CommitReport.java @@ -2,7 +2,7 @@ package org.gcube.portlets.user.geoportaldataentry.shared; import java.io.Serializable; -import org.gcube.application.geoportalcommon.shared.geoportal.LifecycleInformationDV; +import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV; /** * The Class CommitReport. diff --git a/src/test/java/org/gcube/portlets/user/geoportaldataentry/UCD_Tests.java b/src/test/java/org/gcube/portlets/user/geoportaldataentry/UCD_Tests.java index c3f1507..8d1dd02 100644 --- a/src/test/java/org/gcube/portlets/user/geoportaldataentry/UCD_Tests.java +++ b/src/test/java/org/gcube/portlets/user/geoportaldataentry/UCD_Tests.java @@ -8,8 +8,8 @@ import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDes import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel; import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller; import org.gcube.application.geoportalcommon.geoportal.UseCaseDescriptorCaller; -import org.gcube.application.geoportalcommon.shared.geoportal.GEOPORTAL_DATA_HANDLER; -import org.gcube.application.geoportalcommon.shared.geoportal.UseCaseDescriptorDV; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER; +import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV; import org.gcube.common.authorization.library.provider.SecurityTokenProvider; import org.gcube.common.scope.api.ScopeProvider; import org.junit.Before;