diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 8ec4e48..9bafa34 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,5 +1,7 @@ - + + + @@ -78,7 +80,9 @@ - + + + @@ -157,7 +161,9 @@ - + + + @@ -236,7 +242,9 @@ - + + + @@ -315,7 +323,9 @@ - + + + @@ -349,7 +359,9 @@ uses - + + + @@ -428,7 +440,9 @@ - + + + @@ -507,7 +521,9 @@ - + + + @@ -586,7 +602,9 @@ - + + + diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f0cdcc..40fd724 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,12 +9,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - [#24166] Implemented the Update facility - [#24244] Integrated with the geoportal-data-mapper library -## [v3.0.1-SNAPSHOT] - 2022-12-13 +## [v3.0.1] - 2023-01-19 #### Fixes - [#24281] Fixed filtering selection label - [#24049] Fixed "Show on Map" facility vs Chrome browser +- [#24432] Fixing serialization issue using LinkedHashMap instead of LinkedHashMap +- [#24458] Published projects cannot be edited/updated ## [v3.0.0] - 2022-11-09 @@ -31,6 +33,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - [#23926] Integrated a Post Creation Action in the UCD and manage it - [#24136] Integrated the temporal dimension on the front-end side + ## [v2.2.1] - 2022-06-29 #### Enhancements diff --git a/pom.xml b/pom.xml index 3872747..023bc60 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ - 2.9.0 + 2.10.0 ${project.build.directory}/${project.build.finalName} UTF-8 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 fcb9b0a..a51ed6a 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.application.geoportalcommon.shared.config.RoleRights; import org.gcube.application.geoportalcommon.shared.config.RoleRights.OPERATION_TYPE; import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV; import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV; +import org.gcube.application.geoportalcommon.shared.geoportal.WORKFLOW_PHASE; 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; @@ -457,6 +458,37 @@ public class GeoPortalDataEntryApp implements EntryPoint { } } + /** + * Builds the new form card model from profile. + * + * @param gcubeProfile the gcube profile + * @param order the order + * @param metaDataProfileBean the meta data profile bean + * @param operation the operation + * @return the geo na form card model + */ + private GeoNaFormCardModel buildNewFormCardModelFromProfile(GcubeProfileDV gcubeProfile, int order, + MetaDataProfileBean metaDataProfileBean, OPERATION operation) { + + // Managing Forms repeatability + int minOccurs = gcubeProfile.getMinOccurs(); + minOccurs = minOccurs <= 0 ? 0 : minOccurs; + int maxOccurs = gcubeProfile.getMaxOccurs(); + maxOccurs = maxOccurs <= 0 ? Integer.MAX_VALUE : maxOccurs; + + // TODO MUST BE MANAGED MIN_OCCURS + ProjectFormCard cct = new ProjectFormCard(gcubeProfile.getSectionName(), gcubeProfile.getSectionTitle(), order, + maxOccurs > 1, minOccurs, maxOccurs); + + GeoNaFormCardModel geoNaFormCardModel = new GeoNaFormCardModel(metaDataProfileBean, null, cct, gcubeProfile); + + CreateMetadataForm baseForm = new CreateMetadataForm(Arrays.asList(geoNaFormCardModel.getMetadataProfileBean()), + appManagerBus, operation); + geoNaFormCardModel.setMetadataForm(baseForm); + + return geoNaFormCardModel; + } + private void buildNewCards(String profileID, String itemTypeTitle, Collection orderedCards) { projectSavedWithSuccess = false; // resetting state of saving @@ -1486,8 +1518,8 @@ public class GeoPortalDataEntryApp implements EntryPoint { modal3.setTitle( "Edit: " + resultDocumentDV.getId() + ""); - modal3.setWidth(950); - modal3.setHeight("700px"); +// modal3.setWidth(950); +// modal3.setHeight("700px"); modal3.setCloseVisible(true); ((Element) modal3.getElement().getChildNodes().getItem(1)) .addClassName("modal-body-custom"); @@ -1496,9 +1528,38 @@ public class GeoPortalDataEntryApp implements EntryPoint { int width = Window.getClientWidth() * 70 / 100; modal3.setWidth(width); modal3.setHeight(height + "px"); + + + boolean isPublishedProject = false; + + if(resultDocumentDV.getLifecycleInfo()!=null) { + String phase = resultDocumentDV.getLifecycleInfo().getPhase(); + if(phase!=null && phase.compareToIgnoreCase(WORKFLOW_PHASE.PUBLISHED.getLabel())==0) { + + Alert alert = new Alert("A '"+WORKFLOW_PHASE.PUBLISHED.getLabel()+"' project cannot be updated."); + alert.setType(AlertType.WARNING); + alert.setClose(false); + modal3.add(alert); + + isPublishedProject = true; + } + } + +// EditModeRecord emr = new EditModeRecord(appManagerBus, resultDocumentDV); +// modal3.add(emr); +// modal3.show(); +// +// if(isPublishedProject) { +// emr.noUpdateMode(); +// } UpdateRecord ur = new UpdateRecord(appManagerBus, resultDocumentDV.getProfileID(), resultDocumentDV.getId()); + + if(isPublishedProject) { + ur.noUpdateMode(); + } + modal3.add(ur); modal3.show(); 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 0e89bf3..076f75e 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 @@ -114,6 +114,10 @@ public class EditModeRecord extends Composite { } + public void noUpdateMode() { + buttonJSONUpdate.setVisible(false); + } + private void instanceJSONEditor() { rawUpdatePanel.clear(); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/UpdateRecord.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/UpdateRecord.java index 85ae64f..1128f7f 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/UpdateRecord.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/edit/UpdateRecord.java @@ -10,6 +10,7 @@ import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon; import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm.OPERATION; import com.github.gwtbootstrap.client.ui.Alert; +import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.ControlGroup; import com.github.gwtbootstrap.client.ui.ListBox; import com.github.gwtbootstrap.client.ui.constants.AlertType; @@ -47,6 +48,9 @@ public class UpdateRecord extends Composite { @UiField ControlGroup controlsControlGroup; + + @UiField + Button buttonUpdate; public static final String PLACEHOLDER_LIST_BOX = "Select section..."; @@ -122,5 +126,9 @@ public class UpdateRecord extends Composite { } }); } + + public void noUpdateMode() { + buttonUpdate.setVisible(false); + } } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/relation/ViewRelationshipPanel.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/relation/ViewRelationshipPanel.java index 7b878ed..ce9d4cc 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/relation/ViewRelationshipPanel.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/relation/ViewRelationshipPanel.java @@ -140,7 +140,7 @@ public class ViewRelationshipPanel extends Composite { secondProjectPanelContainer.clear(); this.fromTheProject = project; - Entry firstEntrySet = project.getFirstEntryOfMap(); + Entry firstEntrySet = project.getFirstEntryOfMap(); String htmlMsg = firstEntrySet.getKey() + ": " + firstEntrySet.getValue() + " (id: " + project.getId() + ")"; @@ -203,7 +203,7 @@ public class ViewRelationshipPanel extends Composite { @Override public void onSuccess(ResultDocumentDV result) { mapOfTargetProjectForId.put(relationDV.getTargetUCD(), result); - Entry firstEntrySet = result.getFirstEntryOfMap(); + Entry firstEntrySet = result.getFirstEntryOfMap(); String htmlMsg = firstEntrySet.getKey() + ": " + firstEntrySet.getValue() + " (id: " + result.getId() + ")"; 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 86fec7f..b0296c6 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 @@ -523,26 +523,26 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen searchedData.setTotalItems(totalProjectForProfile); LOG.info("Total Docs read from config: " + totalProjectForProfile); - + // Saving client PROJECTION LinkedHashMap originalProjection = filter.getProjection(); int totalItems = totalProjectForProfile; - // PERFORMING FIRST QUERY FOR IDS IF AND ONLY IF WHERE CONDITIONS IN THE QUERY. - // SEARCHING FACILITY IS ENACTING. - if (filter.getConditions() != null) { - + //PERFORMING FIRST QUERY FOR IDS IF AND ONLY IF WHERE CONDITIONS IN THE QUERY. + //SEARCHING FACILITY IS ENACTING. + if(filter.getConditions()!=null) { + // Setting PROJECTION ONLY FOR PROEJCT ID LinkedHashMap projectionForIDs = new LinkedHashMap(); projectionForIDs.put(Project.ID, 1); filter.setProjection(projectionForIDs); - + // FIRST QUERY TO RETRIEVE IDs // LIMIT IS NULL MEANS THAT IT IS EQUAL TO NUMBER TOTAL OF DOCUMENTS - // Calculating always the size starting from 0 + //Calculating always the size starting from 0 final Iterator projectsIDs = client.queryOnMongo(theProfileID, totalProjectForProfile, 0, null, filter); - - // Getting the Project IDs from the Iterable + + //Getting the Project IDs from the Iterable Iterable itP = () -> projectsIDs; Stream targetStream = StreamSupport.stream(itP.spliterator(), false); List listProjectIDs = targetStream.map(Project::getId).collect(Collectors.toList()); @@ -550,12 +550,13 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen searchedData.setTotalItems(totalItems); LOG.info("Total Docs read from query per ID: " + totalItems); } - - // NOW PERFORMING THE (REAL) SECOND QUERY FROM CLIENT + + //NOW PERFORMING THE (REAL) SECOND QUERY FROM CLIENT // SETTING ORIGINAL PROJECTION FROM CLIENT filter.setProjection(originalProjection); // LIMIT IS FROM CLIENT - Iterator projects = client.queryOnMongo(theProfileID, totalItems, start, limit, filter); + Iterator projects = client.queryOnMongo(theProfileID, totalItems, start, limit, + filter); searchedData.setClientStartIndex(start); searchedData.setLimit(limit); @@ -563,10 +564,9 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen List toReturnList = ConvertToDataValueObjectModel.toListResultDocument(projects); searchedData.setData(toReturnList); - - LOG.info( - "Total Docs page size returned:" + toReturnList.size() + ", start: " + start + ", limit: " + limit); - + + LOG.info("Total Docs page size returned:" + toReturnList.size() + ", start: " + start + ", limit: " + limit); + if (totalProjectForProfile == limit || totalProjectForProfile == 0) { LOG.debug("Page completed returning " + totalProjectForProfile + " projects"); int newOffset = start + limit; diff --git a/src/main/webapp/GeoPortalDataEntryApp.css b/src/main/webapp/GeoPortalDataEntryApp.css index 6387bfb..e902c8c 100644 --- a/src/main/webapp/GeoPortalDataEntryApp.css +++ b/src/main/webapp/GeoPortalDataEntryApp.css @@ -270,4 +270,42 @@ h1 { .no_modal_body_max_height .modal-body { max-height: 90% !important; -} \ No newline at end of file +} + + +/** OVERRDING legend-style into 'metadata-profile-form-builder-widget' */ + +.legend-style { + width: auto !important; + padding-left: 10px !important; + padding-top: 0px !important; + padding-right: 10px !important; + margin-bottom: 0px !important; + border-bottom: 0px !important; +} + +.legend-style small { + display: block; + font-size: 12px !important; +} + +/** END OVERRDING legend-style into 'metadata-profile-form-builder-widget' */ + + +/** OVERRDING legend-style into 'metadata-profile-form-builder-widget' */ + +.legend-style { + width: auto !important; + padding-left: 10px !important; + padding-top: 0px !important; + padding-right: 10px !important; + margin-bottom: 0px !important; + border-bottom: 0px !important; +} + +.legend-style small { + display: block; + font-size: 12px !important; +} + +/** END OVERRDING legend-style into 'metadata-profile-form-builder-widget' */ \ No newline at end of file