Search in sources :

Example 1 with DatasetModel

use of com.iplanet.jato.model.DatasetModel in project OpenAM by OpenRock.

the class PWResetQuestionTiledView method getAnswers.

/**
     * Gets the answer to the secret question
     *
     * @return answer to the secret question
     */
public Map getAnswers() {
    Map map = Collections.EMPTY_MAP;
    PWResetQuestionModel model = getModel();
    try {
        DatasetModel dataModel = getPrimaryModel();
        int size = dataModel.getSize();
        if (size > 0) {
            dataModel.first();
            map = new HashMap(size);
        }
        for (int i = 0; i < size; i++) {
            HiddenField hf = (HiddenField) getChild(FLD_ATTR_NAME);
            String attrName = (String) hf.getValue();
            String answer = (String) getDisplayFieldValue(TF_ANSWER);
            if (answer != null) {
                answer = answer.trim();
            }
            if (answer == null || answer.length() == 0) {
                missingData = true;
            }
            map.put(attrName, answer);
            dataModel.next();
        }
    } catch (ModelControlException mce) {
        model.debugError("PWResetQuestionTiledView.getAnswers", mce);
    }
    return map;
}
Also used : HashMap(java.util.HashMap) HiddenField(com.iplanet.jato.view.html.HiddenField) ModelControlException(com.iplanet.jato.model.ModelControlException) HashMap(java.util.HashMap) Map(java.util.Map) DatasetModel(com.iplanet.jato.model.DatasetModel) PWResetQuestionModel(com.sun.identity.password.ui.model.PWResetQuestionModel)

Aggregations

DatasetModel (com.iplanet.jato.model.DatasetModel)1 ModelControlException (com.iplanet.jato.model.ModelControlException)1 HiddenField (com.iplanet.jato.view.html.HiddenField)1 PWResetQuestionModel (com.sun.identity.password.ui.model.PWResetQuestionModel)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1