Package com.agiletec.plugins.jpwtt.aps.system.services.ticket.alerter.mail.model

Examples of com.agiletec.plugins.jpwtt.aps.system.services.ticket.alerter.mail.model.WttMailConfig


   * @param xml The xml containing the configuration.
   * @return The wtt configuration.
   * @throws ApsSystemException In case of parsing errors.
   */
  public WttMailConfig extractConfig(String xml) throws ApsSystemException {
    WttMailConfig config = new WttMailConfig();
    Element root = this.getRootElement(xml);
    this.extractMailConfig(root, config);
    return config;
  }
View Full Code Here


      this.sendMailToAddresses(addresses, adminTemplate, params);
    }
  }
 
  private void sendMailToUser(String eMail, String template, Map<String, String> params) throws ApsSystemException {
    WttMailConfig mailConfig = this.getConfig();
    if (eMail!=null) {
      String text = this.prepareBody(template, params);
      String[] addresses = { eMail };
      this.getMailManager().sendMail(text, mailConfig.getSubject(), addresses, null, null, mailConfig.getSenderCode());
    }
  }
View Full Code Here

    }
  }
 
  private void sendMailToAddresses(String[] addresses, String template, Map<String, String> params) throws ApsSystemException {
    if (addresses!=null && addresses.length>0) {
      WttMailConfig config = this.getConfig();
      String text = this.prepareBody(template, params);
      String subject = config.getSubject();
      String senderCode = config.getSenderCode();
      if (config.isUniqueMail()) {
        this.getMailManager().sendMail(text, subject, addresses, null, null, senderCode);
      } else {
        for (String eMail : addresses) {
          this.getMailManager().sendMail(text, subject, new String[] { eMail }, null, null, senderCode);
        }
View Full Code Here

      }
    }
  }
 
  private String[] extractAdminMailAddresses(Ticket ticket) throws ApsSystemException {
    WttMailConfig config = this.getConfig();
    List<String> commonAddresses = config.getCommonAdminAddresses();
    List<String> intervTypeAddresses = config.getIntervTypesAdminAddresses().get(ticket.getUserInterventionType());
    /*
    String mailAttrName = config.getMailAttrName();
    Collection<String> usernames = this.extractUsersForPermission(JpWttSystemConstants.WTT_ADMIN_PERMISSION);
    int size = usernames.size() + commonAddresses.size();
    //*/
 
View Full Code Here

    //*/
    return (String[]) mailAddresses.toArray(new String[mailAddresses.size()]);
  }
 
  private String[] extractAllOperatorsMailAddresses(Ticket ticket) throws ApsSystemException {
    WttMailConfig config = this.getConfig();
    List<String> commonAddresses = config.getCommonOperatorAddresses();
    List<String> intervTypeAddresses = config.getIntervTypesOperatorAddresses().get(ticket.getUserInterventionType());
    /*
    String mailAttrName = config.getMailAttrName();
//    Collection<String> usernames = this.extractUsersForPermission(JpWttSystemConstants.WTT_OPERATOR_PERMISSION);
    int size = usernames.size() + commonAddresses.size();
    //*/
 
View Full Code Here

    this.init();
  }

  public void testReadConfig() throws Throwable {
    String xml = this._configManager.getConfigItem("jpwttMailConfig");
    WttMailConfig config = new WttMailConfigDOM().extractConfig(xml);

    assertEquals(true, config.isUniqueMail());
    assertEquals("CODE1", config.getSenderCode());
    assertEquals("email", config.getMailAttrName());
    assertEquals("Wtt Alert", config.getSubject());

    Map<Integer, MailTemplate> templates = config.getTemplates();
    assertEquals(6, templates.size());
    MailTemplate mailTemplate = templates.get(new Integer(5));
    Map<String, String> bodies = mailTemplate.getTemplateBodies();
    assertEquals("Op3: Testo della mail admin", bodies.get(MailTemplate.TEMPLATE_TYPE_ADMIN));
    assertEquals("Op3: Testo della mail user", bodies.get(MailTemplate.TEMPLATE_TYPE_USER));
    assertEquals("Op3: Testo della mail allOperators", bodies.get(MailTemplate.TEMPLATE_TYPE_ALLOPERATORS));

    List<String> adminAddresses = config.getCommonAdminAddresses();
    assertEquals(2, adminAddresses.size());
    List<String> operatorAddresses = config.getCommonOperatorAddresses();
    assertEquals(1, operatorAddresses.size());

    Map<Integer, List<String>> intervTypesAdminAddresses = config.getIntervTypesAdminAddresses();
    assertEquals(1, intervTypesAdminAddresses.size());
    adminAddresses = intervTypesAdminAddresses.get(1);
    assertEquals(2, adminAddresses.size());

    Map<Integer, List<String>> intervTypesOperatorAddresses = config.getIntervTypesOperatorAddresses();
    assertEquals(1, intervTypesOperatorAddresses.size());
    operatorAddresses = intervTypesOperatorAddresses.get(1);
    assertEquals(3, operatorAddresses.size());
  }
View Full Code Here

TOP

Related Classes of com.agiletec.plugins.jpwtt.aps.system.services.ticket.alerter.mail.model.WttMailConfig

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.