DLESE Tools
v1.6.0

org.dlese.dpc.suggest
Class SuggestUtils

java.lang.Object
  extended by org.dlese.dpc.suggest.SuggestUtils

public class SuggestUtils
extends Object

Utilities supporting the Suggestor clients.

Version:
$Id: SuggestUtils.java,v 1.10 2009/03/20 23:34:00 jweather Exp $
Author:
ostwald

Field Summary
static String BriefDateFormatString
          NOT YET DOCUMENTED
static String FullDateFormatString
          NOT YET DOCUMENTED
 
Constructor Summary
SuggestUtils()
           
 
Method Summary
static String[] commaDelimitedToArray(String s)
          Converts a comma-delimited string into a String array.
static String getBriefDate()
          Returns current time in yyyy-MM-dd format
static ArrayList getEnumeratedValues(Document doc, String xpath)
          Gets the enumeratedValues of the element of doc at xpath.
static String getFullDate()
          returns current time in "yyyy-MM-dd'T'HH:mm:ss'Z'" format
static String getNameSpaceInfo(SchemaHelper schemaHelper)
          Calculates the nameSpaceInfo attribute for item records.
static void setDebug(boolean db)
          Sets the debug attribute
static boolean validateEmail(String email)
          Simple email validation, throwing Exception containing error if not valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FullDateFormatString

public static String FullDateFormatString
NOT YET DOCUMENTED


BriefDateFormatString

public static String BriefDateFormatString
NOT YET DOCUMENTED

Constructor Detail

SuggestUtils

public SuggestUtils()
Method Detail

validateEmail

public static boolean validateEmail(String email)
                             throws Exception
Simple email validation, throwing Exception containing error if not valid.

Validates eemail address against two rules:

  1. MUST have one and only one "@"
  2. must not end in aPeriod

Parameters:
email - NOT YET DOCUMENTED
Returns:
NOT YET DOCUMENTED
Throws:
Exception - NOT YET DOCUMENTED

getEnumeratedValues

public static ArrayList getEnumeratedValues(Document doc,
                                            String xpath)
Gets the enumeratedValues of the element of doc at xpath. EnumeratedValues are the values of the "value" attribute of children of the target element. This method assumes that the target element has children elements all having a "value" attribute.

Parameters:
doc - an Document
xpath - xpath to a specific Element
Returns:
a list of the value attribute value for all children of the target element.

getNameSpaceInfo

public static String getNameSpaceInfo(SchemaHelper schemaHelper)
Calculates the nameSpaceInfo attribute for item records. nameSpaceInfo is the stuff that goes in the root element of an Instance Document for this framework. The namespace information is stripped from instance documents when they are read into the editor because it makes working with the xml VERY much easier. But it must be added to the document again when it is written to disk, so we keep it here. Eventually the program will be smart enough to manage this process by itself, but for now we give it a crutch . . . This attribute is specified by the properties file.

Parameters:
schemaHelper - NOT YET DOCUMENTED
Returns:
The nameSpaceInfo value

getFullDate

public static String getFullDate()
returns current time in "yyyy-MM-dd'T'HH:mm:ss'Z'" format

Returns:
The fullDate value

getBriefDate

public static String getBriefDate()
Returns current time in yyyy-MM-dd format

Returns:
The briefDate value

commaDelimitedToArray

public static String[] commaDelimitedToArray(String s)
Converts a comma-delimited string into a String array. Used to parse "emailTo" init parameters.

Parameters:
s - comma-delimted string
Returns:
array of Strings

setDebug

public static void setDebug(boolean db)
Sets the debug attribute

Parameters:
db - The new debug value

DLESE Tools
v1.6.0