Package evolaris.framework.async.business

Examples of evolaris.framework.async.business.TemplateEngine


  public void checkAll() {
    checkProvided("sortLabel", "smssvc.labelMustBeProvided");
    check(blogId != null, "blogId", "smssvc.blogMustBeProvided");
   
    // Validate template-placeholders
    TemplateEngine templateEngine = new TemplateEngine();
    check(templateEngine.validateBlogTemplate(getTitle()), "title", "smssvc.illegalPlaceholdersFound");
    check(templateEngine.validateBlogTemplate(getContent()), "content", "smssvc.illegalPlaceholdersFound");
   
    Long minImageWidth = checkLong("maxImageWidth", "smssvc.invalidIntegerValue");
    if(minImageWidth != null){
      check(minImageWidth > 0, "maxImageWidth", "smssvc.invalidValue");
    }
View Full Code Here


  public void checkAll() {
    checkProvided("sortLabel", "smssvc.labelMustBeProvided");
   
    if (checkProvided("url","smssvc.validUrlRequired")){
      check((url.startsWith("http://") || url.startsWith("https://")) && url.length() >= 10,"url","smssvc.validUrlRequired");
      TemplateEngine templateEngine = new TemplateEngine();
      check(templateEngine.validateHttpTemplate(url), "url", "smssvc.illegalPlaceholdersFound");
    }
    checkProvided("nofEvaluatedResponseLetters", "smssvc.validNumberOfLettersRequired");
    checkInteger("nofEvaluatedResponseLetters", "smssvc.invalidIntegerValue");
    checkMinimumValue("nofEvaluatedResponseLetters",0,"smssvc.invalidValue");
  }
View Full Code Here

    }

    ActionErrors errors = super.validate(mapping, req);

    // Validate template-placeholders
    TemplateEngine templateEngine = new TemplateEngine();
    if (new Integer(3).equals(getDestinationSelection())){
      if (templateEngine.getPlaceholders(getMessage()).size() > 0) {  // message to explicitly provided e-mail address must not contain placeholders
        errors.add("message", new ActionMessage("smssvc.placeholdersNotAllowedHere"));
      }
      if (templateEngine.getPlaceholders(getSubject()).size() > 0) {  // same for the subject
        errors.add("subject", new ActionMessage("smssvc.placeholdersNotAllowedHere"));
      }
    } else if (!templateEngine.validateEmailTemplate(getMessage())) {
      errors.add("message", new ActionMessage("smssvc.illegalPlaceholdersFound"));
    } else if (!templateEngine.validateEmailTemplate(getSubject())) {
      errors.add("subject", new ActionMessage("smssvc.illegalPlaceholdersFound"));
    }
    return errors;
  }
View Full Code Here

    ActionErrors errors = super.validate(mapping, req);


    // Validate template-placeholders
    TemplateEngine templateEngine = new TemplateEngine();
    if (new Integer(3).equals(getDestinationSelection())
        && templateEngine.getPlaceholders(getMessage()).size() > 0) {  // message to isdn must not contain placeholders
      errors.add("message", new ActionMessage("smssvc.placeholdersNotAllowedHere"));
    } else if (!templateEngine.validateSmsTemplate(getMessage())) {
      errors.add("message", new ActionMessage("smssvc.illegalPlaceholdersFound"));
    } else if (templateEngine.computeMaxMessageLength(getMessage()) == Integer.MAX_VALUE) {
      errors.add("message", new ActionMessage("smssvc.missingPlaceholderLengths"));
    }
    return errors;
  }
View Full Code Here

  public ActionErrors validate(ActionMapping mapping, HttpServletRequest req) {
    ActionErrors errors = super.validate(mapping, req);
   
   
    // Validate template-placeholders
    TemplateEngine templateEngine = new TemplateEngine();
    List<String> allowedPlaceholders = new ArrayList<String>();
    allowedPlaceholders.addAll(TemplateEngine.VALID_SMS_MESSAGE_PLACEHOLDERS);
    allowedPlaceholders.addAll(TemplateEngine.VALID_REQUESTING_USER_PLACEHOLDERS);
    allowedPlaceholders.addAll(TemplateEngine.VALID_CONTACT_USER_PLACEHOLDERS);
    if (new Integer(6).equals(getDestinationSelection())) { // message to msisdn must not contain placeholders for (destination) user
      allowedPlaceholders.removeAll(TemplateEngine.VALID_SMS_MESSAGE_PLACEHOLDERS);
    }
    if (!templateEngine.validateTemplate(getMessage(), allowedPlaceholders)) {
      errors.add("message", new ActionMessage("smssvc.illegalPlaceholdersFound"));
    } else if (templateEngine.computeMaxMessageLength(getMessage()) == Integer.MAX_VALUE) {
      errors.add("message", new ActionMessage("smssvc.missingPlaceholderLengths"));
    } else if (templateEngine.computeMaxMessageLength(getMessage()) > SmsInteractionEnterOrEditAction.MAX_MESSAGE_TEXT_LENGTH) {
      errors.add("message", new ActionMessage("smssvc.messageLongerThan450characters"));     
    }
    return errors;
  }
View Full Code Here

          messageLength += 2;
        } else if (c != '\r'){
          messageLength++;
        }
      }
      TemplateEngine templateEngine = new TemplateEngine();
      int computedLength = templateEngine.computeMaxMessageLength(message);
      if (computedLength == Integer.MAX_VALUE) {
        return computedLength;
      } else {
        messageLength = computedLength + (messageLength - message.length());
      }
View Full Code Here

  public ActionErrors validate(ActionMapping mapping, HttpServletRequest req) {
    ActionErrors errors = super.validate(mapping, req);

    // Validate template-placeholders
    TemplateEngine templateEngine = new TemplateEngine();
    List<String> placeholders = new ArrayList<String>();
    placeholders.addAll(TemplateEngine.VALID_EMAIL_MESSAGE_PLACEHOLDERS);
    placeholders.addAll(TemplateEngine.VALID_REQUESTING_USER_PLACEHOLDERS);
    placeholders.addAll(TemplateEngine.VALID_CONTACT_USER_PLACEHOLDERS);

    if (new Integer(3).equals(getDestinationSelection())){ // message to explicitly provided e-mail address must not contain placeholders for (destination) user
      placeholders.removeAll(TemplateEngine.VALID_EMAIL_MESSAGE_PLACEHOLDERS);
    }
    if (!templateEngine.validateTemplate(getMessage(), placeholders)) {
      errors.add("message", new ActionMessage("smssvc.illegalPlaceholdersFound"));
    } else if (!templateEngine.validateTemplate(getSubject(), placeholders)) {
      errors.add("subject", new ActionMessage("smssvc.illegalPlaceholdersFound"));
    }
    return errors;
  }
View Full Code Here

TOP

Related Classes of evolaris.framework.async.business.TemplateEngine

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.