in progress

This commit is contained in:
Francesco Mangiacrapa 2023-03-17 12:41:56 +01:00
parent ccb66f083d
commit 861df3980a
7 changed files with 677 additions and 590 deletions

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
@ -82,7 +86,11 @@
<wb-module deploy-name="geoportal-data-entry-app-3.2.0-SNAPSHOT">
@ -165,7 +173,11 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
@ -248,7 +260,11 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
@ -331,7 +347,11 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
@ -366,7 +386,20 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="geoportal-data-mapper-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-mapper/geoportal-data-mapper">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="metadata-profile-form-builder-widget-2.1.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="geoportal-data-common-2.0.3-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
<dependency-type>uses</dependency-type>
</dependent-module>
@ -449,7 +482,11 @@
<property name="context-root" value="geoportal-data-entry-app"/>
@ -532,7 +569,11 @@
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/>
@ -615,7 +656,11 @@
</wb-module>

View File

@ -9,7 +9,7 @@ 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.1.0-SNAPSHOT] - 2023-02-09
## [v3.1.0] - 2023-03-06
#### Enhancements

View File

@ -18,12 +18,15 @@ 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.materialization.innerobject.FilesetDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
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.RelationshipDefinitionDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
import org.gcube.application.geoportaldatamapper.shared.MetaDataProfileBeanExt;
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_PERFORMED_ON_ITEM;
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalClientCaches.CacheSearchingFilterParametersFromConfig;
import org.gcube.portlets.user.geoportaldataentry.client.events.ClickItemEvent;
@ -72,6 +75,8 @@ import org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilde
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 org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploaded;
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploadedRemote;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.Button;
@ -382,8 +387,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
}
private void createNewDataEntyFor(String profileID, HandlerDeclarationDV handlerDeclarationDV,
List<GcubeProfileDV> listGPs) {
private <T extends MetaDataProfileBean> void createNewDataEntyFor(String profileID,
HandlerDeclarationDV handlerDeclarationDV, List<GcubeProfileDV> listGPs) {
dataEntryProjectCreated = true;
mainTabPanel.setLoaderVisible("Loading...", true);
// orderedCards.clear();
@ -412,10 +417,18 @@ public class GeoPortalDataEntryApp implements EntryPoint {
final int order = i;
GWT.log("calling getProfilesInTheScope for secondaryType: " + gcubeProfile.getGcubeSecondaryType()
+ ", name: " + gcubeProfile.getGcubeName());
MetadataProfileFormBuilderServiceAsync.Util.getInstance().getProfilesInTheScopeForName(
geoportalISConfigs.getScope(), gcubeProfile.getGcubeSecondaryType(), gcubeProfile.getGcubeName(),
new AsyncCallback<List<MetaDataProfileBean>>() {
@Override
public void onFailure(Throwable caught) {
mainTabPanel.setLoaderVisible("Loading...", false);
Window.alert(caught.getMessage());
}
@Override
public void onSuccess(List<MetaDataProfileBean> result) {
@ -446,12 +459,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
// orderedCards.addAll(new ArrayList<GeoNaFormCardModel>(gnaCardsModels));
buildNewCards(profileID, handlerDeclarationDV.getItemType(), listGNAFormCardModel);
}
}
@Override
public void onFailure(Throwable caught) {
mainTabPanel.setLoaderVisible("Loading...", false);
Window.alert(caught.getMessage());
}
});
@ -1528,14 +1536,14 @@ public class GeoPortalDataEntryApp implements EntryPoint {
int width = Window.getClientWidth() * 70 / 100;
modal3.setWidth(width);
modal3.setHeight(height + "px");
//#24569
// #24569
boolean isNotInDRAFT = false;
if (resultDocumentDV.getLifecycleInfo() != null) {
String phase = resultDocumentDV.getLifecycleInfo().getPhase();
// IF the project is not in DRAFT phase, showing an alert and no Update Mode will
// IF the project is not in DRAFT phase, showing an alert and no Update Mode
// will
// be activated
if (phase != null && phase.compareToIgnoreCase(WORKFLOW_PHASE.DRAFT.getLabel()) != 0) {
@ -1559,19 +1567,18 @@ public class GeoPortalDataEntryApp implements EntryPoint {
UpdateRecord ur = new UpdateRecord(appManagerBus, resultDocumentDV.getProfileID(),
resultDocumentDV.getId());
if(isNotInDRAFT) {
if (isNotInDRAFT) {
ur.noUpdateMode();
}
modal3.add(ur);
modal3.show();
break;
}
case CREATE_RELATION: {
//#24571
// #24571
boolean isNotInDRAFT = false;
if (resultDocumentDV.getLifecycleInfo() != null) {
@ -1588,8 +1595,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
isNotInDRAFT = true;
}
}
//Allowing the Create Relation only in DRAFT phase
// Allowing the Create Relation only in DRAFT phase
if (!isNotInDRAFT) {
mainTabPanel.showCreateRelationPanel(true, resultDocumentDV);
}
@ -1818,8 +1825,9 @@ public class GeoPortalDataEntryApp implements EntryPoint {
* @param appManagerBus the app manager bus
* @return the geo na form card model
*/
public static GeoNaFormCardModel buildNewFormCardModelFromProfile(GcubeProfileDV gcubeProfile, int order,
MetaDataProfileBean metaDataProfileBean, OPERATION operation, HandlerManager appManagerBus) {
public static <T extends MetaDataProfileBean> GeoNaFormCardModel buildNewFormCardModelFromProfile(
GcubeProfileDV gcubeProfile, int order, T metaDataProfileBean, OPERATION operation,
HandlerManager appManagerBus) {
// Managing Forms Repeatability
int minOccurs = gcubeProfile.getMinOccurs();
@ -1831,13 +1839,50 @@ public class GeoPortalDataEntryApp implements EntryPoint {
ProjectFormCard cct = new ProjectFormCard(gcubeProfile.getSectionName(), gcubeProfile.getSectionTitle(), order,
maxOccurs > 1, minOccurs, maxOccurs);
List<FilesetDV> fileset = null;
if (metaDataProfileBean instanceof MetaDataProfileBeanExt) {
MetaDataProfileBeanExt metaDataProfileBeanExt = (MetaDataProfileBeanExt) metaDataProfileBean;
fileset = metaDataProfileBeanExt.getListFileset();
}
GeoNaFormCardModel geoNaFormCardModel = new GeoNaFormCardModel(metaDataProfileBean, null, cct, gcubeProfile);
CreateMetadataForm baseForm = new CreateMetadataForm(Arrays.asList(geoNaFormCardModel.getMetadataProfileBean()),
appManagerBus, operation);
CreateMetadataForm baseForm = null;
if (fileset == null) {
GWT.log("Instancing CreateMetadataForm without files");
baseForm = new CreateMetadataForm(Arrays.asList(geoNaFormCardModel.getMetadataProfileBean()), appManagerBus,
operation);
} else {
GWT.log("Instancing CreateMetadataForm with files");
List<? extends FileUploaded> files = toListFileUploadedRemote(fileset);
baseForm = new CreateMetadataForm(Arrays.asList(geoNaFormCardModel.getMetadataProfileBean()), appManagerBus,
operation, files);
}
geoNaFormCardModel.setMetadataForm(baseForm);
return geoNaFormCardModel;
}
public static List<? extends FileUploaded> toListFileUploadedRemote(List<FilesetDV> fileset) {
if (fileset == null || fileset.size() == 0)
return null;
List<FileUploadedRemote> fileUploaded = new ArrayList<FileUploadedRemote>();
FilesetDV listFiles = fileset.get(0);
for (PayloadDV payload : listFiles.getListPayload()) {
FileUploadedRemote fu = new FileUploadedRemote();
fu.setFileName(payload.getName());
fu.setUrl(payload.getLink());
fu.setMimeType(payload.getMimetype());
fileUploaded.add(fu);
}
return fileUploaded;
}
}

View File

@ -5,9 +5,9 @@ import org.gcube.portlets.user.geoportaldataentry.client.ProjectFormCard;
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
public class GeoNaFormCardModel {
public class GeoNaFormCardModel<T extends MetaDataProfileBean> {
private MetaDataProfileBean metadataProfileBean;
private T metadataProfileBean;
private CreateMetadataForm metadataForm;
private ProjectFormCard formCard; // matching with metadata profile
private GcubeProfileDV gcubeProfile;
@ -16,8 +16,8 @@ public class GeoNaFormCardModel {
}
public GeoNaFormCardModel(MetaDataProfileBean metadataProfileBean, CreateMetadataForm metadataForm,
ProjectFormCard formCard, GcubeProfileDV gcubeProfile) {
public GeoNaFormCardModel(T metadataProfileBean, CreateMetadataForm metadataForm, ProjectFormCard formCard,
GcubeProfileDV gcubeProfile) {
super();
this.metadataProfileBean = metadataProfileBean;
this.metadataForm = metadataForm;
@ -25,11 +25,11 @@ public class GeoNaFormCardModel {
this.gcubeProfile = gcubeProfile;
}
public MetaDataProfileBean getMetadataProfileBean() {
public T getMetadataProfileBean() {
return metadataProfileBean;
}
public void setMetadataProfileBean(MetaDataProfileBean metadataProfileBean) {
public void setMetadataProfileBean(T metadataProfileBean) {
this.metadataProfileBean = metadataProfileBean;
}

View File

@ -1,4 +1,4 @@
<!-- <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
@ -47,4 +47,4 @@
addStyleNames="{style.button-save-style}" ui:field="buttonUpdate"
visible="false">UPDATE</b:Button>
</g:HTMLPanel>
</ui:UiBinder> -->
</ui:UiBinder>

View File

@ -22,7 +22,6 @@ import org.bson.Document;
import org.gcube.application.geoportal.client.utils.Serialization;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.document.access.Access;
import org.gcube.application.geoportal.common.model.document.access.AccessPolicy;
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
import org.gcube.application.geoportal.common.model.rest.TempFile;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.RelationshipDefinition;
@ -81,8 +80,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.spi.json.JsonOrgJsonProvider;
/**
* The server side implementation of the RPC service.
@ -1197,9 +1194,9 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
for (String keyEntry : map.keySet()) {
LOG.debug("\t " + keyEntry + ": " + map.get(keyEntry));
}
for (FileUploaded fup : gbd.getFilesUploaded()) {
LOG.debug("\t " + fup);
}
// for (FileUploaded fup : gbd.getFilesUploaded()) {
// LOG.debug("\t " + fup);
// }
}
}
}