edu.indiana.dde.mylead.common
Class MyLeadElemData

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

public class MyLeadElemData
extends java.lang.Object

The purpose of this class is to be a container for an element within an attribute. Each attribute can consist of one or more elements.
This class is used for attributes in logical files, collections, experiments, and projects.
The attribute elements can be any of the valid MCS types, but the stored procedures will determine based on the element name what the data type should be.

Wrapping Up Attributes For Perform Documents:
To include the attributes in a myLEAD perform document, calling the wrapAttribute method will wrap the attributes in a tag-delimited string that the server side will know how to parse. The wrapElement method is called for each element in the attribute.

The valid MCS data types are:
1. Integer
2. Float
3. String (including TEXT or MEDIUMTEXT blobs)
4. Spatial - spatial is handled by a different class
5. DateTime
6. Date
7. Time


Constructor Summary
MyLeadElemData()
          This default constructor for the MyLeadElemData class sets the name to a blank String, initializes the date format for adding Date elements to mySQL, and sets the element value to null.
MyLeadElemData(java.lang.String element)
          This constructor does the same as the default constructor except that the name of the element is set to the String passed as a parameter.
MyLeadElemData(java.lang.String element, java.util.Date valueDate)
          This overloaded version of the constructor can be used to pass a Date value for the element's value.
MyLeadElemData(java.lang.String element, double numValue)
          This overloaded version of the constructor can be used to pass a floating-point double value for the element's value.
MyLeadElemData(java.lang.String element, int numValue)
          This overloaded version of the constructor can be used to pass an integer value for the element's value.
MyLeadElemData(java.lang.String element, java.lang.String valueStr)
          This overloaded version of the constructor can be used to pass a String value for the element's value.
MyLeadElemData(java.lang.String element, java.lang.String valueStr, boolean isBlob)
          Deprecated. As of version 0.3 Alpha the constructor that takes a string element will convert the value to MediumText (blob) when the value is passed to the metadata catalog though mySQL stored procedures.
 
Method Summary
 java.lang.String getName()
          This method can be called to retrieve the element name previously set either in the constructor or by calling setName.
 java.lang.String getValue()
          This method returns the currently set value as a string.
 void replaceSpecialChars()
           
 void setDateValue(java.util.Date valueDate)
          This method allows the value of the element to be set to the Date value passed as a parameter.
 void setDoubleValue(double numValue)
          This method allows the value of the element to be set to the floating-point double value passed as a parameter.
 void setIntValue(int numValue)
          This method allows the value of the element to be set to the integer value passed as a parameter.
 void setName(java.lang.String element)
          This method allows the element's name to be set.
 void setValue(java.lang.String valueStr)
          This method allows the value of the element to be set to the string passed as a parameter.
 java.lang.String wrapElement()
          This routine wraps up an element and returns a string that can then be used in wrapping an attribute as part of an OGSA-DAI perform document which validates against the leadActivity.xsd schema.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MyLeadElemData

public MyLeadElemData()
This default constructor for the MyLeadElemData class sets the name to a blank String, initializes the date format for adding Date elements to mySQL, and sets the element value to null. The name must be set by calling the setName method before adding the element to a myLEAD metadata catalog or the element will be ignored.
To be added to the myLEAD metadata catalog, the element name must match an element defined in the lead_element_definition table.


MyLeadElemData

public MyLeadElemData(java.lang.String element)
This constructor does the same as the default constructor except that the name of the element is set to the String passed as a parameter.

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

MyLeadElemData

public MyLeadElemData(java.lang.String element,
                      java.lang.String valueStr)
This overloaded version of the constructor can be used to pass a String value for the element's value. Although the value is passed as a string, it must match the format of the element as defined in the lead_element_definition table. For example, an element expecting a numeric value cannot be passed the name "bob". While such a value will validate against the leadActivity.xsd schema, it will be caught by the stored procedures when adding the element to the catalog and the element will be discarded for the attribute it is contained within.

Parameters:
element - String with the name of the element.
valueStr - String containing the value for the element.

MyLeadElemData

public MyLeadElemData(java.lang.String element,
                      java.lang.String valueStr,
                      boolean isBlob)
Deprecated. As of version 0.3 Alpha the constructor that takes a string element will convert the value to MediumText (blob) when the value is passed to the metadata catalog though mySQL stored procedures.


MyLeadElemData

public MyLeadElemData(java.lang.String element,
                      java.util.Date valueDate)
This overloaded version of the constructor can be used to pass a Date value for the element's value.

Parameters:
element - String with the name of the element.
valueDate - Date containing the value for the element.

MyLeadElemData

public MyLeadElemData(java.lang.String element,
                      int numValue)
This overloaded version of the constructor can be used to pass an integer value for the element's value.

Parameters:
element - String with the name of the element.
numValue - integer containing the value for the element.

MyLeadElemData

public MyLeadElemData(java.lang.String element,
                      double numValue)
This overloaded version of the constructor can be used to pass a floating-point double value for the element's value.

Parameters:
element - String with the name of the element.
numValue - double containing the value for the element.
Method Detail

setName

public void setName(java.lang.String element)
This method allows the element's name to be set. If the default constructor is used, this method must be called to set the name before adding the attribute this element is contained within to the myLEAD metadata catalog.
To be added to the myLEAD metadata catalog, the element name must match an element defined in the lead_element_definition table.

Parameters:
element - String containing the name of the element.

getName

public java.lang.String getName()
This method can be called to retrieve the element name previously set either in the constructor or by calling setName. This could be a blank string if the default constructor was used.

Returns:
String containing the element name.

setValue

public void setValue(java.lang.String valueStr)
This method allows the value of the element to be set to the string passed as a parameter.

Parameters:
valueStr - String containing the value to be set for the element.

setDateValue

public void setDateValue(java.util.Date valueDate)
This method allows the value of the element to be set to the Date value passed as a parameter. The Date passed will be formatted for the perform document as an XML date.

Parameters:
valueDate - Date containing the value to be set for the element.

setIntValue

public void setIntValue(int numValue)
This method allows the value of the element to be set to the integer value passed as a parameter.

Parameters:
numValue - integer containing the value to be set for the element.

setDoubleValue

public void setDoubleValue(double numValue)
This method allows the value of the element to be set to the floating-point double value passed as a parameter.

Parameters:
numValue - double containing the value to be set for the element.

getValue

public java.lang.String getValue()
This method returns the currently set value as a string. All of different value types are converted to strings in the constructor or set methods.

Returns:
String containing the element's value.

replaceSpecialChars

public void replaceSpecialChars()

wrapElement

public java.lang.String wrapElement()
This routine wraps up an element and returns a string that can then be used in wrapping an attribute as part of an OGSA-DAI perform document which validates against the leadActivity.xsd schema.

If the element does not have a name or a value (either is a blank string) then this method will return a blank string - which effectively discards the element from the attribute.

Returns:
Returns an XML fragment that wraps up the element.