com.esri.adf.web.aims.data
Class AIMSGeocodeFunctionality

java.lang.Object
  extended by com.esri.adf.web.aims.data.AIMSGeocodeFunctionality
All Implemented Interfaces:
GeocodeFunctionality, GISFunctionality, Serializable

public class AIMSGeocodeFunctionality
extends Object
implements GeocodeFunctionality, Serializable

This class is responsible for sending GET_GEOCODE AXL request to ArcIMS Server based on the AIMSMapResource information.

When initFunctionality(com.esri.adf.web.data.GISResource) method is called, the GET_SERVICE_INFO request is sent to the ArcIMS Server if there is no ArcIMS Map Functionality associated with the resource.

ArcIMS Geocode Functionality can be added using JSF managed bean configuration as shown below,

 <managed-bean>
  <managed-bean-name>aimsGeocodeResource</managed-bean-name>
  <managed-bean-class>com.esri.adf.web.aims.data.AIMSMapResource</managed-bean-class>
  <managed-bean-scope>none</managed-bean-scope>
  <managed-property>
    <property-name>hostName</property-name>
    <value>http://machinename</value>
  </managed-property>
  <managed-property>
    <property-name>serviceName</property-name>
    <value>ServiceName</value>
  </managed-property>
  <managed-property>
    <property-name>functionalities</property-name>
    <map-entries>
      <map-entry>
        <key>geocode</key>
        <value>#{aimsGeocode}</value>
      </map-entry>
    </map-entries>
  </managed-property>
 </managed-bean>
 
 <managed-bean>
  <managed-bean-name>aimsGeocode</managed-bean-name>
  <managed-bean-class>com.esri.adf.web.aims.data.AIMSGeocodeFunctionality</managed-bean-class>
   <managed-bean-scope>none</managed-bean-scope>
  <managed-property>
    <property-name>maxCandidates</property-name>
    <value>10</value>
  </managed-property>
  <managed-property>
    <property-name>aliases</property-name>
    <map-entries>
      <map-entry>
        <key>STREET</key>
        <value>Street</value>
      </map-entry>
      <map-entry>
        <key>ZONE</key>
        <value>ZIP</value>
      </map-entry>
    </map-entries>
  </managed-property>
 

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface com.esri.adf.web.data.GeocodeFunctionality
FUNCTIONALITY_NAME
 
Constructor Summary
AIMSGeocodeFunctionality()
           
 
Method Summary
 void destroyFunctionality()
           The cleanup chores (such as releasing held resources) for the functionality must be performed in this method.
 List<AddressCandidate> findAddressCandidates()
           Returns a List of AddressCandidates based on the current set of address field values.
 AddressCandidate geocodeAddress()
           Geocodes a single address based on the current set of address field values.
 String getAddressFieldAlias(String fieldName)
           Returns an alias for the given address field.
 String[] getAddressFields()
           Returns an array of address fields for this geocoder.
 String getAddressFieldValue(String fieldName)
           Returns the value for a given address field.
 HashMap<String,String> getAliases()
          Returns the aliases for the geocoding style ids.
 String getDefaultDataFrame()
          Returns the default dataframe name.
 HashMap<String,String> getDefaultValue()
          Return the default values for the geocoding style ids.
 String getGeocodeLayerId()
          Returns the geocode layer id.
 com.esri.aims.mtier.model.map.Map getMap()
          Returns the Map object.
 int getMaxCandidates()
          Returns the maximum number of geocoding result candidates value.
 int getMinScore()
          Returns the minimum geocode scoring value.
 AIMSMapResource getResource()
           Returns the GISResource associated with this functionality.
 int getSpellingSensitivity()
          Returns the spelling sensitivity for geocoding.
 void initFunctionality(GISResource resource)
           The initialization chores for the functionality must be performed in this method.
 void setAddressFieldValue(String fieldName, String value)
           Sets the value for a given address field.
 void setAliases(HashMap<String,String> aliases)
           Sets the aliases for the geocoding style ids.
 void setDefaultDataFrame(String defaultDataFrame)
          Sets the default data frame in which the geocode functionality should work with.
 void setDefaultValue(HashMap<String,String> defaultValue)
           Sets the default values for the geocoding style ids.
 void setGeocodeLayerId(String geocodeLayerId)
          Sets the geocode layer id in which the geocoding should be performed.
 void setMaxCandidates(int maxCandidates)
          Sets the maximum number of candidates to return from the geocoding result.
 void setMinScore(int minScore)
          Sets the minimum geocode scoring value.
 void setSpellingSensitivity(int spellingSensitivity)
          Sets the spelling sensitivity for geocoding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AIMSGeocodeFunctionality

public AIMSGeocodeFunctionality()
Method Detail

initFunctionality

public void initFunctionality(GISResource resource)
Description copied from interface: GISFunctionality

The initialization chores for the functionality must be performed in this method. This method is called by the resource when the functionality needs to be initialized. This happens either when the resource itself is being initialized or if users add this functionality to the resource using the GISResource.addFunctionality(String, GISFunctionality) method after the resource has already been initialized.

Classes which implement this method should maintain the resource as a class instance variable and return the same in the GISFunctionality.getResource() method. The functionality is ready for use only after this method has been called.

Specified by:
initFunctionality in interface GISFunctionality
Parameters:
resource - the GISResource that this functionality supports
See Also:
GISResource.init(WebContext)

destroyFunctionality

public void destroyFunctionality()
Description copied from interface: GISFunctionality

The cleanup chores (such as releasing held resources) for the functionality must be performed in this method. This method is called by the GISResource when the resource itself is being destroyed.

The functionality is no longer usable after this method has been called.

Specified by:
destroyFunctionality in interface GISFunctionality
See Also:
GISResource.destroy()

getResource

public AIMSMapResource getResource()
Description copied from interface: GISFunctionality

Returns the GISResource associated with this functionality.

The resource passed to GISFunctionality.initFunctionality(GISResource) is maintained as a class variable and is accessible through this method.

Specified by:
getResource in interface GISFunctionality
Returns:
the GISResource associated with this functionality

getAddressFields

public String[] getAddressFields()
Description copied from interface: GeocodeFunctionality

Returns an array of address fields for this geocoder. Every implementation of GeocodeFunctionality defines the address fields that are available.

The GeocodeTask dynamically generates input text box for each address field.

Specified by:
getAddressFields in interface GeocodeFunctionality
Returns:
a String array of address fields for this geocoder

setAddressFieldValue

public void setAddressFieldValue(String fieldName,
                                 String value)
Description copied from interface: GeocodeFunctionality

Sets the value for a given address field.

Specified by:
setAddressFieldValue in interface GeocodeFunctionality
Parameters:
fieldName - the address field for which the value is to be set
value - the value for the given address field

getAddressFieldValue

public String getAddressFieldValue(String fieldName)
Description copied from interface: GeocodeFunctionality

Returns the value for a given address field.

Specified by:
getAddressFieldValue in interface GeocodeFunctionality
Parameters:
fieldName - the address field for which the value is to be returned
Returns:
the value for the given address field

getAddressFieldAlias

public String getAddressFieldAlias(String fieldName)
Description copied from interface: GeocodeFunctionality

Returns an alias for the given address field.

The GeocodeTask labels the input text box for the address field with this alias.

Specified by:
getAddressFieldAlias in interface GeocodeFunctionality
Parameters:
fieldName - the address field for which the alias is to be returned
Returns:
the alias for the given address field

findAddressCandidates

public List<AddressCandidate> findAddressCandidates()
Description copied from interface: GeocodeFunctionality

Returns a List of AddressCandidates based on the current set of address field values.

Specified by:
findAddressCandidates in interface GeocodeFunctionality
Returns:
a List of AddressCandidates matching the current set of address field values

