public class ModifyAction extends BaseAction {
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
WebUser user = SessionUtils.getWebUser(request.getSession());
WebUserPreferences preferences = user.getWebPreferences();
PropertiesForm pForm = (PropertiesForm) form;
ActionForward forward = checkSubmit(request, mapping, form);
String returnString = RetCodeConstants.SUCCESS_URL;
if (forward != null) {
return forward;
}
if (!pForm.isDisplayOnDash()) {
DashboardUtils.removePortlet(user, pForm.getPortletName());
}
String[] charts = pForm.getCharts();
if (charts != null) {
SavedChartsPortletPreferences savedCharts = preferences.getSavedChartsPortletPreferences();
for (String chartToRemove : charts) {
savedCharts.removeByTuple(chartToRemove);
}
preferences.setSavedChartsPortletPreferences(savedCharts);
returnString = "remove";
}
return mapping.findForward(returnString);