Fixing search facility
This commit is contained in:
parent
b3345a4b5f
commit
941805a596
|
@ -137,7 +137,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
RootPanel.get(APP_DIV).add(loaderApp);
|
||||
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance()
|
||||
.listOfFieldsForSearching(new AsyncCallback<List<ItemFieldsResponse>>() {
|
||||
.getConfigListOfFieldsForSearching(new AsyncCallback<List<ItemFieldsResponse>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
|
|
@ -145,7 +145,7 @@ public interface GeoportalDataViewerService extends RemoteService {
|
|||
* @return the list
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
List<ItemFieldsResponse> listOfFieldsForSearching() throws Exception;
|
||||
List<ItemFieldsResponse> getConfigListOfFieldsForSearching() throws Exception;
|
||||
|
||||
// /**
|
||||
// * Gets the list concessioni.
|
||||
|
|
|
@ -66,7 +66,7 @@ public interface GeoportalDataViewerServiceAsync {
|
|||
|
||||
void getListBaseLayers(AsyncCallback<List<BaseMapLayer>> callback);
|
||||
|
||||
void listOfFieldsForSearching(AsyncCallback<List<ItemFieldsResponse>> callback);
|
||||
void getConfigListOfFieldsForSearching(AsyncCallback<List<ItemFieldsResponse>> callback);
|
||||
|
||||
// void getListConcessioni(Integer start, Integer limit, SearchingFilter filter, boolean reloadFromService,
|
||||
// AsyncCallback<ResultSetPaginatedData> callback);
|
||||
|
|
|
@ -204,7 +204,7 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
this.currentSearchFacility.resetCurrentSearch();
|
||||
|
||||
searchFacilityPanel.clear();
|
||||
this.currentSearchFacility = new SearchFacilityUI(ucd.getProfileID(), applicationBus, sortByFields, searchByFields,
|
||||
this.currentSearchFacility = new SearchFacilityUI(ucd.getProfileID(), applicationBus, displayFields, sortByFields, searchByFields,
|
||||
initialSortFilter);
|
||||
searchFacilityPanel.add(currentSearchFacility);
|
||||
currentSearchFacility.setSearchButton(searchFacilityButton);
|
||||
|
|
|
@ -10,8 +10,6 @@ import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView;
|
|||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.OLUtil;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.ModalWindow;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dialogs.DialogShareableLink;
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
|||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEvent;
|
||||
|
@ -111,6 +110,8 @@ public class SearchFacilityUI extends Composite {
|
|||
|
||||
private String profileID;
|
||||
|
||||
private List<ItemFieldDV> displayByFields;
|
||||
|
||||
/**
|
||||
* The Interface SearchFacilityPanelUiBinder.
|
||||
*
|
||||
|
@ -130,10 +131,11 @@ public class SearchFacilityUI extends Composite {
|
|||
* @param searchForFields the search for fields
|
||||
* @param initialSortFilter the initial sort filter
|
||||
*/
|
||||
public SearchFacilityUI(String profileID, HandlerManager appManagerBus, List<ItemFieldDV> sortByFields,
|
||||
public SearchFacilityUI(String profileID, HandlerManager appManagerBus,List<ItemFieldDV> displayByFields, List<ItemFieldDV> sortByFields,
|
||||
List<ItemFieldDV> searchForFields, SearchingFilter initialSortFilter) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.profileID = profileID;
|
||||
this.displayByFields = displayByFields;
|
||||
this.searchForFields = searchForFields;
|
||||
this.currentSortFilter = initialSortFilter;
|
||||
this.sortByFields = sortByFields;
|
||||
|
@ -301,7 +303,7 @@ public class SearchFacilityUI extends Composite {
|
|||
ft.getElement().setClassName("table-results");
|
||||
int i = 0;
|
||||
// Table headers
|
||||
for (ItemFieldDV itemField : searchForFields) {
|
||||
for (ItemFieldDV itemField : displayByFields) {
|
||||
|
||||
if (i > MAX_COLUMNS_RESULTS) {
|
||||
break;
|
||||
|
@ -352,7 +354,7 @@ public class SearchFacilityUI extends Composite {
|
|||
ft.setWidget(i, 0, locateOnMap);
|
||||
int j = 0;
|
||||
// Other columns
|
||||
for (ItemFieldDV itemField : searchForFields) {
|
||||
for (ItemFieldDV itemField : displayByFields) {
|
||||
|
||||
if (j > MAX_COLUMNS_RESULTS) {
|
||||
break;
|
||||
|
|
|
@ -14,7 +14,6 @@ import java.util.Map.Entry;
|
|||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.bson.Document;
|
||||
import org.gcube.application.geoportal.common.model.configuration.Configuration;
|
||||
|
@ -521,107 +520,6 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
return listDAO;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Gets the preview image for concessione from http session. It is the first
|
||||
// * image retrieved from mongoService for mongoConcessioneId. Caching it into
|
||||
// * session
|
||||
// *
|
||||
// * @param httpServletRequest the http servlet request
|
||||
// * @param itemType the item type
|
||||
// * @param mongoConcessioneId the mongo concessione id
|
||||
// * @return the preview image for concessione
|
||||
// */
|
||||
// private UploadedImageDV sessionloadPreviewImageForConcessione(HttpServletRequest httpServletRequest,
|
||||
// String itemType, String mongoConcessioneId) {
|
||||
// LOG.info("sessionloadPreviewImageForConcessione [mongoConcessioneId: " + mongoConcessioneId + ", itemType: "
|
||||
// + itemType + "] called");
|
||||
//
|
||||
// HttpSession session = httpServletRequest.getSession();
|
||||
// Map<String, List<UploadedImageDV>> mapImages = null;
|
||||
// List<UploadedImageDV> lUI = null;
|
||||
// try {
|
||||
// mapImages = (LinkedHashMap) session.getAttribute(CACHE_IMAGE_PREVIEW_FOR_CONCESSIONE);
|
||||
//
|
||||
// if (mapImages == null) {
|
||||
// mapImages = new LinkedHashMap<String, List<UploadedImageDV>>();
|
||||
// }
|
||||
//
|
||||
// List<UploadedImageDV> imagePreviewForConcessione = mapImages.get(mongoConcessioneId);
|
||||
//
|
||||
// if (imagePreviewForConcessione == null || imagePreviewForConcessione.size() == 0) {
|
||||
// LOG.info("Into " + CACHE_IMAGE_PREVIEW_FOR_CONCESSIONE + " object session the mongoConcessioneId "
|
||||
// + mongoConcessioneId + " is empty or null, loading from service and filling it");
|
||||
// lUI = getUploadedImagesForId(httpServletRequest, itemType, mongoConcessioneId, 1);
|
||||
// mapImages.put(mongoConcessioneId, lUI);
|
||||
// }
|
||||
//
|
||||
// lUI = mapImages.get(mongoConcessioneId);
|
||||
// LOG.info("From " + CACHE_IMAGE_PREVIEW_FOR_CONCESSIONE + " object session read image: " + lUI);
|
||||
// session.setAttribute(CACHE_IMAGE_PREVIEW_FOR_CONCESSIONE, mapImages);
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// LOG.warn("Error occurred when instancing the " + UrlShortener.class.getSimpleName(), e);
|
||||
// }
|
||||
//
|
||||
// if (lUI == null || lUI.isEmpty())
|
||||
// return null;
|
||||
//
|
||||
// return lUI.get(0);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Gets the uploaded images for id.
|
||||
*
|
||||
* @param httpServletRequest the http servlet request
|
||||
* @param itemType the item type
|
||||
* @param itemId the item id
|
||||
* @param maxImages the max images
|
||||
* @return the uploaded images for id
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
private List<UploadedImageDV> getUploadedImagesForId(HttpServletRequest httpServletRequest, String itemType,
|
||||
String itemId, Integer maxImages) throws Exception {
|
||||
LOG.info("getUploadedImagesForId [itemId: " + itemId + ", itemType: " + itemType + "] called");
|
||||
|
||||
throw new Exception("getUploadedImagesForId must be revisited");
|
||||
|
||||
/*
|
||||
* if (itemType == null) throw new
|
||||
* Exception("Invalid parameter. The itemType is null");
|
||||
*
|
||||
* if (itemId == null) throw new
|
||||
* Exception("Invalid parameter. The itemId is null");
|
||||
*
|
||||
* List<UploadedImageDV> listUI = null;
|
||||
*
|
||||
* try {
|
||||
*
|
||||
* if (itemType.equalsIgnoreCase("concessione")) {
|
||||
*
|
||||
* LOG.info("Trying to get concessione for id " + itemId);
|
||||
* GeoportalServiceIdentityProxy cms = new
|
||||
* GeoportalServiceIdentityProxy(httpServletRequest); Concessione concessione =
|
||||
* cms.getItemById(itemId); if (concessione != null) { LOG.info("For id " +
|
||||
* itemId + ", got concessione " + concessione.getNome() + " from service");
|
||||
* List<UploadedImage> images = concessione.getImmaginiRappresentative();
|
||||
*
|
||||
* if (images != null) { listUI = new ArrayList<UploadedImageDV>(); int max =
|
||||
* maxImages < images.size() ? maxImages : images.size(); for (int i = 0; i <
|
||||
* max; i++) { UploadedImageDV ui =
|
||||
* ConvertToDataViewModel.toUploadedImage(images.get(i)); listUI.add(ui); }
|
||||
* LOG.info("For id " + itemId + ", got " + listUI.size() + " image/s"); } }
|
||||
* else throw new Exception("Concessione with id '" + itemId +
|
||||
* "' not available"); }
|
||||
*
|
||||
* return listUI;
|
||||
*
|
||||
* } catch (Exception e) { String erroMsg = UploadedImage.class.getSimpleName()
|
||||
* + " not available for " + Concessione.class.getSimpleName() + " with id " +
|
||||
* itemId; LOG.error(erroMsg, e); throw new Exception(erroMsg); }
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list base layers.
|
||||
*
|
||||
|
@ -695,22 +593,22 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
// TODO TO Check index flag should be in configuration or evaluated according to
|
||||
// user credentials
|
||||
|
||||
String indexFlag = "public"; //default
|
||||
|
||||
String indexFlag = "public"; // default
|
||||
|
||||
GeoportalServiceIdentityProxy gsp = getGeoportalServiceProxy();
|
||||
if(gsp.isUser()) {
|
||||
if (gsp.isUser()) {
|
||||
indexFlag = "internal";
|
||||
LOG.info("user logged - using indexFlag: "+indexFlag);
|
||||
}else if(gsp.isIAMClient()) {
|
||||
LOG.info("user logged - using indexFlag: " + indexFlag);
|
||||
} else if (gsp.isIAMClient()) {
|
||||
indexFlag = "public";
|
||||
LOG.info("user not logged - using indexFlag: "+indexFlag);
|
||||
LOG.info("user not logged - using indexFlag: " + indexFlag);
|
||||
}
|
||||
|
||||
// TODO constant
|
||||
coll.setIndexes(new ArrayList());
|
||||
|
||||
LOG.debug("Checking if " + u.getId() + " is GIS Indexed. Index flag needed is "
|
||||
+ indexFlag);
|
||||
LOG.debug(
|
||||
"Checking if " + u.getId() + " is GIS Indexed. Index flag needed is " + indexFlag);
|
||||
|
||||
for (Index index : ucdConfig.getIndexes()) {
|
||||
try {
|
||||
|
@ -749,23 +647,21 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
}
|
||||
|
||||
/**
|
||||
* List of fields for searching.
|
||||
* Gets the config list of fields for searching.
|
||||
*
|
||||
* @return the list
|
||||
* @return the config list of fields for searching
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public List<ItemFieldsResponse> listOfFieldsForSearching() throws Exception {
|
||||
public List<ItemFieldsResponse> getConfigListOfFieldsForSearching() throws Exception {
|
||||
LOG.info("listOfFieldsForSearching called");
|
||||
|
||||
try {
|
||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||
// GNADataViewerConfigProfile profile = getGNADataVieweConfigProfile();
|
||||
// return profile.getListItemFields();
|
||||
|
||||
List<ItemFieldsResponse> listIFResponse = new ArrayList<ItemFieldsResponse>();
|
||||
|
||||
List<String> handlersIds = Arrays.asList(GEOPORTAL_DATA_HANDLER.geoportal_data_list.getId());
|
||||
List<String> handlersIds = Arrays.asList(GEOPORTAL_DATA_HANDLER.geoportal_basic_data_list.getId());
|
||||
List<UseCaseDescriptor> listUseCaseDescriptor;
|
||||
try {
|
||||
UseCaseDescriptorCaller client = GeoportalClientCaller.useCaseDescriptors();
|
||||
|
@ -779,13 +675,11 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
listUseCaseDescriptor = new ArrayList<UseCaseDescriptor>();
|
||||
}
|
||||
|
||||
// List<UseCaseDescriptorDV> listUCDDV = new
|
||||
// ArrayList<UseCaseDescriptorDV>(listUseCaseDescriptor.size());
|
||||
for (UseCaseDescriptor ucd : listUseCaseDescriptor) {
|
||||
UseCaseDescriptorDV ucdDV = ConvertToDataValueObjectModel.toUseCaseDescriptorDV(ucd, null);
|
||||
// listUCDDV.add(ucdDV);
|
||||
|
||||
HandlerDeclarationDV dataListHandler = getHandlerDeclarationFor(ucdDV,
|
||||
GEOPORTAL_DATA_HANDLER.geoportal_data_list);
|
||||
GEOPORTAL_DATA_HANDLER.geoportal_basic_data_list);
|
||||
|
||||
if (dataListHandler != null) {
|
||||
ConfigurationDV<?> config = dataListHandler.getConfiguration();
|
||||
|
@ -794,7 +688,6 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
ItemFieldsResponse ifResponse = new ItemFieldsResponse();
|
||||
ifResponse.setUseCaseDescriptorDV(ucdDV);
|
||||
List<ItemFieldDV> listItemFields = (List<ItemFieldDV>) config.getConfiguration();
|
||||
// map.put(ucdDV.getProfileID(), listItemFields);
|
||||
ifResponse.setListItemFields(listItemFields);
|
||||
listIFResponse.add(ifResponse);
|
||||
break;
|
||||
|
@ -1121,7 +1014,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
* @param maxWFSFeature the max WFS feature
|
||||
* @param zoomLevel the zoom level
|
||||
* @return the data result
|
||||
* @throws Exception
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public List<GeoNaSpatialQueryResult> getDataResult(List<LayerObject> layerObjects, String mapSrsName,
|
||||
|
@ -1207,8 +1100,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
layerObject.getProjectID());
|
||||
layerObject.setProjectDV(projectDV);
|
||||
}
|
||||
|
||||
if(layerObject.getProjectDV().getSpatialReference()==null) {
|
||||
|
||||
if (layerObject.getProjectDV().getSpatialReference() == null) {
|
||||
GeoJSON geoJson = spatialReference(layerObject.getProfileID(), layerObject.getProjectID());
|
||||
layerObject.getProjectDV().setSpatialReference(geoJson);
|
||||
}
|
||||
|
@ -1253,6 +1146,13 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
return listDAO;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal project DV.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param projectID the project ID
|
||||
* @return the project DV
|
||||
*/
|
||||
private ProjectDV minimalProjectDV(String profileID, String projectID) {
|
||||
LOG.trace("minimalProjectDV for profileID: " + profileID + ", projectID: " + projectID + "called");
|
||||
|
||||
|
@ -1281,6 +1181,13 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
return projectDV;
|
||||
}
|
||||
|
||||
/**
|
||||
* Spatial reference.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param projectID the project ID
|
||||
* @return the geo JSON
|
||||
*/
|
||||
private GeoJSON spatialReference(String profileID, String projectID) {
|
||||
LOG.trace("spatialReference for profileID: " + profileID + ", projectID: " + projectID + "called");
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue