edu.indiana.dde.mylead.common
Class MyLeadGeoData

java.lang.Object
  extended byedu.indiana.dde.mylead.common.MyLeadGeoData

public class MyLeadGeoData
extends java.lang.Object

The purpose of this class is to be a container for a point or polygon spatial element when adding an attribute to the myLEAD metadata catalog. Each attribute can consist of one or more elements.

Wrapping Up Attributes For Perform Documents:
To include the attributes in a myLEAD query perform document, calling the wrapAttribute method will wrap the attribute in a tag-delimited string that validates against the leadActivity.xsd schema used to validate the perform documents. The wrapElement method is called for each element in an attribute.


Constructor Summary
MyLeadGeoData()
          This default constructor sets the name of the spatial element to a blank String.
MyLeadGeoData(java.lang.String element)
          This constructor takes a String for the name of the spatial element.
MyLeadGeoData(java.lang.String element, double xCoordinate, double yCoordinate)
          This constructor takes not only a String for the name of the spatial element, but also parameters for the x and y coordinates of the first and possibly only point in this spatial element.
 
Method Summary
 void addPoint(double xCoordinate, double yCoordinate)
          This method is called to add a point to a spatial element.
 void addPoint(MyLeadPt pt)
          This version of addPoint takes an instance of MyLeadPt that has already been populated with the x and y coordinates for the point.
 java.lang.String getName()
          This method returns the name of the spatial element as set in the constructor or in a call to the setName method.
 void setName(java.lang.String element)
          This method allows the name of the element to be set.
 java.lang.String wrapElement()
          This method wraps up an element and returns a string that can then be used in the perform document for the myLEAD create method used to add an object or attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MyLeadGeoData

public MyLeadGeoData()
This default constructor sets the name of the spatial element to a blank String. The name of the element must be set to an element defined in the lead_element_definition table.


MyLeadGeoData

public MyLeadGeoData(java.lang.String element)
This constructor takes a String for the name of the spatial element. The name must be set to an element defined in the lead_element_definition table.

Parameters:
element - String with the name of the spatial element.

MyLeadGeoData

public MyLeadGeoData(java.lang.String element,
                     double xCoordinate,
                     double yCoordinate)
This constructor takes not only a String for the name of the spatial element, but also parameters for the x and y coordinates of the first and possibly only point in this spatial element. The name must be set to an element defined in the lead_element_definition table.

Parameters:
element - String with the name of the spatial element.
xCoordinate - double for the x-coordinate of the first point.
yCoordinate - double for the y-coordinate of the first point.
Method Detail

setName

public void setName(java.lang.String element)
This method allows the name of the element to be set. If the default constructor was used, then this method must be used. The name must be set to an element defined in the lead_element_definition table.

Parameters:
element - String with the name of the spatial element.

getName

public java.lang.String getName()
This method returns the name of the spatial element as set in the constructor or in a call to the setName method.

Returns:
String with the name of the spatial element.

addPoint

public void addPoint(double xCoordinate,
                     double yCoordinate)
This method is called to add a point to a spatial element. The point added will be appended to the end of the list of points for this spatial element, so the points of a polygon must be added in order.

Parameters:
xCoordinate - double for the x-coordinate of the point.
yCoordinate - double for the y-coordinate of the point.

addPoint

public void addPoint(MyLeadPt pt)
This version of addPoint takes an instance of MyLeadPt that has already been populated with the x and y coordinates for the point. If the point is not already populated, then its isInitialized method will return false and the point will not be added.

Parameters:
pt - An instance of MyLeadPt that must already be populated.

wrapElement

public java.lang.String wrapElement()
This method wraps up an element and returns a string that can then be used in the perform document for the myLEAD create method used to add an object or attribute.

Returns:
String containing the XML fragment that wraps up the element.