/* (non-Javadoc)
* @see com.agiletec.plugins.jpsurvey.apsadmin.survey.IChoiceAction#addNewFreeText()
*/
public String addNewFreeText() {
Choice choice = null;
// fake XML common for every free text option record
String xml="<?xml version=\"1.0\" encoding=\"UTF-8\"?><properties><property key=\"ERROR\">YOU SHOULD _NOT_ SEE THIS</property></properties>";
ApsProperties prop = new ApsProperties();
this.setStrutsAction(ApsAdminSystemConstants.ADD);
try {
if (null == this.getQuestionId() || null == this.getStrutsAction()) {
this.addActionError(this.getText("message.surveyAction.cannotProceed"));
return INPUT;
}
prop.loadFromXml(xml);
if (this.getStrutsAction() == ApsAdminSystemConstants.EDIT) {
this.addActionError(this.getText("message.choiceAction.unexpextedAction", new String[]{this.getText("_choice"), this.getText("freeText")}));
return INPUT;
}
choice = new Choice();
choice.setChoices(prop);
choice.setQuestionId(this.getQuestionId());
choice.setFreeText(true);
this.getSurveyManager().saveChoiceInSortedPosition(choice);
this.setChoiceId(choice.getId());
} catch (Throwable t) {
ApsSystemUtils.logThrowable(t, this, "addNewFreeText");
return FAILURE;
}
return SUCCESS;