com.waveset.policy
Class LighthouseAccountPolicy.Question

java.lang.Object
  extended bycom.waveset.util.AbstractXmlObject
      extended bycom.waveset.policy.LighthouseAccountPolicy.Question
All Implemented Interfaces:
javax.naming.Referenceable, XmlObject
Enclosing class:
LighthouseAccountPolicy

public static class LighthouseAccountPolicy.Question
extends AbstractXmlObject

A class used to represent one authentication question.

We need to support editing of the question text, without losing the association of answers to these questions that have already been gathered. To do this, each question must have a generated unique id, similar to the id we generate for persistent objects. This will always serve as the reference handle from an answer to the question.

Hmm, instead of storing the question text, should we be storing a key in to the message catalog?


Field Summary
static java.lang.String ELEMENT
          Name of the serialized XML element.
 
Fields inherited from class com.waveset.util.AbstractXmlObject
_trace, code_id
 
Constructor Summary
LighthouseAccountPolicy.Question(org.w3c.dom.Element e)
          Construct a question by parsing its DOM representation.
LighthouseAccountPolicy.Question(java.lang.String question)
          Construct a question given its question text, automatically generating a new question id.
LighthouseAccountPolicy.Question(java.lang.String id, java.lang.String question)
          Construct a new question with a predefine id.
 
Method Summary
protected  void generateId()
          Generate a unique question id if there isn't one yet.
static java.lang.String generateQuestionId()
          Generate a unique id string for a Question.
 java.lang.String getElementName()
          Return the element name.
 java.lang.String getId()
          Get the question id.
 java.lang.String getQuestion()
          Get the question text.
 GenericObject getView()
          Return the view representation - a generic object with attributes: id question name
 void parseXml(org.w3c.dom.Element e)
          Parse the DOM representation of a question, filling out the associated fields.
static java.util.List parseXmlList(org.w3c.dom.Element e)
          Builds an ArrayList of Question objects by parsing the XML representation of a Question list.
 void setQuestion(java.lang.String q)
          Change the question text, automatically generating a new question id.
 void toXml(java.lang.StringBuffer b, int indent)
          Serialize the question to an XML buffer.
 
Methods inherited from class com.waveset.util.AbstractXmlObject
addXmlHeader, cloneObject, dump, dumpFile, getReference, println, setTrace, toIdentityString, toVerboseString, toVerboseString, toXml, toXml, toXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ELEMENT

public static final java.lang.String ELEMENT
Name of the serialized XML element.

See Also:
Constant Field Values
Constructor Detail

LighthouseAccountPolicy.Question

public LighthouseAccountPolicy.Question(java.lang.String id,
                                        java.lang.String question)
Construct a new question with a predefine id.


LighthouseAccountPolicy.Question

public LighthouseAccountPolicy.Question(org.w3c.dom.Element e)
Construct a question by parsing its DOM representation.


LighthouseAccountPolicy.Question

public LighthouseAccountPolicy.Question(java.lang.String question)
Construct a question given its question text, automatically generating a new question id.

Method Detail

getElementName

public java.lang.String getElementName()
Description copied from class: AbstractXmlObject
Return the element name.

Specified by:
getElementName in interface XmlObject
Specified by:
getElementName in class AbstractXmlObject

getId

public java.lang.String getId()
Get the question id.


getQuestion

public java.lang.String getQuestion()
Get the question text.


setQuestion

public void setQuestion(java.lang.String q)
Change the question text, automatically generating a new question id.


generateId

protected void generateId()
Generate a unique question id if there isn't one yet.


generateQuestionId

public static java.lang.String generateQuestionId()
Generate a unique id string for a Question.


toXml

public void toXml(java.lang.StringBuffer b,
                  int indent)
Serialize the question to an XML buffer. If it does not have question text, filter it out (it should have been filtered above here).

Specified by:
toXml in interface XmlObject
Specified by:
toXml in class AbstractXmlObject

getView

public GenericObject getView()
Return the view representation - a generic object with attributes: id question name


parseXml

public void parseXml(org.w3c.dom.Element e)
Parse the DOM representation of a question, filling out the associated fields.


parseXmlList

public static java.util.List parseXmlList(org.w3c.dom.Element e)
                                   throws WavesetException
Builds an ArrayList of Question objects by parsing the XML representation of a Question list.

The provided element is expected to be the wrapper elements, its name is unimportant. We extract any elements contained in the wrapper.

Throws:
WavesetException