Merged with version 3.0.1 on master

3e01fba65a
This commit is contained in:
Francesco Mangiacrapa 2023-01-30 14:47:33 +01:00
parent f1b8777ca0
commit 63102043a5
9 changed files with 164 additions and 32 deletions

View File

@ -56,6 +56,8 @@
@ -135,6 +137,8 @@
@ -214,6 +218,8 @@
@ -293,6 +299,8 @@
@ -334,6 +342,8 @@
@ -406,6 +416,8 @@
@ -485,6 +497,8 @@
@ -564,6 +578,8 @@
@ -643,6 +659,8 @@

View File

@ -9,12 +9,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- [#24166] Implemented the Update facility - [#24166] Implemented the Update facility
- [#24244] Integrated with the geoportal-data-mapper library - [#24244] Integrated with the geoportal-data-mapper library
## [v3.0.1-SNAPSHOT] - 2022-12-13 ## [v3.0.1] - 2023-01-19
#### Fixes #### Fixes
- [#24281] Fixed filtering selection label - [#24281] Fixed filtering selection label
- [#24049] Fixed "Show on Map" facility vs Chrome browser - [#24049] Fixed "Show on Map" facility vs Chrome browser
- [#24432] Fixing serialization issue using LinkedHashMap<String, String> instead of LinkedHashMap<String, Object>
- [#24458] Published projects cannot be edited/updated
## [v3.0.0] - 2022-11-09 ## [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 - [#23926] Integrated a Post Creation Action in the UCD and manage it
- [#24136] Integrated the temporal dimension on the front-end side - [#24136] Integrated the temporal dimension on the front-end side
## [v2.2.1] - 2022-06-29 ## [v2.2.1] - 2022-06-29
#### Enhancements #### Enhancements

View File

@ -25,7 +25,7 @@
<properties> <properties>
<!-- Convenience property to set the GWT version --> <!-- Convenience property to set the GWT version -->
<gwt.version>2.9.0</gwt.version> <gwt.version>2.10.0</gwt.version>
<!-- GWT needs at least java 1.6 --> <!-- GWT needs at least java 1.6 -->
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory> <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

View File

@ -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.config.RoleRights.OPERATION_TYPE;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV; import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV; 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.GcubeProfileDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV; 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.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<GeoNaFormCardModel> orderedCards) { private void buildNewCards(String profileID, String itemTypeTitle, Collection<GeoNaFormCardModel> orderedCards) {
projectSavedWithSuccess = false; // resetting state of saving projectSavedWithSuccess = false; // resetting state of saving
@ -1486,8 +1518,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
modal3.setTitle( modal3.setTitle(
"<span style='font-size:20px;'>Edit: <span style='color:#555; font-size:20px;'>" "<span style='font-size:20px;'>Edit: <span style='color:#555; font-size:20px;'>"
+ resultDocumentDV.getId() + "</span></span>"); + resultDocumentDV.getId() + "</span></span>");
modal3.setWidth(950); // modal3.setWidth(950);
modal3.setHeight("700px"); // modal3.setHeight("700px");
modal3.setCloseVisible(true); modal3.setCloseVisible(true);
((Element) modal3.getElement().getChildNodes().getItem(1)) ((Element) modal3.getElement().getChildNodes().getItem(1))
.addClassName("modal-body-custom"); .addClassName("modal-body-custom");
@ -1497,9 +1529,38 @@ public class GeoPortalDataEntryApp implements EntryPoint {
modal3.setWidth(width); modal3.setWidth(width);
modal3.setHeight(height + "px"); 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(), UpdateRecord ur = new UpdateRecord(appManagerBus, resultDocumentDV.getProfileID(),
resultDocumentDV.getId()); resultDocumentDV.getId());
if(isPublishedProject) {
ur.noUpdateMode();
}
modal3.add(ur); modal3.add(ur);
modal3.show(); modal3.show();
break; break;

View File

@ -114,6 +114,10 @@ public class EditModeRecord extends Composite {
} }
public void noUpdateMode() {
buttonJSONUpdate.setVisible(false);
}
private void instanceJSONEditor() { private void instanceJSONEditor() {
rawUpdatePanel.clear(); rawUpdatePanel.clear();

View File

@ -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 org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm.OPERATION;
import com.github.gwtbootstrap.client.ui.Alert; 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.ControlGroup;
import com.github.gwtbootstrap.client.ui.ListBox; import com.github.gwtbootstrap.client.ui.ListBox;
import com.github.gwtbootstrap.client.ui.constants.AlertType; import com.github.gwtbootstrap.client.ui.constants.AlertType;
@ -48,6 +49,9 @@ public class UpdateRecord extends Composite {
@UiField @UiField
ControlGroup controlsControlGroup; ControlGroup controlsControlGroup;
@UiField
Button buttonUpdate;
public static final String PLACEHOLDER_LIST_BOX = "Select section..."; public static final String PLACEHOLDER_LIST_BOX = "Select section...";
private LoaderIcon loaderProjectSections = new LoaderIcon("Loading Project sections..., please wait"); private LoaderIcon loaderProjectSections = new LoaderIcon("Loading Project sections..., please wait");
@ -123,4 +127,8 @@ public class UpdateRecord extends Composite {
}); });
} }
public void noUpdateMode() {
buttonUpdate.setVisible(false);
}
} }

View File

@ -140,7 +140,7 @@ public class ViewRelationshipPanel extends Composite {
secondProjectPanelContainer.clear(); secondProjectPanelContainer.clear();
this.fromTheProject = project; this.fromTheProject = project;
Entry<String, Object> firstEntrySet = project.getFirstEntryOfMap(); Entry<String, String> firstEntrySet = project.getFirstEntryOfMap();
String htmlMsg = firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b> (id: " + project.getId() String htmlMsg = firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b> (id: " + project.getId()
+ ")"; + ")";
@ -203,7 +203,7 @@ public class ViewRelationshipPanel extends Composite {
@Override @Override
public void onSuccess(ResultDocumentDV result) { public void onSuccess(ResultDocumentDV result) {
mapOfTargetProjectForId.put(relationDV.getTargetUCD(), result); mapOfTargetProjectForId.put(relationDV.getTargetUCD(), result);
Entry<String, Object> firstEntrySet = result.getFirstEntryOfMap(); Entry<String, String> firstEntrySet = result.getFirstEntryOfMap();
String htmlMsg = firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() String htmlMsg = firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue()
+ "</b> (id: " + result.getId() + ")"; + "</b> (id: " + result.getId() + ")";

View File

@ -527,9 +527,9 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
// Saving client PROJECTION // Saving client PROJECTION
LinkedHashMap<String, Object> originalProjection = filter.getProjection(); LinkedHashMap<String, Object> originalProjection = filter.getProjection();
int totalItems = totalProjectForProfile; int totalItems = totalProjectForProfile;
// PERFORMING FIRST QUERY FOR IDS IF AND ONLY IF WHERE CONDITIONS IN THE QUERY. //PERFORMING FIRST QUERY FOR IDS IF AND ONLY IF WHERE CONDITIONS IN THE QUERY.
// SEARCHING FACILITY IS ENACTING. //SEARCHING FACILITY IS ENACTING.
if (filter.getConditions() != null) { if(filter.getConditions()!=null) {
// Setting PROJECTION ONLY FOR PROEJCT ID // Setting PROJECTION ONLY FOR PROEJCT ID
LinkedHashMap<String, Object> projectionForIDs = new LinkedHashMap<String, Object>(); LinkedHashMap<String, Object> projectionForIDs = new LinkedHashMap<String, Object>();
@ -538,11 +538,11 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
// FIRST QUERY TO RETRIEVE IDs // FIRST QUERY TO RETRIEVE IDs
// LIMIT IS NULL MEANS THAT IT IS EQUAL TO NUMBER TOTAL OF DOCUMENTS // 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<Project> projectsIDs = client.queryOnMongo(theProfileID, totalProjectForProfile, 0, null, final Iterator<Project> projectsIDs = client.queryOnMongo(theProfileID, totalProjectForProfile, 0, null,
filter); filter);
// Getting the Project IDs from the Iterable //Getting the Project IDs from the Iterable
Iterable<Project> itP = () -> projectsIDs; Iterable<Project> itP = () -> projectsIDs;
Stream<Project> targetStream = StreamSupport.stream(itP.spliterator(), false); Stream<Project> targetStream = StreamSupport.stream(itP.spliterator(), false);
List<String> listProjectIDs = targetStream.map(Project::getId).collect(Collectors.toList()); List<String> listProjectIDs = targetStream.map(Project::getId).collect(Collectors.toList());
@ -551,11 +551,12 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
LOG.info("Total Docs read from query per ID: " + 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 // SETTING ORIGINAL PROJECTION FROM CLIENT
filter.setProjection(originalProjection); filter.setProjection(originalProjection);
// LIMIT IS FROM CLIENT // LIMIT IS FROM CLIENT
Iterator<Project> projects = client.queryOnMongo(theProfileID, totalItems, start, limit, filter); Iterator<Project> projects = client.queryOnMongo(theProfileID, totalItems, start, limit,
filter);
searchedData.setClientStartIndex(start); searchedData.setClientStartIndex(start);
searchedData.setLimit(limit); searchedData.setLimit(limit);
@ -564,8 +565,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
List<ResultDocumentDV> toReturnList = ConvertToDataValueObjectModel.toListResultDocument(projects); List<ResultDocumentDV> toReturnList = ConvertToDataValueObjectModel.toListResultDocument(projects);
searchedData.setData(toReturnList); searchedData.setData(toReturnList);
LOG.info( LOG.info("Total Docs page size returned:" + toReturnList.size() + ", start: " + start + ", limit: " + limit);
"Total Docs page size returned:" + toReturnList.size() + ", start: " + start + ", limit: " + limit);
if (totalProjectForProfile == limit || totalProjectForProfile == 0) { if (totalProjectForProfile == limit || totalProjectForProfile == 0) {
LOG.debug("Page completed returning " + totalProjectForProfile + " projects"); LOG.debug("Page completed returning " + totalProjectForProfile + " projects");

View File

@ -271,3 +271,41 @@ h1 {
.no_modal_body_max_height .modal-body { .no_modal_body_max_height .modal-body {
max-height: 90% !important; max-height: 90% !important;
} }
/** 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' */