return this.getGroupManager().getGroups();
}
@Override
public String saveSurvey() {
Survey survey = null;
try {
if (this.getStrutsAction() == ApsAdminSystemConstants.EDIT) {
survey = this.getSurveyManager().loadSurvey(this.getSurveyId());
if (null == survey) {
return FAILURE;
}
}
if (this.getStrutsAction() == ApsAdminSystemConstants.ADD) {
survey = new Survey();
survey.setQuestionnaire(this.getQuestionnaire());
}
survey.setDescriptions(this.getDescriptions());
survey.setGroupName(this.getGroupName());
survey.setStartDate(this.getStartDate());
survey.setEndDate(this.getEndDate());
if (null == this.getGatherUserInfo()) {
this.addActionError(this.getText("message.surveyAction.cannotProceed"));
return "listSurveys";
}
if (survey.isQuestionnaire()) {
survey.setPublicPartialResult(false);
survey.setPublicResult(false);
} else {
survey.setPublicPartialResult(null != this.getPublicPartialResult() && this.getPublicPartialResult() == 1);
survey.setPublicResult(null != this.getPublicResult() && this.getPublicResult() == 1);
}
survey.setGatherUserInfo(this.getGatherUserInfo() == 1);
survey.setTitles(this.getTitles());
survey.setCheckCookie(this.getCheckCookie() == null ? false : this.getCheckCookie().booleanValue());
survey.setCheckIpAddress(this.getCheckIpAddress() == null ? false : this.getCheckIpAddress().booleanValue());
survey.setCheckUsername(this.getCheckUsername() == null ? false : this.getCheckUsername().booleanValue());
survey.setImageId(this.getImageId());
// refresh the image description if and only if the _survey as an image. A new _survey has no image and description by definition
if (null != survey.getImageId() && this.getStrutsAction() == ApsAdminSystemConstants.EDIT) {
survey.setImageDescriptions(this.getImageDescriptions());
} else {
survey.setImageDescriptions(null);
}
this.setSurvey(survey);
// if the we're editing update the record and return to the proper list
if (this.getStrutsAction() == ApsAdminSystemConstants.EDIT) {
this.getSurveyManager().updateSurvey(survey);
return "listSurveys";
}
if (this.getStrutsAction() == ApsAdminSystemConstants.ADD) {
this.setStrutsAction(ApsAdminSystemConstants.EDIT);
this.getSurveyManager().saveSurvey(survey);
this.setSurveyId(survey.getId());
return "editSurvey";
}
} catch (Throwable t) {
ApsSystemUtils.logThrowable(t, this, "saveSurvey");
return FAILURE;