pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.component.survey.model
Class OpenQuestion

java.lang.Object
  extended by org.torweg.pulse.util.entity.AbstractBasicEntity
      extended by org.torweg.pulse.component.survey.model.AbstractQuestion
          extended by org.torweg.pulse.component.survey.model.OpenQuestion
All Implemented Interfaces:
java.io.Serializable

@Entity
public class OpenQuestion
extends AbstractQuestion

Is an open question.

Version:
$Revision: 1586 $
Author:
Daniel Dietz
See Also:
Serialized Form

Constructor Summary
protected OpenQuestion()
          Default constructor.
  OpenQuestion(java.lang.String regex, java.lang.Boolean isAllowBlank)
          Creates a new OpenQuestion with the given value for isAllowBlank.
 
Method Summary
 AbstractTypedAnswer<?> getAnswer(ServiceRequest request)
          Tries to extract the answer to the OpenQuestion from the given ServiceRequest.
 java.lang.String getRegexpression()
          Returns the regular expression.
 boolean isValid(AbstractTypedAnswer<?> answer)
          Checks the given {@code AbstractTypedAnswer
 void setRegexpression(java.lang.String regex)
          Sets the regular expression.
 
Methods inherited from class org.torweg.pulse.component.survey.model.AbstractQuestion
getQuestionText, isAllowBlank, setIsAllowBlank, setQuestionText
 
Methods inherited from class org.torweg.pulse.util.entity.AbstractBasicEntity
compareTo, equals, getFullQualifiedClassNameJAXB, getId, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OpenQuestion

protected OpenQuestion()
Default constructor.


OpenQuestion

public OpenQuestion(java.lang.String regex,
                    java.lang.Boolean isAllowBlank)
Creates a new OpenQuestion with the given value for isAllowBlank.

Parameters:
regex - the regular expression to use for the value check
isAllowBlank - the value for isAllowBlank to set
Method Detail

setRegexpression

public final void setRegexpression(java.lang.String regex)
Sets the regular expression.

Parameters:
regex - the regular expression to set

getRegexpression

public final java.lang.String getRegexpression()
Returns the regular expression.

Returns:
the regular expression

getAnswer

public final AbstractTypedAnswer<?> getAnswer(ServiceRequest request)
Tries to extract the answer to the OpenQuestion from the given ServiceRequest.

Specified by:
getAnswer in class AbstractQuestion
Parameters:
request - the ServiceRequest
Returns:
an AbstractTypedAnswer<?>; precisely a OpenQuestionAnswer

isValid

public final boolean isValid(AbstractTypedAnswer<?> answer)
Checks the given AbstractTypedAnswer<?> for validity.

Specified by:
isValid in class AbstractQuestion
Parameters:
answer - the AbstractTypedAnswer<?> to validate
Returns:
true if the AbstractTypedAnswer<?> is valid, false otherwise
See Also:
(org.torweg.pulse.component.survey.model.answer.AbstractTypedAnswer)