示例#1
0
  @Override
  protected Value calculate(MsgItem item, PackContext context) {
    MsgField field;

    // 如果v参数带有后缀 则取由后缀指定的节点
    if (context.param.postfix == null) field = (MsgField) item;
    else {
      field = item.SelectSingleField(context.param.postfix);
      if (field == null)
        throw new TESException(
            MsgErr.Pack.VTargetNull, "target: " + context.param.postfix + " item: " + item);
    }

    // 将域本身的属性添加到Processor的参数列表 Processor原有的参数的优先级为高
    for (String k : item.getAttributes().keySet())
      if (!context.processorParams.containsKey(k))
        context.processorParams.put(k, item.getAttribute(k).str);

    return new Value(field.value());
  }
示例#2
0
 public static Value md5(MsgItem item, PackContext context) throws NoSuchAlgorithmException {
   MessageDigest md = MessageDigest.getInstance("MD5");
   md.update(item.getAttribute(MsgContainerUtils.C_InternalDomElementPrefix + "m").bytes);
   return new Value(md.digest());
 }