ported to GNADataViewerConfigProfile
This commit is contained in:
parent
98349ac121
commit
5d59c9dcbc
|
@ -6,7 +6,7 @@ import java.util.Iterator;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||
import org.gcube.application.geoportalcommon.shared.ItemField;
|
||||
import org.gcube.application.geoportalcommon.shared.LayerItem;
|
||||
|
@ -100,7 +100,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
private String paramGeonaItemID;
|
||||
|
||||
private GeoNaDataViewerProfile geonaDataViewerProfile;
|
||||
private GNADataViewerConfigProfile geonaDataViewerProfile;
|
||||
|
||||
private OLMapManager olMapMng = null;
|
||||
|
||||
|
@ -148,7 +148,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
GWT.log("Loaded item fields: "+result);
|
||||
|
||||
for (ItemField itemField : result) {
|
||||
if(itemField.isDisplayIntoTable()) {
|
||||
if(itemField.isDisplayAsResult()) {
|
||||
displayFields.add(itemField);
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
@Override
|
||||
public void execute() {
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance()
|
||||
.getGeoNaDataViewProfile(new AsyncCallback<GeoNaDataViewerProfile>() {
|
||||
.getGeoNaDataViewProfile(new AsyncCallback<GNADataViewerConfigProfile>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -259,7 +259,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(GeoNaDataViewerProfile profile) {
|
||||
public void onSuccess(GNADataViewerConfigProfile profile) {
|
||||
geonaDataViewerProfile = profile;
|
||||
GWT.log("Profile: " + geonaDataViewerProfile);
|
||||
Iterator<String> it;
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||
import org.gcube.application.geoportalcommon.shared.ItemField;
|
||||
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||
|
@ -83,7 +83,7 @@ public interface GeoportalDataViewerService extends RemoteService {
|
|||
* @return the geo na data view profile
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
GeoNaDataViewerProfile getGeoNaDataViewProfile() throws Exception;
|
||||
GNADataViewerConfigProfile getGeoNaDataViewProfile() throws Exception;
|
||||
|
||||
/**
|
||||
* Gets the uploaded images for id.
|
||||
|
@ -134,8 +134,9 @@ public interface GeoportalDataViewerService extends RemoteService {
|
|||
* List of fields for searching.
|
||||
*
|
||||
* @return the list
|
||||
* @throws Exception
|
||||
*/
|
||||
List<ItemField> listOfFieldsForSearching();
|
||||
List<ItemField> listOfFieldsForSearching() throws Exception;
|
||||
|
||||
/**
|
||||
* Gets the list concessioni.
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||
import org.gcube.application.geoportalcommon.shared.ItemField;
|
||||
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||
|
@ -49,7 +49,7 @@ public interface GeoportalDataViewerServiceAsync {
|
|||
|
||||
void getLayerForType(String layerType, AsyncCallback<GeoInformationForWMSRequest> callback);
|
||||
|
||||
void getGeoNaDataViewProfile(AsyncCallback<GeoNaDataViewerProfile> callback);
|
||||
void getGeoNaDataViewProfile(AsyncCallback<GNADataViewerConfigProfile> callback);
|
||||
|
||||
void getUploadedImagesForId(String itemType, String itemId, Integer maxImages,
|
||||
AsyncCallback<List<UploadedImageDV>> callback);
|
||||
|
|
|
@ -14,10 +14,9 @@ import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
|||
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
|
||||
import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
|
||||
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
||||
import org.gcube.application.geoportalcommon.GeoNaDataViewerProfileReader;
|
||||
import org.gcube.application.geoportalcommon.GeoportalCommon;
|
||||
import org.gcube.application.geoportalcommon.MongoServiceCommon;
|
||||
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||
import org.gcube.application.geoportalcommon.shared.ItemField;
|
||||
import org.gcube.application.geoportalcommon.shared.LayerItem;
|
||||
|
@ -71,6 +70,27 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
|
||||
private static final String CACHE_IMAGE_PREVIEW_FOR_CONCESSIONE = "MAP_IMAGE_PREVIEW_FOR_CONCESSIONE";
|
||||
|
||||
/**
|
||||
* Gets the GNA data viewe config profile.
|
||||
*
|
||||
* @return the GNA data viewe config profile
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
private GNADataViewerConfigProfile getGNADataVieweConfigProfile() throws Exception {
|
||||
|
||||
GNADataViewerConfigProfile profile = SessionUtil.getGNADataViewerConfigProfile(getThreadLocalRequest());
|
||||
if (profile == null) {
|
||||
LOG.info(GNADataViewerConfigProfile.class.getSimpleName() + " is null, loading configurations from IS");
|
||||
//to be sure
|
||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||
GeoportalCommon geoportalComm = new GeoportalCommon();
|
||||
profile = geoportalComm.readGNADataViewerConfig(null);
|
||||
} else {
|
||||
LOG.info(GNADataViewerConfigProfile.class.getSimpleName() + " read from session");
|
||||
}
|
||||
return profile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the wms request.
|
||||
*
|
||||
|
@ -92,8 +112,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
* @return the geo information for WMS request
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public GeoInformationForWMSRequest loadGeoInfoForWmsRequest(String wmsLink, String layerName)
|
||||
throws Exception {
|
||||
public GeoInformationForWMSRequest loadGeoInfoForWmsRequest(String wmsLink, String layerName) throws Exception {
|
||||
try {
|
||||
WMSUrlValidator validator = new WMSUrlValidator(wmsLink, layerName);
|
||||
String wmsServiceHost = validator.getWmsServiceHost();
|
||||
|
@ -326,7 +345,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
if (layerPosizionamento != null) {
|
||||
if (!GeoNACheckAccessPolicy.isAccessible(layerPosizionamento.getPolicy(), userName)) {
|
||||
concessionDV.setPosizionamentoScavo(null);
|
||||
LOG.info("Posizionamento di Scavo is not accessible by current user: "+userName);
|
||||
LOG.info("Posizionamento di Scavo is not accessible by current user: " + userName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -336,8 +355,9 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
for (LayerConcessioneDV layerDV : listLayersDV) {
|
||||
if (GeoNACheckAccessPolicy.isAccessible(layerDV.getPolicy(), userName)) {
|
||||
accessibleListLayersDV.add(layerDV);
|
||||
}else {
|
||||
LOG.info("(Pianta) Layer "+layerDV.getLayerName()+" is not accessible by current user: "+userName);
|
||||
} else {
|
||||
LOG.info("(Pianta) Layer " + layerDV.getLayerName()
|
||||
+ " is not accessible by current user: " + userName);
|
||||
}
|
||||
}
|
||||
concessionDV.setPianteFineScavo(accessibleListLayersDV);
|
||||
|
@ -347,7 +367,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
if (abstractRS != null) {
|
||||
if (!GeoNACheckAccessPolicy.isAccessible(abstractRS.getPolicy(), userName)) {
|
||||
concessionDV.setAbstractRelazioneScavo(null);
|
||||
LOG.info("Abstract relazione is not accessible by current user: "+userName);
|
||||
LOG.info("Abstract relazione is not accessible by current user: " + userName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -355,7 +375,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
if (relazioneScavo != null) {
|
||||
if (!GeoNACheckAccessPolicy.isAccessible(relazioneScavo.getPolicy(), userName)) {
|
||||
concessionDV.setRelazioneScavo(null);
|
||||
LOG.info("Relazione scavo is not accessible by current user: "+userName);
|
||||
LOG.info("Relazione scavo is not accessible by current user: " + userName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -368,8 +388,9 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
|
||||
if (GeoNACheckAccessPolicy.isAccessible(uploadedImageDV.getPolicy(), userName)) {
|
||||
accessibleListImages.add(uploadedImageDV);
|
||||
}else {
|
||||
LOG.info("Immagine "+uploadedImageDV.getTitolo()+" is not accessible by current user: "+userName);
|
||||
} else {
|
||||
LOG.info("Immagine " + uploadedImageDV.getTitolo()
|
||||
+ " is not accessible by current user: " + userName);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -455,8 +476,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
throw new Exception("The input parameter layerType is null or empty");
|
||||
|
||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||
GeoNaDataViewerProfileReader gdvp = new GeoNaDataViewerProfileReader("geoportal-data-viewer-app");
|
||||
GeoNaDataViewerProfile profile = gdvp.readProfileFromInfrastrucure();
|
||||
|
||||
GNADataViewerConfigProfile profile = getGNADataVieweConfigProfile();
|
||||
LOG.info("Read profile: " + profile);
|
||||
|
||||
String lowerLayerType = layerType.toLowerCase();
|
||||
|
@ -481,12 +502,11 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public GeoNaDataViewerProfile getGeoNaDataViewProfile() throws Exception {
|
||||
public GNADataViewerConfigProfile getGeoNaDataViewProfile() throws Exception {
|
||||
LOG.info("getGeoNaDataViewProfile called");
|
||||
|
||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||
GeoportalCommon gc = new GeoportalCommon();
|
||||
org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile profile = gc.getGeoNaDataViewProfile(null);
|
||||
GNADataViewerConfigProfile profile = getGNADataVieweConfigProfile();
|
||||
LOG.info("Returning profile: " + profile);
|
||||
return profile;
|
||||
}
|
||||
|
@ -680,10 +700,10 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
public List<BaseMapLayer> getListBaseLayers() {
|
||||
LOG.info("getListBaseLayers called");
|
||||
List<BaseMapLayer> listBL = new ArrayList<BaseMapLayer>();
|
||||
//Setting scope in the cuurent thread
|
||||
// Setting scope in the cuurent thread
|
||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||
listBL = SessionUtil.getGNABaseMaps(this.getThreadLocalRequest());
|
||||
LOG.info("getListBaseLayers returning "+listBL.size() +" base maps");
|
||||
LOG.info("getListBaseLayers returning " + listBL.size() + " base maps");
|
||||
return listBL;
|
||||
|
||||
}
|
||||
|
@ -694,21 +714,14 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
* List of fields for searching.
|
||||
*
|
||||
* @return the list
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public List<ItemField> listOfFieldsForSearching() {
|
||||
// GeoportalCommon gc = new GeoportalCommon();
|
||||
// return gc.getGNADataConfig().getListItemFields();
|
||||
|
||||
List<ItemField> listItemFields = new ArrayList<ItemField>();
|
||||
listItemFields.add(new ItemField("Any Field",
|
||||
Arrays.asList("nome", "authors", "introduzione", "contributore", "titolari", "editore", "responsabile", "paroleChiaveLibere", "paroleChiaveICCD"), false, false, true));
|
||||
listItemFields.add(new ItemField("Project Name", Arrays.asList("nome"), true, true, true));
|
||||
listItemFields.add(new ItemField("Director/Staff",
|
||||
Arrays.asList("authors", "contributore", "titolari", "editore", "responsabile"), true, false, true));
|
||||
listItemFields.add(new ItemField("Keywords", Arrays.asList("paroleChiaveLibere", "paroleChiaveICCD"), true,
|
||||
false, true));
|
||||
return listItemFields;
|
||||
public List<ItemField> listOfFieldsForSearching() throws Exception {
|
||||
LOG.info("listOfFieldsForSearching called");
|
||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||
GNADataViewerConfigProfile profile = getGNADataVieweConfigProfile();
|
||||
return profile.getListItemFields();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -729,13 +742,9 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
try {
|
||||
|
||||
SessionUtil.getCurrentContext(getThreadLocalRequest(), true);
|
||||
|
||||
MongoServiceCommon serviceCommon = new MongoServiceCommon();
|
||||
// MongoServiceUtil serviceUtil = new MongoServiceUtil();
|
||||
// MongoConcessioni clientMongo = serviceUtil.getInstanceMongoConcessioni();
|
||||
|
||||
// TODO MUST BE REPLACED BY COUNT
|
||||
|
||||
List<Concessione> listOfConcessioni = SessionUtil.getListOfConcessioni(getThreadLocalRequest(),
|
||||
reloadFromService);
|
||||
int listConcessioniSize = listOfConcessioni.size();
|
||||
|
@ -751,5 +760,4 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import javax.servlet.http.HttpSession;
|
|||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
|
||||
import org.gcube.application.geoportalcommon.MongoServiceCommon;
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
|
@ -44,8 +45,8 @@ public class SessionUtil {
|
|||
|
||||
private static final String URL_SHORTENER_SERVICE = "URL_SHORTENER_SERVICE";
|
||||
private static final String LIST_BASE_MAPS_LAYERS = "LIST_BASE_MAPS_LAYERS";
|
||||
|
||||
private static final String LIST_OF_CONCESSIONI = "LIST_OF_CONCESSIONI_DATA_VIEWER";
|
||||
private static final String GNA_DATAVIEWER_CONFIG_PROFILE = "GNA_DATAVIEWER_CONFIG_PROFILE";
|
||||
|
||||
/**
|
||||
* Checks if is into portal.
|
||||
|
@ -205,7 +206,6 @@ public class SessionUtil {
|
|||
return lstBML;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the list of concessioni.
|
||||
*
|
||||
|
@ -247,4 +247,27 @@ public class SessionUtil {
|
|||
LOG.info("read list of concessioni with size: " + listOfConcessioni.size());
|
||||
return listOfConcessioni;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the GNA data viewer config profile.
|
||||
*
|
||||
* @param httpServletRequest the http servlet request
|
||||
* @return the GNA data viewer config profile
|
||||
*/
|
||||
public static GNADataViewerConfigProfile getGNADataViewerConfigProfile(HttpServletRequest httpServletRequest) {
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
return (GNADataViewerConfigProfile) session.getAttribute(GNA_DATAVIEWER_CONFIG_PROFILE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the list item fields config.
|
||||
*
|
||||
* @param httpServletRequest the http servlet request
|
||||
* @param gNADVConfigProfile the g NADV config profile
|
||||
*/
|
||||
public static void setListItemFieldsConfig(HttpServletRequest httpServletRequest,
|
||||
GNADataViewerConfigProfile gNADVConfigProfile) {
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
session.setAttribute(GNA_DATAVIEWER_CONFIG_PROFILE, gNADVConfigProfile);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue