Package com.liusoft.dlog4j.formbean

Examples of com.liusoft.dlog4j.formbean.MusicBoxForm


   * @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);
  }
View Full Code Here


   * @throws Exception
   */
  protected ActionForward doDeleteBox(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response,
      String mboxid) throws Exception {
    MusicBoxForm mform = (MusicBoxForm) form;
    ActionMessages msgs = validateSiteOwner(request, response, mform);
    if (msgs.isEmpty()) {
      SiteBean site = super.getSiteBean(request);
      MusicBoxBean mbox = MusicDAO.getMusicBoxByID(Integer
          .parseInt(mboxid));
      if (mbox.getSite().getId() == site.getId())
        MusicDAO.deleteMusicBox(mbox);
    }
    return makeForward(mapping.findForward("music"), mform.getSid());
  }
View Full Code Here

   * @throws Exception
   */
  protected ActionForward doUpdateBox(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    MusicBoxForm mform = (MusicBoxForm) form;
    super.validateClientId(request, mform);
    if (StringUtils.isNotEmpty(mform.getName())) {
      ActionMessages msgs = validateSiteOwner(request, response, mform);
      if (msgs.isEmpty()) {
        SiteBean site = super.getSiteBean(request);
        MusicBoxBean mbox = MusicDAO.getMusicBoxByID(mform.getId());
        if (mbox.getSite().getId() == site.getId()) {
          mbox.setName(super.autoFiltrate(site,mform.getName()));
          if (StringUtils.isNotEmpty(mform.getDesc())){
            String desc = super.autoFiltrate(site,mform.getDesc());
            mbox.setDesc(desc);
          }
          else
            mbox.setDesc(null);
          MusicDAO.flush();
        }
      }
    }
    return makeForward(mapping.findForward("music"), mform.getSid(), "box",
        mform.getId());
  }
View Full Code Here

TOP

Related Classes of com.liusoft.dlog4j.formbean.MusicBoxForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.