* @throws Exception
*/
protected ActionForward doCreate(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
MusicBoxForm mbox = (MusicBoxForm) form;
super.validateClientId(request, mbox);
ActionMessages msgs = validateSiteOwner(request, response, mbox);
int mboxid = -1;
if (msgs.isEmpty() && StringUtils.isEmpty(mbox.getName()))
msgs.add("name", new ActionMessage("error.mbox.name_empty"));
else if (msgs.isEmpty()) {
SiteBean site = super.getSiteBean(request);
MusicBoxBean mbean = new MusicBoxBean();
mbean.setName(super.autoFiltrate(site, mbox.getName()));
if (StringUtils.isNotEmpty(mbox.getDesc())){
String desc = super.autoFiltrate(site, mbox.getDesc());
mbean.setDesc(super.filterScriptAndStyle(desc));
}
mbean.setCreateTime(new Date());
mbean.setSite(site);
MusicDAO.createBox(mbean, mbox.getId(), mbox.getDirection() == 1);
mboxid = mbean.getId();
}
if (!msgs.isEmpty()) {
saveMessages(request, msgs);
return mapping.findForward("mbox_add");
}
return makeForward(mapping.findForward("music"), mbox.getSid(), "box",
mboxid);
}