Package org.dlese.dpc.suggest
Class SuggestUtils
java.lang.Object
org.dlese.dpc.suggest.SuggestUtils
Utilities supporting the Suggestor clients.
- Version:
- $Id: SuggestUtils.java,v 1.10 2009/03/20 23:34:00 jweather Exp $
- Author:
- ostwald
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String[]Converts a comma-delimited string into a String array.static StringReturns current time in yyyy-MM-dd formatstatic ArrayListgetEnumeratedValues(org.dom4j.Document doc, String xpath) Gets the enumeratedValues of the element of doc at xpath.static Stringreturns current time in "yyyy-MM-dd'T'HH:mm:ss'Z'" formatstatic StringgetNameSpaceInfo(SchemaHelper schemaHelper) Calculates the nameSpaceInfo attribute for item records.static voidsetDebug(boolean db) Sets the debug attributestatic booleanvalidateEmail(String email) Simple email validation, throwing Exception containing error if not valid.
-
Field Details
-
FullDateFormatString
NOT YET DOCUMENTED -
BriefDateFormatString
NOT YET DOCUMENTED
-
-
Constructor Details
-
SuggestUtils
public SuggestUtils()
-
-
Method Details
-
validateEmail
Simple email validation, throwing Exception containing error if not valid.Validates eemail address against two rules:
- MUST have one and only one "@"
- must not end in aPeriod
- Parameters:
email- NOT YET DOCUMENTED- Returns:
- NOT YET DOCUMENTED
- Throws:
Exception- NOT YET DOCUMENTED
-
getEnumeratedValues
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- anDocumentxpath- xpath to a specificElement- Returns:
- a list of the value attribute value for all children of the target element.
-
getNameSpaceInfo
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
returns current time in "yyyy-MM-dd'T'HH:mm:ss'Z'" format- Returns:
- The fullDate value
-
getBriefDate
Returns current time in yyyy-MM-dd format- Returns:
- The briefDate value
-
commaDelimitedToArray
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
-