Examples of ZeusDateTool


Examples of com.taobao.zeus.util.ZeusDateTool

    while(matcher.find()){
       String m= template.substring(matcher.start(),matcher.end());
       StringWriter sw=new StringWriter();
       try {
        VelocityContext context=new VelocityContext();
        context.put("zdt", new ZeusDateTool());
        Velocity.evaluate(context, sw, "", m);
        if(m.equals(sw.toString())){
          //渲染后和原数据一样,则直接跳出,如果不跳出会导致死循环
          log.error("render fail with target:"+m);
          break;
        }
      } catch (Exception e) {
        log.error("zdt render error",e);
        break;//防止死循环
      }
       template=template.replace(m, sw.toString());
       matcher=pt.matcher(template);
    }
    //${yesterday}变量替换
    template=template.replace("${yesterday}",new ZeusDateTool().addDay(-1).format("yyyyMMdd"));
    return template;
  }
View Full Code Here

Examples of com.taobao.zeus.util.ZeusDateTool

  }
 
 
  public static void main(String[] args) throws Exception{
    VelocityContext context=new VelocityContext();
    context.put("zdt", new ZeusDateTool());
    String s="abc${zdt.addDay(-1).format(\"yyyyMMdd\")} ${zdt.addDay(1).format(\"yyyyMMdd\")}";
    Pattern pt = Pattern.compile("\\$\\{zdt.*\\}");
    Matcher matcher=pt.matcher(s);
    while(matcher.find()){
       String m= s.substring(matcher.start(),matcher.end());
View Full Code Here

Examples of com.taobao.zeus.util.ZeusDateTool

      if (ptIndex != 0) {
        log("表" + tableName + "的第一个分区字段不是pt。只支持第一个分区字段为pt的表。");
        exitCode = -1;
        continue;
      }
      String lastDay = new ZeusDateTool().addDay(-1).format("yyyyMMdd");

      // 获取最新分区
      Partition lastPartition = getLastPartition(parts, lastDay, ptIndex);
      if (lastPartition == null) {
        tableFailed("表" + tableName + "最新分区pt=" + lastDay + "不存在");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.