Package com.liusoft.dlog4j.formbean

Examples of com.liusoft.dlog4j.formbean.LinkForm


      LinkDAO.create(lbean, 0, false);
      msg = super.getMessage(request, null, "link.added");
      break;
    }while(true);
   
    LinkForm lform = (LinkForm)form;
    String fromPage = lform.getFromPage();
   
    return msgbox(mapping,form,request,response,msg,fromPage);
  }
View Full Code Here


   */
  protected ActionForward doDelete(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response, String s_lnk_id)
      throws Exception
  {
    LinkForm lform = (LinkForm)form;
    try{
      int link_id = Integer.parseInt(s_lnk_id);
      LinkDAO.delete(lform.getSid(), link_id);
    }catch(Exception e){
      context().log("delete link #"+s_lnk_id+" failed.", e);
    }
    return makeForward(mapping.findForward("links"), lform.getSid());
  }
View Full Code Here

   */
  protected ActionForward doMoveUp(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response, String s_lnk_id)
      throws Exception
  {
    LinkForm lform = (LinkForm)form;
    try{
      int link_id = Integer.parseInt(s_lnk_id);
      LinkDAO.move(getSiteBean(request), link_id, true);
    }catch(Exception e){
      context().log("move up link #"+s_lnk_id+" failed.", e);
    }
    return makeForward(mapping.findForward("links"), lform.getSid());
  }
View Full Code Here

   */
  protected ActionForward doMoveDown(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response, String s_lnk_id)
      throws Exception
  {
    LinkForm lform = (LinkForm)form;
    try{
      int link_id = Integer.parseInt(s_lnk_id);
      LinkDAO.move(getSiteBean(request), link_id, false);
    }catch(Exception e){
      context().log("move down link #"+s_lnk_id+" failed.", e);
    }
    return makeForward(mapping.findForward("links"), lform.getSid());
  }
View Full Code Here

   */
  protected ActionForward doCreateLink(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception
  {
    LinkForm lform = (LinkForm)form;
    super.validateClientId(request, lform);
    ActionMessages msgs = new ActionMessages();
    if(StringUtils.isEmpty(lform.getTitle())){
      msgs.add("title", new ActionMessage("error.link_title_empty"));
    }
    else if(StringUtils.isEmpty(lform.getUrl())){
      msgs.add("url", new ActionMessage("error.link_url_empty"));
    }
    else{
      LinkBean lbean = new LinkBean();
      lbean.setCreateTime(new Date());
      lbean.setSiteId(lform.getSid());
      lbean.setTitle(lform.getTitle());
      lbean.setUrl(lform.getUrl());
      lbean.setType(lform.getType());
      lbean.setStatus(lform.getStatus());
      try{
        LinkDAO.create(lbean, lform.getId(), (lform.getDirection()==1));
      }catch(Exception e){
        msgs.add("link", new ActionMessage("error.database", e.getMessage()));
      }
    }
   
    if(!msgs.isEmpty())
      return mapping.getInputForward();
   
    return makeForward(mapping.findForward("links"), lform.getSid());
  }
View Full Code Here

  protected ActionForward doUpdateLink(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception
  {
    String msg = null;
    LinkForm lform = (LinkForm)form;
    if(StringUtils.isEmpty(lform.getTitle())){
      msg = super.getMessage(request, null, "error.link_title_empty");
    }
    else if(StringUtils.isEmpty(lform.getUrl())){
      msg = super.getMessage(request, null, "error.link_url_empty");
    }
    else{
      SiteBean site = getSiteBean(request);
      LinkBean lbean = LinkDAO.getLinkByID(lform.getId());
      if(lbean!=null && lbean.getSiteId()==site.getId()){
        lbean.setTitle(lform.getTitle());
        lbean.setUrl(lform.getUrl());
        lbean.setType(lform.getType());
        lbean.setStatus(lform.getStatus());
        try{
          LinkDAO.update(lbean);
        }catch(Exception e){
          msg = super.getMessage(request, null, "error.database", e.getMessage());
        }
      }
    }
    return msgbox(mapping,form,request,response,msg,lform.getFromPage());
  }
View Full Code Here

TOP

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

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.