示例#1
0
  @Inject
  public ActivationKeyRules(JsRunner jsRules, I18n i18n) {
    this.jsRules = jsRules;
    this.i18n = i18n;

    mapper = RulesObjectMapper.instance();
    jsRules.init("activation_key_name_space");
  }
示例#2
0
  public ValidationResult runPreActKey(ActivationKey key, Pool pool, Long quantity) {
    JsonJsContext args = new JsonJsContext(mapper);
    args.put("key", key);
    args.put("pool", pool);
    args.put("quantity", quantity);
    args.put("log", log, false);

    String json = jsRules.invokeRule("validate_pool", args);
    ValidationResult result = mapper.toObject(json, ValidationResult.class);
    return result;
  }