starting get concessione for id
This commit is contained in:
parent
b62bcaed5b
commit
ed61ffde87
|
@ -10,6 +10,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
|
|||
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEventHandler;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.FeatureRow;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataObject;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoInformationForWMSRequest;
|
||||
|
@ -119,20 +120,30 @@ public class LayerManager {
|
|||
flex.setCellPadding(1);
|
||||
flex.setCellSpacing(1);
|
||||
flex.getElement().addClassName("popup-table");
|
||||
boolean featureFound = false;
|
||||
for (GeoNaDataObject geoNaDataObject : result) {
|
||||
Map<String, List<String>> entries = geoNaDataObject.getDataEntryFields();
|
||||
List<FeatureRow> features = geoNaDataObject.getFeatures();
|
||||
|
||||
for (String key : entries.keySet()) {
|
||||
if(key.equalsIgnoreCase("nome")) {
|
||||
flex.setHTML(0, 0, new HTML(entries.get(key).get(0)).toString());
|
||||
}
|
||||
else if(key.equalsIgnoreCase("descrizione")) {
|
||||
flex.setText(1, 0, entries.get(key).get(0));
|
||||
}else if(key.equalsIgnoreCase("date_scavo")) {
|
||||
flex.setHTML(2, 0, new HTML("<code>"+entries.get(key).get(0)).toString()+"</code>");
|
||||
if(features!=null && features.size()>0) {
|
||||
Map<String, List<String>> entries = features.get(0).getMapProperties();
|
||||
|
||||
for (String key : entries.keySet()) {
|
||||
if(key.equalsIgnoreCase("nome")) {
|
||||
flex.setHTML(0, 0, new HTML(entries.get(key).get(0)).toString());
|
||||
}
|
||||
else if(key.equalsIgnoreCase("descrizione")) {
|
||||
flex.setText(1, 0, entries.get(key).get(0));
|
||||
}else if(key.equalsIgnoreCase("date_scavo")) {
|
||||
flex.setHTML(2, 0, new HTML("<code>"+entries.get(key).get(0)).toString()+"</code>");
|
||||
}
|
||||
}
|
||||
featureFound = true;
|
||||
break; //Only the first one
|
||||
}
|
||||
break; //Only the first one
|
||||
}
|
||||
|
||||
if(!featureFound) {
|
||||
flex.setHTML(0, 0, new HTML("No data available").toString());
|
||||
}
|
||||
|
||||
olMap.showPopup(flex.toString(), queryEvent.getoLCoordinate());
|
||||
|
|
|
@ -11,12 +11,14 @@ import org.gcube.application.geoportal.model.concessioni.Concessione;
|
|||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.FeatureParser;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.WMSUrlValidator;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.FeatureRow;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataObject;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoInformationForWMSRequest;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.Styles;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.ZAxis;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
|
||||
import org.gcube.spatial.data.geoutility.GeoNcWMSMetadataUtility;
|
||||
import org.gcube.spatial.data.geoutility.bean.LayerStyles;
|
||||
import org.gcube.spatial.data.geoutility.bean.LayerZAxis;
|
||||
|
@ -33,6 +35,7 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
|||
public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet implements
|
||||
GeoportalDataViewerService {
|
||||
|
||||
public static final String PRODUCT_ID = "product_id";
|
||||
/** The Constant LOG. */
|
||||
private static final Logger LOG = LoggerFactory.getLogger(GeoportalDataViewerServiceImpl.class);
|
||||
|
||||
|
@ -84,18 +87,42 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.user.gisviewer.client.GisViewerService#getDataResult(java.util.List, java.lang.String, int)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.gcube.portlets.user.gisviewer.client.GisViewerService#getDataResult(java.
|
||||
* util.List, java.lang.String, int)
|
||||
*/
|
||||
@Override
|
||||
public List<GeoNaDataObject> getDataResult(List<LayerItem> layerItems, String mapSrsName, BoundsMap selectBBOX, int maxWFSFeature, double zoomLevel) {
|
||||
public List<GeoNaDataObject> getDataResult(List<LayerItem> layerItems, String mapSrsName, BoundsMap selectBBOX,
|
||||
int maxWFSFeature, double zoomLevel) {
|
||||
LOG.info("getDataResult called");
|
||||
List<GeoNaDataObject> result = FeatureParser.getDataResults(layerItems, mapSrsName, selectBBOX, maxWFSFeature);
|
||||
|
||||
for (GeoNaDataObject geoNaDataObject : result) {
|
||||
List<FeatureRow> features = geoNaDataObject.getFeatures();
|
||||
for (FeatureRow feature : features) {
|
||||
List<String> theProductIds = feature.getMapProperties().get(PRODUCT_ID);
|
||||
try {
|
||||
if (theProductIds != null && theProductIds.size() > 0) {
|
||||
String theProductID = theProductIds.get(0);
|
||||
LOG.info("Found: "+PRODUCT_ID + " loading "+ConcessioneDV.class.getSimpleName());
|
||||
long productID = Long.parseLong(theProductID);
|
||||
ConcessioneDV concessioneDV = getConcessioneForId(productID);
|
||||
geoNaDataObject.setConcessioneDV(concessioneDV);
|
||||
LOG.debug("Added "+ConcessioneDV.class.getSimpleName()+" as "+concessioneDV);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error:", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private void getConcessioneForId(Long id) throws Exception{
|
||||
private ConcessioneDV getConcessioneForId(Long id) throws Exception{
|
||||
LOG.info("");
|
||||
|
||||
if(id==null)
|
||||
|
@ -109,12 +136,15 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
Concessione concessione = null;
|
||||
if(record !=null && record instanceof Concessione) {
|
||||
concessione = (Concessione) record;
|
||||
return ConvertToDataViewModel.toConcessione(concessione);
|
||||
}else
|
||||
throw new Exception("No Concessione with id: "+id+" is available");
|
||||
throw new Exception("No Concessione with id '"+id+"' is available");
|
||||
|
||||
|
||||
}catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
String erroMsg = Concessione.class.getSimpleName() +" with id "+id+" not available";
|
||||
LOG.error(erroMsg,e);
|
||||
throw new Exception(erroMsg);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -64,9 +64,7 @@ public class FeatureParser {
|
|||
List<FeatureRow> rows = getWFSFeatureProperties(layerItem, mapSrsName, selectBBOX, maxWFSFeature);
|
||||
GeoNaDataObject gdo = new GeoNaDataObject();
|
||||
gdo.setLayerItem(layerItem);
|
||||
for (FeatureRow featureRow : rows) {
|
||||
gdo.setDataEntryFields(featureRow.getMapProperties());
|
||||
}
|
||||
gdo.setFeatures(rows);
|
||||
listGeonaDO.add(gdo);
|
||||
}
|
||||
return listGeonaDO;
|
||||
|
@ -127,8 +125,7 @@ public class FeatureParser {
|
|||
}catch (Exception e) {
|
||||
LOG.warn("Unable to read the field 'crs'");
|
||||
}
|
||||
|
||||
|
||||
|
||||
LOG.info("Features are: "+features.length());
|
||||
|
||||
for (int i=0; i<features.length(); i++) {
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -21,9 +22,10 @@ public class GeoNaDataObject implements Serializable{
|
|||
*/
|
||||
private static final long serialVersionUID = 5566069859060851625L;
|
||||
/** The form data entry fields. */
|
||||
private Map<String, List<String>> dataEntryFields;
|
||||
private String geonaDataType;
|
||||
private List<FeatureRow> features;
|
||||
private String productType; //e.g. "Concessioni"
|
||||
private LayerItem layerItem;
|
||||
private ConcessioneDV concessioneDV;
|
||||
|
||||
/**
|
||||
* Instantiates a new geo na data object.
|
||||
|
@ -32,34 +34,22 @@ public class GeoNaDataObject implements Serializable{
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the data entry fields.
|
||||
*
|
||||
* @return the data entry fields
|
||||
*/
|
||||
public Map<String, List<String>> getDataEntryFields() {
|
||||
return dataEntryFields;
|
||||
public List<FeatureRow> getFeatures() {
|
||||
return features;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the data entry fields.
|
||||
*
|
||||
* @param dataEntryFields the data entry fields
|
||||
*/
|
||||
public void setDataEntryFields(Map<String, List<String>> dataEntryFields) {
|
||||
this.dataEntryFields = dataEntryFields;
|
||||
public void setFeatures(List<FeatureRow> features) {
|
||||
this.features = features;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the geona data type.
|
||||
*
|
||||
* @return the geona data type
|
||||
*/
|
||||
public String getGeonaDataType() {
|
||||
return geonaDataType;
|
||||
public String getProductType() {
|
||||
return productType;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setProductType(String productType) {
|
||||
this.productType = productType;
|
||||
}
|
||||
|
||||
public LayerItem getLayerItem() {
|
||||
return layerItem;
|
||||
}
|
||||
|
@ -68,27 +58,28 @@ public class GeoNaDataObject implements Serializable{
|
|||
this.layerItem = layerItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the geona data type.
|
||||
*
|
||||
* @param geonaDataType the new geona data type
|
||||
*/
|
||||
public void setGeonaDataType(String geonaDataType) {
|
||||
this.geonaDataType = geonaDataType;
|
||||
public ConcessioneDV getConcessioneDV() {
|
||||
return concessioneDV;
|
||||
}
|
||||
|
||||
public void setConcessioneDV(ConcessioneDV concessioneDV) {
|
||||
this.concessioneDV = concessioneDV;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("GeoNaFormDataObject [dataEntryFields=");
|
||||
builder.append(dataEntryFields);
|
||||
builder.append(", geonaDataType=");
|
||||
builder.append(geonaDataType);
|
||||
builder.append("GeoNaDataObject [features=");
|
||||
builder.append(features);
|
||||
builder.append(", productType=");
|
||||
builder.append(productType);
|
||||
builder.append(", layerItem=");
|
||||
builder.append(layerItem);
|
||||
builder.append(", concessioneDV=");
|
||||
builder.append(concessioneDV);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,8 +11,12 @@ import java.io.Serializable;
|
|||
*/
|
||||
public class FeatureGeometry implements Serializable{
|
||||
|
||||
String type;
|
||||
String coordinates;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 6251162740446739453L;
|
||||
private String type;
|
||||
private String coordinates;
|
||||
|
||||
public FeatureGeometry() {
|
||||
}
|
||||
|
@ -49,8 +53,5 @@ public class FeatureGeometry implements Serializable{
|
|||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue