Improved GUI. Fixed some issues on Update facility

This commit is contained in:
Francesco Mangiacrapa 2023-04-21 16:34:11 +02:00
parent e8b3c59a6d
commit fbbc84e6e4
5 changed files with 32 additions and 24 deletions

View File

@ -203,7 +203,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
@Override
public void onFailure(Throwable caught) {
String errorMsg = "Sorry, an error occurrend when loading configurations. Please, contact the support";
String errorMsg = "Sorry, an error occurred when loading configurations. Please, contact the support";
Alert alert = new Alert(errorMsg, AlertType.ERROR);
alert.setClose(false);
try {
@ -234,7 +234,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
@Override
public void onFailure(Throwable caught) {
String errorMsg = "Sorry, an error occurrend on istancing the application. Please, contact the support";
String errorMsg = "Sorry, an error occurred on istancing the application. Please, contact the support";
Alert alert = new Alert(errorMsg, AlertType.ERROR);
alert.setClose(false);
try {
@ -315,7 +315,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
@Override
public void onFailure(Throwable caught) {
String errorMsg = "Sorry, an error occurrend on loading configurations. Please, contact the support";
String errorMsg = "Sorry, an error occurred on loading configurations. Please, contact the support";
Alert alert = new Alert(errorMsg, AlertType.ERROR);
alert.setClose(false);
try {
@ -1569,7 +1569,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
// }
UpdateRecord ur = new UpdateRecord(appManagerBus, resultDocumentDV.getProfileID(),
resultDocumentDV.getId(), height);
resultDocumentDV.getId(), width, height);
if (isNotInDRAFT) {
ur.noUpdateMode();

View File

@ -79,7 +79,7 @@ public class ActionListPanel extends Composite {
Button butt = new Button();
butt.setText(actionDefinitionDV.getTitle());
butt.setTitle(actionDefinitionDV.getDescription());
butt.setType(ButtonType.LINK);
butt.setType(ButtonType.INFO);
butt.addClickHandler(new ClickHandler() {
@Override

View File

@ -89,7 +89,7 @@ public class UpdateRecord extends Composite {
private HandlerManager appManagerBus;
public UpdateRecord(HandlerManager appManagerBus, String profileID, String projectID, int modalHeight) {
public UpdateRecord(HandlerManager appManagerBus, String profileID, String projectID, int modalWidth, int modalHeight) {
initWidget(uiBinder.createAndBindUi(this));
this.appManagerBus = appManagerBus;
this.profileID = profileID;
@ -101,6 +101,8 @@ public class UpdateRecord extends Composite {
alertHTMLPanel.add(loaderProjectSections);
scrollSectionContent.setHeight((modalHeight-300)+"px");
listBoxSections.setWidth((modalWidth-50)+"px");
GeoportalDataEntryServiceAsync.Util.getInstance().getProjectEdit(profileID, projectID,
new AsyncCallback<ProjectEdit>() {
@ -259,7 +261,7 @@ public class UpdateRecord extends Composite {
modal.setCloseVisible(true);
modal.setTitle("Error :-(");
panelContainer.clear();
String errorMsg = "Sorry, an error occurrend when updating the project with id: "+projectID+". Please, try again. If the problem persists, please contact the support";
String errorMsg = "Sorry, an error occurred when updating the project with id: "+projectID+". Please, try again. If the problem persists, please contact the support";
Alert alert = new Alert(errorMsg, AlertType.ERROR);
alert.setClose(false);
modal.add(alert);

View File

@ -180,7 +180,9 @@ public class FormDataObjectToJSON {
// value is a list
JSONArray array = new JSONArray();
for (String value : listValues) {
array.put(value);
if(value!=null && !value.isEmpty()) {
array.put(value);
}
}
sectJSONObject.put(key, array);

View File

@ -293,32 +293,36 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
Document updatedDocument = Serialization.read(newDocJson.toString(), Document.class);
LOG.info("New document is: {}", updatedDocument.toJson());
//Project project = client.updateProject(profileID, projectID, updatedDocument);
Project project = client.getProjectByID(profileID, projectID);
Project project = client.updateProject(profileID, projectID, updatedDocument);
// Project project = client.getProjectByID(profileID, projectID);
LOG.debug("Medatata Updated with document: {}", project.getTheDocument());
SessionUtil.getCurrentContext(getThreadLocalRequest(), true);
if(listFilePaths!=null) {
//Cleaning all the fileset path of the section (defined in the UCD)
for (FilePathDV filePath: listFilePaths) {
if (listFilePaths != null) {
// Cleaning all the fileset path of the section (defined in the UCD)
for (FilePathDV filePath : listFilePaths) {
String filesetFieldName = filePath.getFieldName();
String filesetPath = sectionPath+"."+filesetFieldName;
//Replacing $.abc with $..abc
String filesetPath = sectionPath + "." + filesetFieldName;
// Replacing $.abc with $..abc
filesetPath = filesetPath.replaceFirst("\\.", "..");
LOG.info("Going to delete fileset path: {}", filesetPath);
//client.deleteFileset(profileID, projectID, filesetPath, true);
try {
client.deleteFileset(profileID, projectID, filesetPath, true);
} catch (Exception e) {
LOG.warn("Error on into project id {} the fileset path {} ", projectID, filesetPath);
}
}
//Registering new files
// Registering new files
List<? extends FileUploaded> filesUploaded = sectionBean.getFilesUploaded();
if(filesUploaded!=null && !filesUploaded.isEmpty()) {
if (filesUploaded != null && !filesUploaded.isEmpty()) {
replaceFiles(project, sectionPath, section.getGcubeProfileDV(), filesUploaded);
}
}
LOG.info("Project with id " + project.getId() + " updated correclty");
ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true);
ProjectDV toProjectDV = ConvertToDataValueObjectModel.toProjectDV(project, projectBuilder);
@ -568,8 +572,8 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
Access access = ConvertToDataServiceModel.getAccessFromDocumentSection(theJSONDocument, sectionJSONPath);
LOG.info("Going to registrer files: " + Arrays.asList(fileset).toString());
// mongoService.registerFileSet(theProject.getProfileID(), theProject, sectionJSONPath,
// filePath.getFieldName(), filePath.getFieldDefinition(), access, fileset);
mongoService.registerFileSet(theProject.getProfileID(), theProject, sectionJSONPath,
filePath.getFieldName(), filePath.getFieldDefinition(), access, fileset);
}
}