trying to get concessione for id
This commit is contained in:
parent
6c23c0d1a1
commit
d6cd995f9c
|
@ -32,6 +32,7 @@
|
|||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/geoportal-data-viewer-app-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
|
|
18
pom.xml
18
pom.xml
|
@ -109,6 +109,24 @@
|
|||
<artifactId>geo-utility</artifactId>
|
||||
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>authorization-client</artifactId>
|
||||
<version>[2.0.0, 3.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources.discovery</groupId>
|
||||
<artifactId>ic-client</artifactId>
|
||||
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-scope-maps</artifactId>
|
||||
<version>[1.1.0, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common.portal</groupId>
|
||||
<artifactId>portal-manager</artifactId>
|
||||
|
|
|
@ -137,6 +137,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
@Override
|
||||
public void onShowDetails(ShowDetailsEvent showDetailsEvent) {
|
||||
GWT.log("Fired event: "+showDetailsEvent);
|
||||
FeatureRow fRow = showDetailsEvent.getFeatureRow();
|
||||
if(fRow!=null) {
|
||||
if(showDetailsEvent.getProductType().equals(ProductType.CONCESSIONE)) {
|
||||
|
@ -147,7 +148,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
Window.alert(caught.getMessage());
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -23,13 +23,20 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
|
|||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.user.client.DOM;
|
||||
import com.google.gwt.user.client.Element;
|
||||
import com.google.gwt.user.client.Event;
|
||||
import com.google.gwt.user.client.EventListener;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.FlexTable;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
|
||||
import ol.Coordinate;
|
||||
|
||||
|
@ -131,10 +138,12 @@ public class LayerManager {
|
|||
flex.setCellSpacing(1);
|
||||
flex.getElement().addClassName("popup-table");
|
||||
boolean featureFound = false;
|
||||
FeatureRow feature = null;
|
||||
for (GeoNaDataObject geoNaDataObject : result) {
|
||||
List<FeatureRow> features = geoNaDataObject.getFeatures();
|
||||
|
||||
if(features!=null && features.size()>0) {
|
||||
feature = features.get(0);
|
||||
Map<String, List<String>> entries = features.get(0).getMapProperties();
|
||||
|
||||
for (String key : entries.keySet()) {
|
||||
|
@ -147,27 +156,56 @@ public class LayerManager {
|
|||
flex.setHTML(2, 0, new HTML("<code>"+entries.get(key).get(0)).toString()+"</code>");
|
||||
}
|
||||
}
|
||||
Button button = new Button("Open Details");
|
||||
button.setType(ButtonType.LINK);
|
||||
button.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
applicationBus.fireEvent(new ShowDetailsEvent(ProductType.CONCESSIONE, features.get(0)));
|
||||
|
||||
}
|
||||
});
|
||||
flex.add(button);
|
||||
|
||||
featureFound = true;
|
||||
break; //Only the first one
|
||||
}
|
||||
}
|
||||
|
||||
FeatureRow theFeature = feature;
|
||||
Button button = null;
|
||||
if(!featureFound) {
|
||||
flex.setHTML(0, 0, new HTML("No data available").toString());
|
||||
}else {
|
||||
button = new Button("Open Details");
|
||||
button.getElement().setId("open-details");
|
||||
button.setType(ButtonType.LINK);
|
||||
}
|
||||
|
||||
olMap.showPopup(flex.toString(), queryEvent.getoLCoordinate());
|
||||
VerticalPanel vpPanel = new VerticalPanel();
|
||||
vpPanel.add(flex);
|
||||
|
||||
if(button!=null)
|
||||
vpPanel.add(button);
|
||||
|
||||
olMap.showPopup(vpPanel.toString(), queryEvent.getoLCoordinate());
|
||||
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
Element buttonElement = DOM.getElementById("open-details");
|
||||
Event.sinkEvents(buttonElement, Event.ONCLICK);
|
||||
Event.setEventListener(buttonElement, new EventListener() {
|
||||
|
||||
@Override
|
||||
public void onBrowserEvent(Event event) {
|
||||
if(Event.ONCLICK == event.getTypeInt()) {
|
||||
applicationBus.fireEvent(new ShowDetailsEvent(ProductType.CONCESSIONE, theFeature));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
button.setType(ButtonType.LINK);
|
||||
button.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
GWT.log("qui");
|
||||
applicationBus.fireEvent(new ShowDetailsEvent(ProductType.CONCESSIONE, theFeature));
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -8,9 +8,11 @@ import org.gcube.application.geoportal.managers.AbstractRecordManager;
|
|||
import org.gcube.application.geoportal.managers.ManagerFactory;
|
||||
import org.gcube.application.geoportal.model.Record;
|
||||
import org.gcube.application.geoportal.model.concessioni.Concessione;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
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.server.util.SessionUtil;
|
||||
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.LayerItem;
|
||||
|
@ -123,15 +125,22 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
|
||||
@Override
|
||||
public ConcessioneDV getConcessioneForId(Long id) throws Exception{
|
||||
LOG.info("");
|
||||
LOG.info("getConcessioneForId "+id+ "called");
|
||||
|
||||
if(!SessionUtil.isIntoPortal()) {
|
||||
LOG.warn("OUT OF PORTAL setting HARD-CODED SCOPE");
|
||||
String scope = "/gcube/devNext/NextNext";
|
||||
LOG.warn("SCOPE is: "+scope);
|
||||
ScopeProvider.instance.set(scope);
|
||||
}
|
||||
|
||||
if(id==null)
|
||||
throw new Exception("Invalid parameter. The Id is null");
|
||||
|
||||
try {
|
||||
//saving into back-end
|
||||
LOG.info("Trying to get record for id "+id);
|
||||
AbstractRecordManager<Record> abmRecord = ManagerFactory.getByRecordID(id);
|
||||
|
||||
LOG.info("Got record for id "+id);
|
||||
Record record = abmRecord.getRecord();
|
||||
Concessione concessione = null;
|
||||
if(record !=null && record instanceof Concessione) {
|
||||
|
|
|
@ -41,7 +41,7 @@ public class SessionUtil {
|
|||
UserLocalServiceUtil.getService();
|
||||
return true;
|
||||
}catch (Exception ex) {
|
||||
LOG.debug("Development Mode ON");
|
||||
LOG.warn("Development Mode ON");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue