added the recordId for the QueryDataEvent
This commit is contained in:
parent
a4b38a3dfc
commit
e2034659f2
62
pom.xml
62
pom.xml
|
@ -49,31 +49,31 @@
|
||||||
</developer>
|
</developer>
|
||||||
</developers>
|
</developers>
|
||||||
|
|
||||||
<dependencyManagement>
|
<!-- <dependencyManagement> -->
|
||||||
<!-- <dependencies> -->
|
<!-- <dependencies> -->
|
||||||
<!-- <dependency> -->
|
<!-- <dependency> -->
|
||||||
<!-- <groupId>org.gcube.distribution</groupId> -->
|
<!-- <groupId>org.gcube.distribution</groupId> -->
|
||||||
<!-- <artifactId>maven-portal-bom</artifactId> -->
|
<!-- <artifactId>maven-portal-bom</artifactId> -->
|
||||||
<!-- <version>3.6.0</version> -->
|
<!-- <version>3.6.0</version> -->
|
||||||
<!-- <type>pom</type> -->
|
<!-- <type>pom</type> -->
|
||||||
<!-- <scope>import</scope> -->
|
<!-- <scope>import</scope> -->
|
||||||
<!-- <exclusions> -->
|
<!-- <exclusions> -->
|
||||||
<!-- <exclusion> -->
|
<!-- <exclusion> -->
|
||||||
<!-- <groupId>com.google.gwt</groupId> -->
|
<!-- <groupId>com.google.gwt</groupId> -->
|
||||||
<!-- <artifactId>gwt-user</artifactId> -->
|
<!-- <artifactId>gwt-user</artifactId> -->
|
||||||
<!-- </exclusion> -->
|
<!-- </exclusion> -->
|
||||||
<!-- <exclusion> -->
|
<!-- <exclusion> -->
|
||||||
<!-- <groupId>com.google.gwt</groupId> -->
|
<!-- <groupId>com.google.gwt</groupId> -->
|
||||||
<!-- <artifactId>gwt-servlet</artifactId> -->
|
<!-- <artifactId>gwt-servlet</artifactId> -->
|
||||||
<!-- </exclusion> -->
|
<!-- </exclusion> -->
|
||||||
<!-- <exclusion> -->
|
<!-- <exclusion> -->
|
||||||
<!-- <groupId>com.google.gwt</groupId> -->
|
<!-- <groupId>com.google.gwt</groupId> -->
|
||||||
<!-- <artifactId>gwt-dev</artifactId> -->
|
<!-- <artifactId>gwt-dev</artifactId> -->
|
||||||
<!-- </exclusion> -->
|
<!-- </exclusion> -->
|
||||||
<!-- </exclusions> -->
|
<!-- </exclusions> -->
|
||||||
<!-- </dependency> -->
|
<!-- </dependency> -->
|
||||||
<!-- </dependencies> -->
|
<!-- </dependencies> -->
|
||||||
</dependencyManagement>
|
<!-- </dependencyManagement> -->
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -128,12 +128,6 @@
|
||||||
<version>[1.1.0, 2.0.0-SNAPSHOT)</version>
|
<version>[1.1.0, 2.0.0-SNAPSHOT)</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- <dependency> -->
|
|
||||||
<!-- <groupId>org.gcube.portlets.user</groupId> -->
|
|
||||||
<!-- <artifactId>gcube-url-shortener</artifactId> -->
|
|
||||||
<!-- <version>[1.0.0,2.0.0-SNAPSHOT)</version> -->
|
|
||||||
<!-- <scope>compile</scope> -->
|
|
||||||
<!-- </dependency> -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.common.portal</groupId>
|
<groupId>org.gcube.common.portal</groupId>
|
||||||
<artifactId>portal-manager</artifactId>
|
<artifactId>portal-manager</artifactId>
|
||||||
|
@ -211,9 +205,9 @@
|
||||||
<version>${gwt.version}</version>
|
<version>${gwt.version}</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<configuration>
|
<!-- <configuration> -->
|
||||||
<style>${gwt.compiler.style}</style>
|
<!-- <style>${gwt.compiler.style}</style> -->
|
||||||
</configuration>
|
<!-- </configuration> -->
|
||||||
<goals>
|
<goals>
|
||||||
<goal>compile</goal>
|
<goal>compile</goal>
|
||||||
<!-- <goal>test</goal> -->
|
<!-- <goal>test</goal> -->
|
||||||
|
|
|
@ -247,6 +247,8 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
@Override
|
@Override
|
||||||
public void onLayerRendered(AddedLayerToMapEvent addedLayerToMapEvent) {
|
public void onLayerRendered(AddedLayerToMapEvent addedLayerToMapEvent) {
|
||||||
GWT.log("Fired AddedLayerToMapEvent "+addedLayerToMapEvent.getLayerItem());
|
GWT.log("Fired AddedLayerToMapEvent "+addedLayerToMapEvent.getLayerItem());
|
||||||
|
|
||||||
|
//the parameter gid has been passed in the query string
|
||||||
if(paramGeonaItemID!=null && mainPanel.getDisplyedRecord()!=null) {
|
if(paramGeonaItemID!=null && mainPanel.getDisplyedRecord()!=null) {
|
||||||
RecordDV record = mainPanel.getDisplyedRecord();
|
RecordDV record = mainPanel.getDisplyedRecord();
|
||||||
GWT.log("record instanceof ConcessioneDV: " +(record instanceof ConcessioneDV));
|
GWT.log("record instanceof ConcessioneDV: " +(record instanceof ConcessioneDV));
|
||||||
|
@ -256,7 +258,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
Double y = concessioneDV.getCentroidLat();
|
Double y = concessioneDV.getCentroidLat();
|
||||||
Coordinate transfCoord = MapUtils.transformCoordiante(new Coordinate(x, y), GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
|
Coordinate transfCoord = MapUtils.transformCoordiante(new Coordinate(x, y), GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
|
||||||
GeoQuery select = olMapMng.toDataPointQuery(transfCoord);
|
GeoQuery select = olMapMng.toDataPointQuery(transfCoord);
|
||||||
layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, transfCoord));
|
layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, transfCoord, record.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,8 @@ public class LayerManager {
|
||||||
|
|
||||||
if(queryEvent.getGeoQuery()!=null) {
|
if(queryEvent.getGeoQuery()!=null) {
|
||||||
GeoQuery selectDataInfo = queryEvent.getGeoQuery();
|
GeoQuery selectDataInfo = queryEvent.getGeoQuery();
|
||||||
|
Long recordId = queryEvent.getRecordId();
|
||||||
|
|
||||||
GWT.log("("+selectDataInfo.getX1()+","+selectDataInfo.getY1()+")("+selectDataInfo.getX2()+","+selectDataInfo.getY2()+")");
|
GWT.log("("+selectDataInfo.getX1()+","+selectDataInfo.getY1()+")("+selectDataInfo.getX2()+","+selectDataInfo.getY2()+")");
|
||||||
|
|
||||||
for (LayerObject layerObj : layerObjects){
|
for (LayerObject layerObj : layerObjects){
|
||||||
|
@ -162,7 +164,29 @@ public class LayerManager {
|
||||||
|
|
||||||
//USING ONLY THE FIRST FEATURE IN THE LIST
|
//USING ONLY THE FIRST FEATURE IN THE LIST
|
||||||
if(features!=null && features.size()>0) {
|
if(features!=null && features.size()>0) {
|
||||||
feature = features.get(0);
|
|
||||||
|
//I need to show exaclty the feature with produc_id == recordId
|
||||||
|
if(recordId!=null) {
|
||||||
|
for (FeatureRow fRow : features) {
|
||||||
|
List<String> productIdLst = fRow.getMapProperties().get("product_id");
|
||||||
|
String thePID = productIdLst.get(0);
|
||||||
|
try {
|
||||||
|
long productId = Long.parseLong(thePID);
|
||||||
|
if(productId==recordId) {
|
||||||
|
feature = fRow;
|
||||||
|
GWT.log("Found recorId == product_id with id: "+productId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//If recordId not passed, I'm using the first feature returned
|
||||||
|
if(feature==null)
|
||||||
|
feature = features.get(0);
|
||||||
|
|
||||||
Map<String, List<String>> entries = feature.getMapProperties();
|
Map<String, List<String>> entries = feature.getMapProperties();
|
||||||
|
|
||||||
String nome = "";
|
String nome = "";
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class OLMapManager {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
GeoQuery select = toDataPointQuery(coordinate);
|
GeoQuery select = toDataPointQuery(coordinate);
|
||||||
layerManagerBus.fireEvent(new QueryDataEvent(select, coordinate));
|
layerManagerBus.fireEvent(new QueryDataEvent(select, coordinate, null));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ public class OLMapManager {
|
||||||
GWT.log("the distance is: " + dist);
|
GWT.log("the distance is: " + dist);
|
||||||
if (dist > 5000 || startExt.containsExtent(endExt)) {
|
if (dist > 5000 || startExt.containsExtent(endExt)) {
|
||||||
GeoQuery select = toDataBoxQuery(dragEndExtent);
|
GeoQuery select = toDataBoxQuery(dragEndExtent);
|
||||||
layerManagerBus.fireEvent(new QueryDataEvent(select, endExt.getCenter()));
|
layerManagerBus.fireEvent(new QueryDataEvent(select, endExt.getCenter(), null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(zoomStart!=null && zoomEnd!=null) {
|
else if(zoomStart!=null && zoomEnd!=null) {
|
||||||
|
|
|
@ -17,15 +17,16 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
|
||||||
public static Type<QueryDataEventHandler> TYPE = new Type<QueryDataEventHandler>();
|
public static Type<QueryDataEventHandler> TYPE = new Type<QueryDataEventHandler>();
|
||||||
private GeoQuery select;
|
private GeoQuery select;
|
||||||
private Coordinate oLCoordinate;
|
private Coordinate oLCoordinate;
|
||||||
|
private Long recordId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new table row selected event.
|
* Instantiates a new table row selected event.
|
||||||
* @param coordinate
|
* @param coordinate
|
||||||
*/
|
*/
|
||||||
public QueryDataEvent(GeoQuery select, Coordinate coordinate) {
|
public QueryDataEvent(GeoQuery select, Coordinate coordinate, Long recordId) {
|
||||||
this.select = select;
|
this.select = select;
|
||||||
this.oLCoordinate = coordinate;
|
this.oLCoordinate = coordinate;
|
||||||
|
this.recordId = recordId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,6 +38,16 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
|
||||||
public Type<QueryDataEventHandler> getAssociatedType() {
|
public Type<QueryDataEventHandler> getAssociatedType() {
|
||||||
return TYPE;
|
return TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the record id.
|
||||||
|
*
|
||||||
|
* @return the record id
|
||||||
|
*/
|
||||||
|
public Long getRecordId() {
|
||||||
|
return recordId;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatch.
|
* Dispatch.
|
||||||
|
|
|
@ -156,7 +156,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
geoDAO.setSourceLayerObject(layerObject);
|
geoDAO.setSourceLayerObject(layerObject);
|
||||||
LOG.info("Fo layer name: "+layerObject.getLayerItem().getName() +" got "+features.size()+" feature/s");
|
LOG.info("For layer name: "+layerObject.getLayerItem().getName() +" got "+features.size()+" feature/s");
|
||||||
listDAO.add(geoDAO);
|
listDAO.add(geoDAO);
|
||||||
}
|
}
|
||||||
LOG.info("returning "+listDAO+" geona data objects");
|
LOG.info("returning "+listDAO+" geona data objects");
|
||||||
|
@ -173,9 +173,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<UploadedImageDV> getUploadedImagesForId(String itemType, Long id, int maxImages) throws Exception{
|
public List<UploadedImageDV> getUploadedImagesForId(String itemType, Long id, int maxImages) throws Exception{
|
||||||
LOG.info("getConcessioneForId "+id+ "called");
|
LOG.info("getUploadedImagesForId "+id+ " called");
|
||||||
|
|
||||||
|
|
||||||
if(itemType==null)
|
if(itemType==null)
|
||||||
throw new Exception("Invalid parameter. The itemType is null");
|
throw new Exception("Invalid parameter. The itemType is null");
|
||||||
|
|
||||||
|
@ -185,27 +184,29 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
List<UploadedImageDV> listUI = null;
|
List<UploadedImageDV> listUI = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
LOG.info("Trying to get record for id "+id);
|
|
||||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
|
||||||
ConcessioniManager concessioniManager = new ConcessioniManager();
|
|
||||||
Concessione record = concessioniManager.getById(id+"");
|
|
||||||
//AbstractRecordManager<Record> abmRecord = ManagerFactory.getByRecordID(id);
|
|
||||||
Concessione concessione = null;
|
|
||||||
|
|
||||||
if (record != null) {
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
|
|
||||||
concessione = (Concessione) record;
|
if(itemType.equalsIgnoreCase("concessione")) {
|
||||||
|
|
||||||
List<UploadedImage> images = concessione.getImmaginiRappresentative();
|
LOG.info("Trying to get concessione for id "+id);
|
||||||
|
ConcessioniManager concessioniManager = new ConcessioniManager();
|
||||||
if (images != null) {
|
Concessione concessione = concessioniManager.getById(id+"");
|
||||||
listUI = new ArrayList<UploadedImageDV>();
|
if (concessione != null) {
|
||||||
int max = maxImages < images.size() ? maxImages : images.size();
|
LOG.info("For id "+id+", got concessione "+concessione.getNome() +" from service");
|
||||||
for (int i = 0; i < max; i++) {
|
List<UploadedImage> images = concessione.getImmaginiRappresentative();
|
||||||
UploadedImageDV ui = ConvertToDataViewModel.toUploadedImage(images.get(i));
|
|
||||||
listUI.add(ui);
|
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 "+id+", got "+listUI.size() +" image/s");
|
||||||
}
|
}
|
||||||
}
|
}else
|
||||||
|
throw new Exception("Concessione with id: "+id +" not available");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -257,7 +258,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
}
|
}
|
||||||
|
|
||||||
if(concessionDV==null)
|
if(concessionDV==null)
|
||||||
throw new Exception("Concessione not retrieved");
|
throw new Exception("Concessione with id: "+id +" not available");
|
||||||
|
|
||||||
return concessionDV;
|
return concessionDV;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,12 @@ public class GetConcessione {
|
||||||
try {
|
try {
|
||||||
LOG.info("Trying to get record for id "+id);
|
LOG.info("Trying to get record for id "+id);
|
||||||
Concessione concessione = new ConcessioniManager().getById(id+"");
|
Concessione concessione = new ConcessioniManager().getById(id+"");
|
||||||
LOG.info("Got concessione for id "+id);
|
LOG.info("For id "+id+", got concessione "+concessione);
|
||||||
|
LOG.info("Immagini Rappresentative are: "+concessione.getImmaginiRappresentative());
|
||||||
|
LOG.info("Relazione scavo: "+concessione.getRelazioneScavo());
|
||||||
|
LOG.info("Pianta Fine scavo: "+concessione.getPianteFineScavo());
|
||||||
|
LOG.info("Posizionamento scavo: "+concessione.getPosizionamentoScavo());
|
||||||
|
|
||||||
if(concessione !=null) {
|
if(concessione !=null) {
|
||||||
concessionDV = ConvertToDataViewModel.toConcessione(concessione);
|
concessionDV = ConvertToDataViewModel.toConcessione(concessione);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue