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 SelectQuestion

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.SelectQuestion
All Implemented Interfaces:
java.io.Serializable

@Entity
public class SelectQuestion
extends AbstractQuestion

Is a question providing multiple values to select.

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

Constructor Summary
protected SelectQuestion()
          Default constructor.
  SelectQuestion(java.util.Collection<java.lang.String> values, java.lang.Boolean isAllowBlank, java.lang.Integer noSelects, java.lang.Boolean selectExact, java.lang.Boolean customVal)
          Creates a new SelectQuestion with the given value for isAllowBlank.
 
Method Summary
 AbstractTypedAnswer<?> getAnswer(ServiceRequest request)
          Tries to extract the answer to the SelectQuestion from the given ServiceRequest.
 int getNoOfSelects()
          Returns the noOfSelects.
 java.util.Collection<java.lang.String> getSelectValues()
          Returns the selectValues.
 boolean isCustomValue()
          Returns the customValue.
 boolean isSelectExactNoOfSelects()
          Returns the selectExactNoOfSelects.
 boolean isValid(AbstractTypedAnswer<?> answer)
          Checks the given {@code AbstractTypedAnswer
 void setCustomValue(boolean customVal)
          Sets the customValue.
 void setNoOfSelects(int noSelects)
          Sets the noOfSelects.
 void setSelectExactNoOfSelects(boolean selectExact)
          Sets the selectExactNoOfSelects.
 void setSelectValues(java.util.Collection<java.lang.String> values)
          Sets the selectValues.
 
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

SelectQuestion

protected SelectQuestion()
Default constructor.


SelectQuestion

public SelectQuestion(java.util.Collection<java.lang.String> values,
                      java.lang.Boolean isAllowBlank,
                      java.lang.Integer noSelects,
                      java.lang.Boolean selectExact,
                      java.lang.Boolean customVal)
Creates a new SelectQuestion with the given value for isAllowBlank.

Parameters:
values - the values
isAllowBlank - the value for isAllowBlank to set
noSelects - the number of allowed selects
selectExact - indicates if the noOfSelects is exactly required NOTE: will be ignored if noSelects is null or 0 (zero)
customVal - indicates whether to use a custom value also
Method Detail

setSelectValues

public final void setSelectValues(java.util.Collection<java.lang.String> values)
Sets the selectValues.

Parameters:
values - the selectValues to set

getSelectValues

public final java.util.Collection<java.lang.String> getSelectValues()
Returns the selectValues.

Returns:
the selectValues

setNoOfSelects

public final void setNoOfSelects(int noSelects)
Sets the noOfSelects.

Parameters:
noSelects - the noOfSelects to set

getNoOfSelects

public final int getNoOfSelects()
Returns the noOfSelects.

Returns:
the noOfSelects

setSelectExactNoOfSelects

public final void setSelectExactNoOfSelects(boolean selectExact)
Sets the selectExactNoOfSelects.

Parameters:
selectExact - the selectExactNoOfSelects to set

isSelectExactNoOfSelects

public final boolean isSelectExactNoOfSelects()
Returns the selectExactNoOfSelects.

Returns:
the selectExactNoOfSelects

setCustomValue

public final void setCustomValue(boolean customVal)
Sets the customValue.

Parameters:
customVal - the customValue to set

isCustomValue

public final boolean isCustomValue()
Returns the customValue.

Returns:
the customValue

getAnswer

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

Specified by:
getAnswer in class AbstractQuestion
Parameters:
request - the ServiceRequest
Returns:
an AbstractTypedAnswer<?>; precisely a SelectQuestionAnswer
See Also:
(org.torweg.pulse.service.request.ServiceRequest)

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)