Package com.dotmarketing.portlets.mailinglists.model

Examples of com.dotmarketing.portlets.mailinglists.model.MailingList


      return list;
    } catch (Exception e) {
      Logger.error(this, e.getMessage(), e);
      return list;
    }    
    MailingList mailingList = MailingListFactory.getMailingListsByInode(mlInode);
   
    try {
      MailingListFactory.addMailingSubscriber(mailingList, userproxy, false);
    } catch (DotHibernateException e) {
      Logger.error(this,e.getMessage(), e);
View Full Code Here


    } catch (Exception e) {
      Logger.error(this, e.getMessage(), e);
      return list;
    }    

    MailingList mailingList = MailingListFactory.getMailingListsByInode(mlInode);
   
    MailingListFactory.deleteUserFromMailingList(mailingList, userproxy);
   
    List<MailingList> mls = MailingListFactory.getMailingListsBySubscriber(user);
    for(MailingList ml : mls){
View Full Code Here

  private List<MailingList> orderMailingListByDescDate(List<MailingList> list) {
    List<MailingList> result = new ArrayList<MailingList>(list.size());
   
    int i;
    boolean added;
    MailingList mailingList2;
   
    for (MailingList mailingList1: list) {
      if (result.size() == 0) {
        result.add(mailingList1);
      } else {
        added = false;
        for (i = 0; i < result.size(); ++i) {
          mailingList2 = result.get(i);
          if (mailingList2.getIDate().before(mailingList1.getIDate())) {
            result.add(i, mailingList1);
            added = true;
            break;
          }
        }
View Full Code Here

                HibernateUtil.saveOrUpdate(sub);

                Campaign c = (Campaign) InodeFactory.getParentOfClass(r, Campaign.class);
                if(c != null && InodeUtils.isSet(c.getInode())) {
          MailingList ml = (MailingList) InodeFactory.getChildOfClass(c,MailingList.class);
                  if(ml != null && InodeUtils.isSet(ml.getInode()))
            MailingListFactory.markAsBounceFromMailingList(ml, sub);
                }
               
            }
            Logger.info(this, "Found a bounce for recipient: " + r.getInode());
View Full Code Here

    BeanUtils.copyProperties(cfform, c);

    if (InodeUtils.isSet(c.getInode())) {
      //add the campaigns mailing list to the form
      MailingList ml = (MailingList) InodeFactory.getChildOfClass(c, MailingList.class);
      cfform.setMailingList(ml.getInode());

      //add the html page to the campaign
      HTMLPage page = (HTMLPage) InodeFactory.getChildOfClass(c, HTMLPage.class);
      if (InodeUtils.isSet(page.getInode())) {
        cfform.setHtmlPage(page.getInode());
View Full Code Here

      BeanUtils.copyProperties(req.getAttribute(WebKeys.CAMPAIGN_EDIT), cfform);
      HibernateUtil.saveOrUpdate(c);

      // wipe the old mailing list that was the child
      MailingList ml = (MailingList) InodeFactory.getChildOfClass(c, MailingList.class);
      c.deleteChild(ml);

      //try to get the campaign's new mailing list
      ml = (MailingList) InodeFactory.getInode(String.valueOf(cfform.getMailingList()), MailingList.class);
      if (InodeUtils.isSet(ml.getInode())) {
        c.addChild(ml);
      }

      // wipe the old communication that was the child
      Communication comm = (Communication) InodeFactory.getChildOfClass(c, Communication.class);
View Full Code Here

  public void _copyCampaign(ActionRequest req, ActionResponse res,PortletConfig config,ActionForm form, User user)
  throws Exception {

    Campaign c = (Campaign) req.getAttribute(WebKeys.CAMPAIGN_EDIT);
    MailingList ml = (MailingList) InodeFactory.getChildOfClass(c, MailingList.class);
    HTMLPage page = (HTMLPage) InodeFactory.getChildOfClass(c, HTMLPage.class);
    Communication comm = (Communication) InodeFactory.getChildOfClass(c, Communication.class);
    UserFilter userfilter = (UserFilter) InodeFactory.getChildOfClass(c, UserFilter.class);

    Campaign copy = CampaignFactory.newInstance();

    copy.setTitle( c.getTitle() + " (copy)");
    copy.setFromEmail(c.getFromEmail());
    copy.setFromName(c.getFromName());
    copy.setCStartDate(c.getCStartDate());
    copy.setSubject(c.getSubject());
    copy.setMessage(c.getMessage());
    copy.setOwner(c.getOwner());
    copy.setUserId(c.getUserId());
    copy.setCommunicationInode(c.getCommunicationInode());
    copy.setUserFilterInode(c.getUserFilterInode());

    //no sure if this is needed
    HibernateUtil.saveOrUpdate(copy);

    if(InodeUtils.isSet(ml.getInode())){
      copy.addChild(ml);
    }
    if(InodeUtils.isSet(page.getInode())){
      copy.addChild(page);
    }
View Full Code Here

      UserWebAPI userWebAPI = WebAPILocator.getUserWebAPI();
        WebContext ctx = WebContextFactory.get();
        User user = userWebAPI.getLoggedInUser(ctx.getHttpServletRequest());
       
        //Saving mailing list
        MailingList ml = new MailingList();
        ml.setTitle(mailingListTitle);
        ml.setPublicList(allowPublicToSubscribe);
        ml.setUserId(user.getUserId());
        HibernateUtil.saveOrUpdate(ml);
       
        addToMailingList(pageIdentifier, startDate, endDate, ml.getInode());
       
        return ml.getMap();
       
    }
View Full Code Here

    public Map<String, Object> addToMailingList(String pageIdentifier, Date startDate, Date endDate, String mailingListInode) throws Exception {
       
      UserWebAPI userWebAPI = WebAPILocator.getUserWebAPI();
        WebContext ctx = WebContextFactory.get();
        User user = userWebAPI.getLoggedInUser(ctx.getHttpServletRequest());
      MailingList ml = (MailingList) InodeFactory.getInode(mailingListInode, MailingList.class);
     
        //Adding subscribers
        HTMLPage htmlPage = APILocator.getHTMLPageAPI().loadWorkingPageById(pageIdentifier, user, false);
        List<Map<String, String>> users = retrieveUsers(htmlPage, startDate, endDate, user);
        for (Map<String, String> userCounts : users) {
            if (userCounts.get("user_id") != null) {
                String userId = (String) userCounts.get("user_id");
                User webUser = APILocator.getUserAPI().loadUserById(userId,APILocator.getUserAPI().getSystemUser(),false);
                UserProxy s = com.dotmarketing.business.APILocator.getUserProxyAPI().getUserProxy(webUser,APILocator.getUserAPI().getSystemUser(), false);
                MailingListFactory.addMailingSubscriber(ml, s, false);
            }
        }
       
        return ml.getMap();

    }
View Full Code Here

    public Map<String, Object> removeFromMailingList(String pageIdentifier, Date startDate, Date endDate, String mailingListInode) throws Exception {

      UserWebAPI userWebAPI = WebAPILocator.getUserWebAPI();
        WebContext ctx = WebContextFactory.get();
        User user = userWebAPI.getLoggedInUser(ctx.getHttpServletRequest());
      MailingList ml = (MailingList) InodeFactory.getInode(mailingListInode, MailingList.class);

        //Removing subscribers
        HTMLPage htmlPage = APILocator.getHTMLPageAPI().loadWorkingPageById(pageIdentifier, user, false);
        List<Map<String, String>> users = retrieveUsers(htmlPage, startDate, endDate, user);
        for (Map<String, String> userCounts : users) {
            if (userCounts.get("user_id") != null) {
                String userId = (String) userCounts.get("user_id");
                User webUser = APILocator.getUserAPI().loadUserById(userId,APILocator.getUserAPI().getSystemUser(),false);
                UserProxy s = com.dotmarketing.business.APILocator.getUserProxyAPI().getUserProxy(webUser,APILocator.getUserAPI().getSystemUser(), false);
                if (InodeUtils.isSet(s.getInode())) {
                  MailingListFactory.deleteUserFromMailingList(ml, s);
                }
            }
        }

        return ml.getMap();
       
    }
View Full Code Here

TOP

Related Classes of com.dotmarketing.portlets.mailinglists.model.MailingList

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.