Package com.agiletec.plugins.jpnewsletter.aps.system.services.newsletter.model

Examples of com.agiletec.plugins.jpnewsletter.aps.system.services.newsletter.model.ContentReport


    return newsletterReport;
  }
 
  public ContentReport createContentReport(int id, int newsletterId,
      String contentId, String textBody, String htmlBody) {
    ContentReport contentReport = new ContentReport();
    contentReport.setId(id);
    contentReport.setContentId(contentId);
    contentReport.setTextBody(textBody);
    contentReport.setHtmlBody(htmlBody);
    return contentReport;
  }
View Full Code Here


  }
 
  public void testGetContentReport() throws Throwable {
    Date date = new Date();
    NewsletterReport newsletterReport1 = this._helper.createNewsletterReport(1, new Date(), "subject1");
    ContentReport contentReport1 = this._helper.createContentReport(1, newsletterReport1.getId(), "ART1", "textBody1", "htmlBody1");
    contentReport1.addRecipient("user1", "mail1@address.it");
    contentReport1.addRecipient("user2", "mail2@address.it");
    newsletterReport1.addContentReport(contentReport1);
    ContentReport contentReport2 = this._helper.createContentReport(2, newsletterReport1.getId(), "ART102", "textBody2", "htmlBody2");
    contentReport2.addRecipient("user1", "mail1@address.it");
    newsletterReport1.addContentReport(contentReport2);
    NewsletterReport newsletterReport2 = this._helper.createNewsletterReport(2, new Date(date.getTime()+100), "subject2");
    ContentReport contentReport3 = this._helper.createContentReport(3, newsletterReport2.getId(), "ART1", "textBody1", "htmlBody1");
    newsletterReport2.addContentReport(contentReport3);
    ContentReport contentReport4 = this._helper.createContentReport(4, newsletterReport2.getId(), "ART102", "textBody2", "htmlBody2");
    newsletterReport2.addContentReport(contentReport4);
    try {
      this._newsletterDAO.addNewsletterReport(newsletterReport1);
      NewsletterContentReportVO report1 = this._newsletterManager.getContentReport("ART1");
      this.compareContentReports(newsletterReport1, contentReport1, report1);
View Full Code Here

      searchBean.setInQueue(new Boolean(true));
      contentIds = this._newsletterManager.loadNewsletterContentIds(filters, userGroupCodes, searchBean);
      this.compareIds(contentIds, new String[] { "ART180" });
     
      NewsletterReport newsletterReport = this._helper.createNewsletterReport(1, new Date(), "subject");
      ContentReport contentReport = this._helper.createContentReport(1, newsletterReport.getId(),
          "ART180", "textBody1", "htmlBody1");
      newsletterReport.addContentReport(contentReport);
      this._newsletterDAO.addNewsletterReport(newsletterReport);
      searchBean.setSent(new Boolean(true));
      contentIds = this._newsletterManager.loadNewsletterContentIds(filters, userGroupCodes, searchBean);
View Full Code Here

  }
 
  public void testAddNewsletterReport() throws Throwable {
    Date date = new Date();
    NewsletterReport newsletterReport1 = this._helper.createNewsletterReport(1, new Date(), "subject");
    ContentReport contentReport1 = this._helper.createContentReport(1, newsletterReport1.getId(),
        "ART1", "textBody1", "htmlBody1");
    contentReport1.addRecipient("user1", "mail1@address.it");
    contentReport1.addRecipient("user2", "mail2@address.it");
    newsletterReport1.addContentReport(contentReport1);
    ContentReport contentReport2 = this._helper.createContentReport(2, newsletterReport1.getId(),
        "ART102", "textBody2", "htmlBody2");
    contentReport2.addRecipient("user1", "mail1@address.it");
    newsletterReport1.addContentReport(contentReport2);
   
    NewsletterReport newsletterReport2 = this._helper.createNewsletterReport(2, new Date(date.getTime()+100), "subject");
    ContentReport contentReport3 = this._helper.createContentReport(3, newsletterReport2.getId(),
        "ART1", "textBody1", "htmlBody1");
    newsletterReport2.addContentReport(contentReport3);
    ContentReport contentReport4 = this._helper.createContentReport(4, newsletterReport2.getId(),
        "ART102", "textBody2", "htmlBody2");
    newsletterReport2.addContentReport(contentReport4);
   
    try {
      this._newsletterDAO.addNewsletterReport(newsletterReport1);
View Full Code Here

    newsletterReport.setSendDate(new Date());
    String defaultLang = this.getLangManager().getDefaultLang().getCode();
    boolean alsoHtml = config.isAlsoHtml();
    for (Content content : contents) {
      boolean isConfiguredWithModels = false;
      ContentReport contentReport = new ContentReport();
      contentReport.setContentId(content.getId());
      String textBodyPart = this.prepareMailBodyContentPart(content, defaultLang, false);
      if (null != textBodyPart) {
        isConfiguredWithModels = true;
        contentReport.setTextBody(textBodyPart);
      }
      if (alsoHtml) {
        String htmlBodyPart = this.prepareMailBodyContentPart(content, defaultLang, true);
        contentReport.setHtmlBody(htmlBodyPart);
      }
      if (isConfiguredWithModels) {
        newsletterReport.addContentReport(contentReport);
      } else {
        ApsSystemUtils.getLogger().info(" Newsletter content " + content.getId() + " not added, because has not model in config.");
View Full Code Here

    NewsletterConfig config = this.getConfig();
    StringBuffer body = new StringBuffer(isHtml ? config.getHtmlHeader() : config.getTextHeader());
    String separator = isHtml ? config.getHtmlSeparator() : config.getTextSeparator();
    boolean first = true;
    for (Content content : userContents) {
      ContentReport contentReport = newsletterReport.getContentReport(content.getId());
      if (contentReport != null) {
        if (first) {
          first = false;
        } else {
          body.append(separator);
        }
        String text = isHtml ? contentReport.getHtmlBody() : contentReport.getTextBody();
        body.append(text);
      }
    }
    return body;
  }
View Full Code Here

      boolean isGroupAdmin = groupNames.contains(Group.ADMINS_GROUP_NAME);
      for (int i=0; i<contents.size(); i++) {
        Content content = contents.get(i);
        String contentId = content.getId();
        List<String> contentProfileAttributes = profileAttributes.get(contentId);
        ContentReport contentReport = newsletterReport.getContentReport(contentId);
        if (contentReport != null && (isGroupAdmin || this.checkUserAllowedOnContent(groupNames, content))) {
          if (allContents) {
            userContents.add(content);
            contentReport.addRecipient(username, eMail);
          } else if (contentProfileAttributes!=null && contentProfileAttributes.size() > 0) {
            for (String profileAttrName : contentProfileAttributes) {
              Boolean value = (Boolean) profile.getValue(profileAttrName);
              if (value != null && value.booleanValue()) {
                userContents.add(content);
                contentReport.addRecipient(username, eMail);
                break;
              }
            }
          }
        }
View Full Code Here

TOP

Related Classes of com.agiletec.plugins.jpnewsletter.aps.system.services.newsletter.model.ContentReport

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.