com.esri.adf.web.data.query
Class QueryResult

java.lang.Object
  extended by com.esri.adf.web.data.query.QueryResult
All Implemented Interfaces:
Serializable

public class QueryResult
extends Object
implements Serializable

The QueryResult class represents an individual result resulting from a query operation.

This class has methods that return the display text for the result, return the result details (as a java.util.Map of name-value pairs) and methods that perform actions on the result such as zoom(), highlight() and clearGraphic().

QueryResult works in conjunction with the WebQuery and WebGraphics objects to display this result as a graphic on the map control. Note that the WebQuery is responsible for creating the QueryResult as well.

See Also:
Serialized Form

Field Summary
protected  Map<String,Object> details
          The result details (as a java.util.Map of name-value pairs)
protected  WebExtent extent
          The extent of this result
protected  WebGeometry highlightGeometry
          The geometry that should be displayed as a graphic when this result is highlighted.
protected  WebLayerInfo mWebLayerInfo
          The layer associated with this result.
protected  WebQuery mWebQuery
          The WebQuery object that was used to get this result.
protected  String name
          The display text for this result.
protected static double ZOOMTO_POINT_FACTOR
          The default factor to zoom by for point features.
protected  double zoomToFactor
          The factor to zoom by for point features.
 
Constructor Summary
QueryResult()
          Creates a QueryResult with no initial values.
QueryResult(WebLayerInfo layer, String name, WebQuery webQuery, Map<String,Object> details, WebExtent extent, WebGeometry highlightGeometry)
          Creates a QueryResult with initial values as provided by the caller.
 
Method Summary
 void clearGraphic()
          If this result is currently highlighted, remove the graphic from the graphics layer.
 Map<String,Object> getDetails()
          Returns the result details (as a java.util.Map of name-value pairs)
 WebExtent getExtent()
          Returns the extent of this result
 WebGeometry getHighlightGeometry()
          Returns the geometry that should be displayed as a graphic when this result is highlighted
 WebLayerInfo getLayer()
          Returns the layer associated with this result
 LayerDefinition getLayerDefinition()
          Returns the LayerDefinition of this result.
 String getName()
          Returns the display text for this result
 double getPointZoomToFactor()
          Returns the amount by which the map's full extent should be contracted to zoom into results returned by the query.
 QueryCriteria getQueryCriteria()
          This method is not intended to be used by clients.
 List<? extends QueryResult> getRelatedResults()
          Get the list of results that this object is related to.
 WebQuery getWebQuery()
          Returns the WebQuery object that was used to get this result.
 void highlight()
           Displays this result as a graphic in the graphics layer.
 boolean isHighlightable()
          Returns true if this result can be highlighted.
 boolean isZoomable()
          Returns true if this result can be zoomed into.
 void setDetails(Map<String,?> details)
          Sets the result details (as a java.util.Map of name-value pairs)
 void setExtent(WebExtent extent)
          Sets the extent of this result
 void setHighlightGeometry(WebGeometry highlightGeometry)
          Sets the geometry that should be displayed as a graphic when this result is highlighted
 void setLayer(WebLayerInfo layer)
          Sets the layer associated with this result
 void setLayerDefinition(LayerDefinition layerDefinition)
          Sets the LayerDefinition of this result.
 void setName(String name)
          Sets the display text for this result
 void setPointZoomToFactor(double factor)
          Specifies the amount by which the map's full extent should be contracted to zoom into results returned by the query.
 void setQueryCriteria(QueryCriteria criteria)
          This method is not intended to be used by clients.
 void setRelatedResults(List<? extends QueryResult> results)
          Sets the list of results that this result object is related to.
 void setWebQuery(WebQuery webQuery)
          Sets the WebQuery object that was used to get this result.
 void zoom()
           Zoom the map control to the area represented by this result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ZOOMTO_POINT_FACTOR

protected static final double ZOOMTO_POINT_FACTOR
The default factor to zoom by for point features.

See Also:
Constant Field Values

mWebQuery

protected WebQuery mWebQuery
The WebQuery object that was used to get this result. The WebQuery is also used to display the results as graphics on the map control.


mWebLayerInfo

protected WebLayerInfo mWebLayerInfo
The layer associated with this result.


highlightGeometry

protected WebGeometry highlightGeometry
The geometry that should be displayed as a graphic when this result is highlighted.


extent

protected WebExtent extent
The extent of this result


details

protected Map<String,Object> details
The result details (as a java.util.Map of name-value pairs)


name

protected String name
The display text for this result.


zoomToFactor

protected double zoomToFactor
The factor to zoom by for point features. The default value is ZOOMTO_POINT_FACTOR.

Constructor Detail

QueryResult

public QueryResult()
Creates a QueryResult with no initial values.


QueryResult

public QueryResult(WebLayerInfo layer,
                   String name,
                   WebQuery webQuery,
                   Map<String,Object> details,
                   WebExtent extent,
                   WebGeometry highlightGeometry)
