Package com.dotmarketing.portlets.communications.struts

Examples of com.dotmarketing.portlets.communications.struts.CommunicationsForm


          _sendToReferral(req, res, referer);
        }

        HibernateUtil.commitTransaction();
    if(req.getAttribute(com.dotmarketing.util.WebKeys.COMMUNICATION_EDIT_FORM) == null){
      CommunicationsForm cform = (CommunicationsForm) form;
      if(!UtilMethods.isSet(cform.getModDate())){
        cform.setModDate(new java.util.Date());
        cform.setModifiedBy(user.getUserId());
      }
      req.setAttribute(com.dotmarketing.util.WebKeys.COMMUNICATION_EDIT_FORM, cform);
    }
    setForward(req,"portlet.ext.communications.edit_communication");
   
View Full Code Here


  }
 
  public void _editCommunication(ActionRequest req, ActionResponse res,PortletConfig config,ActionForm form, User user)
  throws Exception {
   
    CommunicationsForm cfform = (CommunicationsForm) form;
    Communication c = (Communication) req.getAttribute(WebKeys.COMMUNICATION_EDIT);
   
    BeanUtils.copyProperties(cfform, c);
   
    if(cfform.getModDate() == null)
      cfform.setModDate(new java.util.Date());
     
    //add the html page to the Communication
    HTMLPage page = (HTMLPage) InodeFactory.getChildOfClass(c, HTMLPage.class);
    if (InodeUtils.isSet(page.getIdentifier())) {
      cfform.setHtmlPage(page.getIdentifier());
    }
   
    VirtualLink vl = (VirtualLink) InodeFactory.getChildOfClass(c, VirtualLink.class);
    if (InodeUtils.isSet(vl.getInode())) {
      cfform.setTrackBackLinkInode(vl.getInode());
    }
    req.setAttribute(WebKeys.COMMUNICATION_EDIT_FORM, cfform);
  }
View Full Code Here

 
  public void _saveCommunication(ActionRequest req, ActionResponse res,PortletConfig config,ActionForm form, User user)
  throws Exception {
   
    Communication c = (Communication) req.getAttribute(WebKeys.COMMUNICATION_EDIT);
    CommunicationsForm cfform = (CommunicationsForm) form;
   
    BeanUtils.copyProperties(req.getAttribute(WebKeys.COMMUNICATION_EDIT), cfform);
   
    if(cfform.getModDate() == null){
      c.setModDate(new java.util.Date());
    }
   
    c.setModifiedBy(user.getUserId());
   
    _checkUserPermissions(c, user, PERMISSION_WRITE);
   
    if (req.getParameter("typeContent").equals("HTMLPage") &&
        !cfform.getCommunicationType().equalsIgnoreCase("alert")) {
      c.setTextMessage("");
    }
    if (!cfform.getCommunicationType().equalsIgnoreCase("email")) {
      c.setFromEmail("");
      c.setFromName("");
      c.setEmailSubject("");
      c.setHtmlPage(null);
      cfform.setHtmlPage(null);
    }
    if (!cfform.getCommunicationType().equalsIgnoreCase("external")) {
      c.setTrackBackLinkInode(null);
      c.setExternalCommunicationIdentifier("");
      cfform.setTrackBackLinkInode(null);
    }

    try {

      // HibernateUtil.saveOrUpdate(c);
      HibernateUtil.saveOrUpdate(c);

    } catch (DotHibernateException dhe) {
      SessionMessages.add(req, "error", "error.communications.not-saved");
      //setForward(req,"portlet.ext.communications.edit_communication");
      throw new ActionException(dhe.getMessage());
    }

   
    // wipe the old HTML page entries
    HTMLPage page = (HTMLPage) InodeFactory.getChildOfClass(c, HTMLPage.class);
    if (InodeUtils.isSet(page.getInode()))
      c.deleteChild(page);
   
    if (req.getParameter("typeContent").equals("HTMLPage")) {
      //try to get the Communication's page
      if (InodeUtils.isSet(cfform.getHtmlPage())) {
        page = (HTMLPage) InodeFactory.getInode(String.valueOf(cfform.getHtmlPage()), HTMLPage.class);
        if (InodeUtils.isSet(page.getInode())) {
          c.addChild(page);
          c.setHtmlPage(page.getIdentifier());
        }
      }
    }
   
    // wipe the old VirtualLink entries
    VirtualLink vl = (VirtualLink) InodeFactory.getChildOfClass(c, VirtualLink.class);
    if (InodeUtils.isSet(vl.getInode()))
      c.deleteChild(vl);
   
    //try to get the Communication's virtual link
    if (InodeUtils.isSet(cfform.getTrackBackLinkInode())) {
      vl = VirtualLinkFactory.getVirtualLink(String.valueOf(cfform.getTrackBackLinkInode()));
      if (InodeUtils.isSet(vl.getInode())) {
        c.addChild(vl);
        c.setTrackBackLinkInode(vl.getInode());
      }
    }
View Full Code Here

TOP

Related Classes of com.dotmarketing.portlets.communications.struts.CommunicationsForm

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.