Package at.molindo.notify.render.IRenderService

Examples of at.molindo.notify.render.IRenderService.RenderException


    try {
      StringWriter writer = new StringWriter();
      template.merge(new VelocityContext(params.newMap()), writer);
      return writer.toString();
    } catch (ResourceNotFoundException e) {
      throw new RenderException("failed to render template " + template, e);
    } catch (ParseErrorException e) {
      throw new RenderException("failed to render template " + template, e);
    } catch (MethodInvocationException e) {
      throw new RenderException("failed to render template " + template, e);
    } catch (IOException e) {
      throw new RenderException("failed to render template " + template, e);
    }
  }
View Full Code Here


      vt.setData(runtime.parse(new StringReader(content), templateName));
      vt.initDocument();
      return vt;

    } catch (ParseException e) {
      throw new RenderException("failed to parse template", e);
    }
  }
View Full Code Here

    for (IParamsFactory factory : _paramsFactories) {
      try {
        factory.params(params);
      } catch (NotifyException e) {
        throw new RenderException("params unavailable", e);
      }
    }

    String key = notification.getKey();
    Version version = cPrefs.getVersion();
View Full Code Here

    try {
      StringWriter writer = new StringWriter();
      template.merge(new VelocityContext(params.newMap(), nestedContext), writer);
      return writer.toString();
    } catch (ResourceNotFoundException e) {
      throw new RenderException("failed to render template " + template, e);
    } catch (ParseErrorException e) {
      throw new RenderException("failed to render template " + template, e);
    } catch (MethodInvocationException e) {
      throw new RenderException("failed to render template " + template, e);
    }
  }
View Full Code Here

      vt.setData(runtime.parse(new StringReader(content), templateName));
      vt.initDocument();
      return vt;

    } catch (ParseException e) {
      throw new RenderException("failed to parse template", e);
    }
  }
View Full Code Here

        if (StringUtils.empty(StringUtils.trim(line))) {
          body = new StringBuilder();
        } else {
          int split = line.indexOf(':');
          if (split < 0) {
            throw new RenderException("illegal line: " + line);
          }
          String fieldName = line.substring(0, split).trim();
          String fieldValue = line.substring(split + 1).trim();

          if (!SUPPORTED_FIELDS.contains(fieldName)) {
            throw new RenderException("unknown field: " + fieldName);
          }

          fieldValues.put(fieldName, fieldValue);
        }
      } else if (body.length() > 0 || !StringUtils.empty(StringUtils.trim(line))) {
        body.append(line).append("\n");
      }
    }

    required.removeAll(fieldValues.keySet());
    if (required.size() > 0) {
      throw new RenderException("missing fields: " + required);
    }

    if (body == null || body.length() == 0) {
      throw new RenderException("empty body");
    }
    // remove trailing \n
    body.setLength(body.length() - 1);

    rendered.setSubject(fieldValues.get(FIELD_SUBJECT));
View Full Code Here

    try {
      StringWriter writer = new StringWriter();
      template.merge(new VelocityContext(params.newMap(), nestedContext), writer);
      return writer.toString();
    } catch (ResourceNotFoundException e) {
      throw new RenderException("failed to render template " + template, e);
    } catch (ParseErrorException e) {
      throw new RenderException("failed to render template " + template, e);
    } catch (MethodInvocationException e) {
      throw new RenderException("failed to render template " + template, e);
    } catch (IOException e) {
      throw new RenderException("failed to render template " + template, e);
    }
  }
View Full Code Here

      vt.setData(runtime.parse(new StringReader(content), templateName));
      vt.initDocument();
      return vt;

    } catch (ParseException e) {
      throw new RenderException("failed to parse template", e);
    }
  }
View Full Code Here

TOP

Related Classes of at.molindo.notify.render.IRenderService.RenderException

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.