Creates a QueryResult with initial values as provided by the caller.

Parameters:
layer - the layer associated with this result.
name - the display text for this result
webQuery - the WebQuery object that was used to get this result. The WebQuery is also used by QueryResults to display the results as graphics on the map control.
details - the result details (as a java.util.Map of name-value pairs)
extent - the extent of this result
highlightGeometry - the geometry that should be displayed as a graphic when this result is highlighted
Method Detail

isHighlightable

public boolean isHighlightable()
Returns true if this result can be highlighted. A result can be highlighted if there is a highlightGeometry associated with it.

Returns:
true if this result can be highlighted

isZoomable

public boolean isZoomable()
Returns true if this result can be zoomed into. A result can be zoomed into if there is a highlightGeometry or an extent associated with it.

Returns:
true if this result can be zoomed into

highlight

public void highlight()

Displays this result as a graphic in the graphics layer.

The result will be highlighted only is isHighlightable() returns true.


clearGraphic

public void clearGraphic()
If this result is currently highlighted, remove the graphic from the graphics layer.

See Also:
WebQuery.clearGraphic(WebGeometry)

zoom

public void zoom()

Zoom the map control to the area represented by this result.

For non-point results, the map is zoomed to the getExtent() of the result. For point features, it is zoomed based on the getPointZoomToFactor().

See Also:
setExtent(WebExtent), setPointZoomToFactor(double)

getWebQuery

public WebQuery getWebQuery()
Returns the WebQuery object that was used to get this result. The WebQuery is also used to display the results as graphics on the map control.

Returns:
the WebQuery object that was used to get this result

setWebQuery

public void setWebQuery(WebQuery webQuery)
Sets the WebQuery object that was used to get this result. The WebQuery is also used to display the results as graphics on the map control.

Parameters:
webQuery - the WebQuery object that was used to get this result

getLayer

public WebLayerInfo getLayer()
Returns the layer associated with this result

Returns:
the layer associated with this result

setLayer

public void setLayer(WebLayerInfo layer)
Sets the layer associated with this result

Parameters:
layer - the layer associated with this result

getName

public String getName()
Returns the display text for this result

Returns:
the display text for this result

setName

public void setName(String name)
Sets the display text for this result

Parameters:
name - the display text for this result

getDetails

public Map<String,Object> getDetails()
Returns the result details (as a java.util.Map of name-value pairs)

Returns:
the result details (as a java.util.Map of name-value pairs)

setDetails

public void setDetails(Map<String,?> details)
Sets the result details (as a java.util.Map of name-value pairs)

Parameters:
details - the result details (as a java.util.Map of name-value pairs)

getExtent

public WebExtent getExtent()
Returns the extent of this result

Returns:
the extent of this result

setExtent

public void setExtent(WebExtent extent)
Sets the extent of this result

Parameters:
extent - the extent of this result

getPointZoomToFactor

public double getPointZoomToFactor()
Returns the amount by which the map's full extent should be contracted to zoom into results returned by the query. This property only applies to point features because they don't have a well defined extent.

Returns:
the amount to zoom by for point features

setPointZoomToFactor

public void setPointZoomToFactor(double factor)
Specifies the amount by which the map's full extent should be contracted to zoom into results returned by the query. This property only applies to point features because they don't have a well defined extent. The default value is 20. It can be overridden by the LayerDefinition associated with the WebQuery.

Parameters:
factor - the amount to zoom by for point features
See Also:
LayerDefinition.setPointZoomToFactor(double)

getHighlightGeometry

public WebGeometry getHighlightGeometry()
Returns the geometry that should be displayed as a graphic when this result is highlighted

Returns:
the geometry that should be displayed as a graphic when this result is highlighted

setHighlightGeometry

public void setHighlightGeometry(WebGeometry highlightGeometry)
Sets the geometry that should be displayed as a graphic when this result is highlighted

Parameters:
highlightGeometry - the geometry that should be displayed as a graphic when this result is highlighted

setLayerDefinition

public void setLayerDefinition(LayerDefinition layerDefinition)
Sets the LayerDefinition of this result.

Parameters:
layerDefinition - the layer definition of this result

getLayerDefinition

public LayerDefinition getLayerDefinition()
Returns the LayerDefinition of this result.

Returns:
the layer definition of this result

setRelatedResults

public void setRelatedResults(List<? extends QueryResult> results)
Sets the list of results that this result object is related to.


getRelatedResults

public List<? extends QueryResult> getRelatedResults()
Get the list of results that this object is related to.


setQueryCriteria

public void setQueryCriteria(QueryCriteria criteria)
This method is not intended to be used by clients. It is used internally by the framework to fetch related records for a result.


getQueryCriteria

public QueryCriteria getQueryCriteria()
This method is not intended to be used by clients. It is used internally by the framework to fetch related records for a result.