geocodeAddress

public AddressCandidate geocodeAddress()
Description copied from interface: GeocodeFunctionality

Geocodes a single address based on the current set of address field values.

Specified by:
geocodeAddress in interface GeocodeFunctionality
Returns:
a single geocoded address

getMap

public com.esri.aims.mtier.model.map.Map getMap()
Returns the Map object.

Returns:
the map object

setGeocodeLayerId

public void setGeocodeLayerId(String geocodeLayerId)
Sets the geocode layer id in which the geocoding should be performed.

If the geocode layer id is not set then the first available geocode layer id is set automatically from the associated resource.

Parameters:
geocodeLayerId - the geocode layer id

getGeocodeLayerId

public String getGeocodeLayerId()
Returns the geocode layer id.

Returns:
the geocode layer id

setAliases

public void setAliases(HashMap<String,String> aliases)

Sets the aliases for the geocoding style ids.

For example, if the geocoding style is

 <EXTENSION type="geocode">
   <GCSTYLE name="USAddressZ">
     <GCINPUT id="STREET" description="street number, street name and type" label="Street" type="text" width="10"/>
     <GCINPUT id="ZONE" description="zone information" label="Zone" type="text" width="5"/>
     <GCINPUT id="CROSSSTREET" description="cross street name and type" label="Cross street" type="text" width="10"/>
   </GCSTYLE>
  </EXTENSION>
 

then

  AIMSGeocodeFunctionality gFunc = ...;
  HashMap aliases = new HashMap();
  aliases.put("STREET", "Street");
  aliases.put("ZONE", "ZIP");
  gFunc.setAliases(aliases);
 

Parameters:
aliases - the aliases for the geocoding style ids

getAliases

public HashMap<String,String> getAliases()
Returns the aliases for the geocoding style ids.

Returns:
HashMap the aliases for the geocoding style ids.

setDefaultValue

public void setDefaultValue(HashMap<String,String> defaultValue)

Sets the default values for the geocoding style ids.

  AIMSGeocodeFunctionality gFunc = ...;
  HashMap defaultValues = new HashMap();
  aliases.put("STREET", "380 New York St");
  aliases.put("ZONE", "92373");
  gFunc.setAliases(defaultValues);
 

Parameters:
defaultValue - the default values

getDefaultValue

public HashMap<String,String> getDefaultValue()
Return the default values for the geocoding style ids.

Returns:
HashMap the default values for the geocoding style ids.

setSpellingSensitivity

public void setSpellingSensitivity(int spellingSensitivity)
Sets the spelling sensitivity for geocoding. The defaut value is 80.

Parameters:
spellingSensitivity - the spelling sensitivity for geocoding service

getSpellingSensitivity

public int getSpellingSensitivity()
Returns the spelling sensitivity for geocoding.

Returns:
the spelling sensitivity for geocoding

setMinScore

public void setMinScore(int minScore)
Sets the minimum geocode scoring value. If this value is not set, all candidates with scores above 60 are returned. A candidate with a score of 100 means a perfect match, and 0 means no match.

Parameters:
minScore - the minimum scoring value

getMinScore

public int getMinScore()
Returns the minimum geocode scoring value.

Returns:
the minimum geocode scoring value

setMaxCandidates

public void setMaxCandidates(int maxCandidates)
Sets the maximum number of candidates to return from the geocoding result. The default value is 20.

Parameters:
maxCandidates - the maximum number of candidates to return

getMaxCandidates

public int getMaxCandidates()
Returns the maximum number of geocoding result candidates value.

Returns:
the maximum number of candidates to return

setDefaultDataFrame

public void setDefaultDataFrame(String defaultDataFrame)
Sets the default data frame in which the geocode functionality should work with.

Parameters:
defaultDataFrame - the default dataframe name

getDefaultDataFrame

public String getDefaultDataFrame()
Returns the default dataframe name.

Returns:
the default dataframe name