Removed old model "Concessioni"

This commit is contained in:
Francesco Mangiacrapa 2022-11-09 15:12:42 +01:00
parent 9dd99c5d73
commit 2029544649
7 changed files with 629 additions and 826 deletions

View File

@ -34,6 +34,8 @@
@ -91,6 +93,8 @@
@ -148,6 +152,8 @@
@ -205,6 +211,8 @@
@ -235,10 +243,11 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="geoportal-data-common-2.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
<dependency-type>uses</dependency-type>
</dependent-module>
@ -331,6 +340,8 @@
@ -388,6 +399,8 @@
@ -445,6 +458,8 @@

View File

@ -11,15 +11,11 @@ import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleI
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
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;
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
import org.gcube.portlets.user.geoportaldataentry.shared.GNADataEntryExtendedConfigProfile;
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
import org.gcube.portlets.user.geoportaldataentry.shared.GeoportalISConfig;
import org.gcube.portlets.user.geoportaldataentry.shared.Tree_Node;
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@ -89,29 +85,6 @@ public interface GeoportalDataEntryService extends RemoteService {
*/
ProjectDV updateRecord(String profileID, String projectID, String jsonUpdate) throws Exception;
/**
* Read file set paths.
*
* @return the file set paths DV
* @throws Exception the exception
*/
FileSetPathsDV readFileSetPaths() throws Exception;
/**
* Update record.
*
* @param itemId the item id
* @param recordType the record type
* @param section the section
* @param pathIndex the path index
* @param keepCurrentContent the keep current content
* @param gDBean the g D bean
* @return the updated JSON string representing the itemId
* @throws Exception the exception
*/
ConcessioneDV updateSectionForRecord(String itemId, String recordType, String section, int pathIndex,
List<WorkspaceContentDV> keepCurrentContent, GenericDatasetBean gDBean) throws Exception;
/**
* Read data viewer config.
*

View File

@ -11,15 +11,11 @@ import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleI
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
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;
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
import org.gcube.portlets.user.geoportaldataentry.shared.GNADataEntryExtendedConfigProfile;
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
import org.gcube.portlets.user.geoportaldataentry.shared.GeoportalISConfig;
import org.gcube.portlets.user.geoportaldataentry.shared.Tree_Node;
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
@ -67,12 +63,6 @@ public interface GeoportalDataEntryServiceAsync {
void updateRecord(String profileID, String projectID, String jsonUpdate, AsyncCallback<ProjectDV> callback);
void readFileSetPaths(AsyncCallback<FileSetPathsDV> callback);
void updateSectionForRecord(String itemId, String recordType, String section, int pathIndex,
List<WorkspaceContentDV> keepCurrentContent, GenericDatasetBean gDBean,
AsyncCallback<ConcessioneDV> callback);
void readDataViewerConfig(AsyncCallback<GNADataEntryExtendedConfigProfile> asyncCallback);
void getListUseCaseDescriptors(List<String> handlersIds, AsyncCallback<List<UseCaseDescriptorDV>> callback);

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">
@ -30,8 +30,8 @@
visible="false">
<b:ControlLabel>Manage the content of</b:ControlLabel>
<b:Controls ui:field="controlsContent">
<!-- <b:ListBox ui:field="listBoxIndex" -->
<!-- addStyleNames="{style.width-500}"></b:ListBox> -->
<b:ListBox ui:field="listBoxIndex"
addStyleNames="{style.width-500}"></b:ListBox>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup>
@ -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

@ -23,7 +23,6 @@ import org.gcube.application.geoportal.common.model.useCaseDescriptor.Relationsh
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
import org.gcube.application.geoportal.common.utils.StorageUtils;
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;
@ -49,9 +48,6 @@ 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.RelationshipDefinitionDV;
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;
import org.gcube.common.portal.PortalContext;
import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendException;
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryService;
@ -89,8 +85,6 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
public static final String GEONA_GENERIC_RESOURCE_SECONDARY_TYPE = "GEONA_GENERIC_RESOURCE_SECONDARY_TYPE";
private static final Logger LOG = LoggerFactory.getLogger(GeoportalDataEntryServiceImpl.class);
// private String tmpDirsLocation = System.getProperty("java.io.tmpdir");
/**
* Gets the GNA data entry config profile.
*
@ -555,34 +549,6 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
}
/**
* Pretty print client data entry map.
*
* @param toMap the to map
*/
private void prettyPrintClientDataEntryMap(HashMap<ProjectFormCard, List<GeoNaFormDataObject>> toMap) {
for (ProjectFormCard theType : toMap.keySet()) {
LOG.debug("\n\n");
LOG.debug(theType.toString());
List<GeoNaFormDataObject> list = toMap.get(theType);
for (GeoNaFormDataObject geoNaFormDataObject : list) {
LOG.debug("\t has " + geoNaFormDataObject.getListGDB().size() + " data bean/s");
int i = 0;
for (GenericDatasetBean gbd : geoNaFormDataObject.getListGDB()) {
LOG.debug("\t " + ++i + ") " + GenericDatasetBean.class.getSimpleName() + " entries:");
Map<String, List<String>> map = gbd.getFormDataEntryFields();
for (String keyEntry : map.keySet()) {
LOG.debug("\t " + keyEntry + ": " + map.get(keyEntry));
}
for (FileUploaded fup : gbd.getFilesUploaded()) {
LOG.debug("\t " + fup);
}
}
}
}
}
/**
* Delete project.
*
@ -680,113 +646,6 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
}
}
/**
* Read file set paths.
*
* @return the list
* @throws Exception the exception
*/
@Override
public FileSetPathsDV readFileSetPaths() throws Exception {
LOG.info("readFileSetPaths called");
return ConvertToDataViewModel.getFileSetPaths();
}
/**
* Update record.
*
* @param itemId the item id
* @param recordType the record type
* @param section the section
* @param pathIndex the path index
* @param keepCurrentContent the keep current content
* @param gDBean the g D bean
* @return the updated JSON string representing the itemId
* @throws Exception the exception
*/
@Override
public ConcessioneDV updateSectionForRecord(String itemId, String recordType, String section, int pathIndex,
List<WorkspaceContentDV> keepCurrentContent, GenericDatasetBean gDBean) throws Exception {
LOG.info("updateSectionForRecord called with itemId: " + itemId + ", section: " + section + ", pathIndex: "
+ pathIndex + ", gDBean: " + gDBean, "");
try {
throw new Exception("updateSectionForRecord not implemented!");
/*
* if (itemId == null) throw new Exception("Item id is null");
*
* if (recordType.equalsIgnoreCase(RECORD_TYPE.CONCESSIONE.name())) {
* SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
* MongoServiceUtil serviceUtil = new MongoServiceUtil(); MongoConcessioni
* clientMongo = serviceUtil.getInstanceMongoConcessioni();
*
* String toEditPath = null; AddSectionToConcessioneRequest request = null;
* List<TempFile> files = new ArrayList<TempFile>();
*
* // Managing files already present as current content and kept by user
* List<TempFile> keepFiles = serviceUtil.toTemFilesFromWSC(keepCurrentContent);
* if (keepFiles != null) { files.addAll(keepFiles); LOG.debug(keepFiles.size()
* + " current corrent file/s has/have been added to list of files"); }
*
* // Managing new files uploaded by user List<TempFile> newFiles =
* serviceUtil.toTemFiles(gDBean.getFilesUploaded()); if (newFiles != null) {
* files.addAll(newFiles); LOG.debug(newFiles.size() +
* " new file/s has/have been added to list of files"); }
*
* // TODO MUST BE REVISITED
*
*
* if (section.contains("abstract_relazione")) {
*
* toEditPath = Paths.ABSTRACT_RELAZIONE; request = new
* AddSectionToConcessioneRequest(toEditPath, files);
*
* } else if (section.contains("immagini")) { toEditPath =
* Paths.imgByIndex(pathIndex); request = new
* AddSectionToConcessioneRequest(toEditPath, files);
*
* } else if (section.contains("relazione")) { toEditPath = Paths.RELAZIONE;
* request = new AddSectionToConcessioneRequest(toEditPath, files);
*
* } else if (section.contains("posizionamentoScavo")) { toEditPath =
* Paths.POSIZIONAMENTO; request = new
* AddSectionToConcessioneRequest(toEditPath, files);
*
* } else if (section.contains("piante")) { toEditPath =
* Paths.piantaByIndex(pathIndex); request = new
* AddSectionToConcessioneRequest(toEditPath, files); }
*
*
* // Unpublish LOG.info("Unpublishing " + itemId);
* clientMongo.unPublish(itemId);
*
* // update Fileset LOG.info("Removing old fileset.. "); Concessione
* concessione = clientMongo.cleanFileSet(itemId, toEditPath);
*
* LOG.debug("Sending new Fileset .."); if (files.size() > 0) { // StorageUtils
* storage=new StorageUtils(); // Building TempFile
* SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
* LOG.info("Registering FileSet into recordId " + itemId +
* " with request path: " + toEditPath + " and: " + files.size() + " file/s");
* concessione = clientMongo.registerFileSet(itemId, request); } else {
* LOG.info("Fileset is empty, skipping registerFileSet"); }
*
* LOG.info("Publishing itemId: " + itemId); concessione =
* clientMongo.publish(itemId);
*
* LOG.debug("returning concessione: " + concessione); return
* ConvertToDataViewModel.toConcessione(concessione); }
*
*/
} catch (Exception e) {
LOG.error("Error on updating the project with item id: " + itemId, e);
throw new Exception(
"Error occurred on updating the project with id: " + itemId + ". Error: " + e.getMessage());
}
}
/**
* Read data viewer config.
*
@ -1154,4 +1013,32 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
}
/**
* Pretty print client data entry map.
*
* @param toMap the to map
*/
private void prettyPrintClientDataEntryMap(HashMap<ProjectFormCard, List<GeoNaFormDataObject>> toMap) {
for (ProjectFormCard theType : toMap.keySet()) {
LOG.debug("\n\n");
LOG.debug(theType.toString());
List<GeoNaFormDataObject> list = toMap.get(theType);
for (GeoNaFormDataObject geoNaFormDataObject : list) {
LOG.debug("\t has " + geoNaFormDataObject.getListGDB().size() + " data bean/s");
int i = 0;
for (GenericDatasetBean gbd : geoNaFormDataObject.getListGDB()) {
LOG.debug("\t " + ++i + ") " + GenericDatasetBean.class.getSimpleName() + " entries:");
Map<String, List<String>> map = gbd.getFormDataEntryFields();
for (String keyEntry : map.keySet()) {
LOG.debug("\t " + keyEntry + ": " + map.get(keyEntry));
}
for (FileUploaded fup : gbd.getFilesUploaded()) {
LOG.debug("\t " + fup);
}
}
}
}
}
}

View File

@ -6,19 +6,15 @@ import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPl
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import org.bson.Document;
import org.gcube.application.geoportal.client.utils.Serialization;
import org.gcube.application.geoportal.common.faults.InvalidRequestException;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
import org.gcube.application.geoportal.common.model.rest.TempFile;
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
@ -26,8 +22,6 @@ import org.gcube.application.geoportal.common.rest.Projects;
import org.gcube.application.geoportal.common.rest.UseCaseDescriptorsI;
import org.gcube.application.geoportal.common.utils.FileSets;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendException;
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploaded;
import org.slf4j.Logger;
@ -141,32 +135,32 @@ public class MongoServiceUtil {
return files;
}
/**
* To tem files from WSC.
*
* @param listFiles the list files
* @return the list
*/
public List<TempFile> toTemFilesFromWSC(List<WorkspaceContentDV> listFiles) {
LOG.debug("toTemFilesFromWSC called");
if (listFiles == null || listFiles.isEmpty())
return null;
// Building TempFile
List<TempFile> files = new ArrayList<TempFile>(listFiles.size());
for (WorkspaceContentDV fileUploaded : listFiles) {
InputStream is;
try {
is = new URL(fileUploaded.getLink()).openStream();
// Creating TempFile
TempFile storageTempFile = createTempFileOnStorage(is, fileUploaded.getName());
files.add(storageTempFile);
} catch (IOException e) {
LOG.error("Error on creating temp file from URL: " + fileUploaded.getLink(), e);
}
}
return files;
}
// /**
// * To tem files from WSC.
// *
// * @param listFiles the list files
// * @return the list
// */
// public List<TempFile> toTemFilesFromWSC(List<WorkspaceContentDV> listFiles) {
// LOG.debug("toTemFilesFromWSC called");
// if (listFiles == null || listFiles.isEmpty())
// return null;
//
// // Building TempFile
// List<TempFile> files = new ArrayList<TempFile>(listFiles.size());
// for (WorkspaceContentDV fileUploaded : listFiles) {
// InputStream is;
// try {
// is = new URL(fileUploaded.getLink()).openStream();
// // Creating TempFile
// TempFile storageTempFile = createTempFileOnStorage(is, fileUploaded.getName());
// files.add(storageTempFile);
// } catch (IOException e) {
// LOG.error("Error on creating temp file from URL: " + fileUploaded.getLink(), e);
// }
// }
// return files;
// }
/**
* To JSON.
@ -189,60 +183,4 @@ public class MongoServiceUtil {
}
}
/**
* The Class ConcessioneValidationReportStatusComparator.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 14, 2021
*/
public static class ConcessioneValidationReportStatusComparator implements Comparator<Concessione> {
/**
* Compare.
*
* @param o1 the o 1
* @param o2 the o 2
* @return the int
*/
@Override
public int compare(Concessione o1, Concessione o2) {
if (o1 == null || o1.getReport() == null || o1.getReport().getStatus() == null)
return 1;
if (o2 == null || o2.getReport() == null || o2.getReport().getStatus() == null)
return -1;
return o1.getReport().getStatus().name().compareTo(o2.getReport().getStatus().name());
}
}
/**
* The Class ConcessioneDVValidationReportStatusComparator.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 16, 2021
*/
public static class ConcessioneDVValidationReportStatusComparator implements Comparator<ConcessioneDV> {
/**
* Compare.
*
* @param o1 the o 1
* @param o2 the o 2
* @return the int
*/
@Override
public int compare(ConcessioneDV o1, ConcessioneDV o2) {
if (o1.getValidationStatus() == null)
return 1;
if (o2.getValidationStatus() == null)
return -1;
return o1.getValidationStatus().name().compareTo(o2.getValidationStatus().name());
}
}
}