Пример #1
0
  /**
   * Execute method of the rule. This holds the rule conditions and actions. The required objects
   * are initialized through init() method. return - execution result of rule either SUCCESS or
   * FAILURE
   */
  public static RulesResult execute(RulesContext ctx, String ruleId) throws RIFPOJORulesException {

    // Construct rules result object
    RulesResult rulesResult = new RulesResult(ruleId);
    String recoveryReason = null;
    boolean result = false;
    Double recoveryAmount = 0d;

    if (ctx != null) {

      List<Object> inputObjs = ctx.getContextObject();

      recoveryReason = (String) inputObjs.get(0);
      if (recoveryReason == null) {
        if (LOG.isEnabledFor(Level.ERROR)) {
          LOG.error(
              "Input Object recoveryReason is  null during intialization for the rule " + ruleId);
        }
        throw new RIFPOJORulesException(
            "Unable to initialize the required rules objects for rule " + ruleId);
      }

      result = (Boolean) inputObjs.get(1);

      recoveryAmount = (Double) inputObjs.get(2);
      if (recoveryAmount == null) {
        if (LOG.isEnabledFor(Level.ERROR)) {
          LOG.error(
              "Input Object recoveryAmount is  null during intialization for the rule " + ruleId);
        }
        throw new RIFPOJORulesException(
            "Unable to initialize the required rules objects for rule " + ruleId);
      }

    } else {
      if (LOG.isEnabledFor(Level.ERROR)) {
        LOG.error("Input Context Object is null during intialization for the rule " + ruleId);
      }
      throw new RIFPOJORulesException(
          "Unable to initialize the required rules objects for rule " + ruleId);
    }
    if (LOG.isInfoEnabled()) {
      LOG.info("Executing the actions for the rule " + ruleId);
    }
    // EXTRACT_START TPL0717.0001.01
    if ('D' == recoveryReason.charAt(0)
        || 'S' == recoveryReason.charAt(0)
        || "R99".equalsIgnoreCase(recoveryReason)) {
      if (recoveryAmount != null && !(recoveryAmount.doubleValue() == 0)) {
        // Defect ESPRD00684744
        result = true;
      }
    }
    // EXTRACT_END

    rulesResult.setReturnBooleanValue(result);
    rulesResult.setRuleStatus(true);
    return rulesResult;
  }
Пример #2
0
  /**
   * Execute method of the rule. This holds the rule conditions and actions. The required objects
   * are initialized through init() method. return - execution result of rule either SUCCESS or
   * FAILURE
   */
  public static RulesResult execute(RulesContext ctx, String ruleId) throws RIFPOJORulesException {

    // Construct rules result object
    RulesResult rulesResult = new RulesResult(ruleId);
    String applicationNumber = null;
    boolean flag = false;

    ProviderEnrollmentDelegate providerEnrollmentDelegate = null;

    if (ctx != null) {

      List<Object> inputObjs = ctx.getContextObject();

      applicationNumber = (String) inputObjs.get(0);
      if (applicationNumber == null) {
        LOG.error(
            "Input Object recallProviderData is  null during intialization for the rule " + ruleId);
        throw new RIFPOJORulesException(
            "Unable to initialize the required rules objects for rule " + ruleId);
      }

      providerEnrollmentDelegate = (ProviderEnrollmentDelegate) inputObjs.get(1);
      if (providerEnrollmentDelegate == null) {
        LOG.error(
            "Input Object providerEnrollmentDelegate is  null during intialization for the rule "
                + ruleId);
        throw new RIFPOJORulesException(
            "Unable to initialize the required rules objects for rule " + ruleId);
      }

    } else {
      LOG.error("Input Context Object is null during intialization for the rule " + ruleId);
      throw new RIFPOJORulesException(
          "Unable to initialize the required rules objects for rule " + ruleId);
    }
    LOG.info("Executing the actions for the rule " + ruleId);

    try {
      flag = providerEnrollmentDelegate.getApplicationLockedDetail(applicationNumber);

      if (flag == false) {
        rulesResult.setReturnValue(ProviderDataConstants.PRV_ENR_FAILURE);
      }

      rulesResult.setRuleStatus(true);
    } catch (ApplicationLockedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return rulesResult;
  }
Пример #3
0
  /**
   * Execute method of the rule. This holds the rule conditions and actions. The required objects
   * are initialized through init() method. return - execution result of rule either SUCCESS or
   * FAILURE
   */
  public static RulesResult execute(RulesContext ctx, String ruleId) throws RIFPOJORulesException {

    // Construct rules result object
    RulesResult rulesResult = new RulesResult(ruleId);
    String value = null;
    List systemList = null;
    boolean checkRange = false;

    if (ctx != null) {

      List<Object> inputObjs = ctx.getContextObject();

      value = (String) inputObjs.get(0);
      if (value == null) {
        if (LOG.isEnabledFor(Level.ERROR)) {
          LOG.error("Input Object value is  null during intialization for the rule " + ruleId);
        }
        throw new RIFPOJORulesException(
            "Unable to initialize the required rules objects for rule " + ruleId);
      }

      systemList = (List) inputObjs.get(1);
      if (systemList == null) {
        if (LOG.isEnabledFor(Level.ERROR)) {
          LOG.error("Input Object systemList is  null during intialization for the rule " + ruleId);
        }
        throw new RIFPOJORulesException(
            "Unable to initialize the required rules objects for rule " + ruleId);
      }

    } else {
      if (LOG.isEnabledFor(Level.ERROR)) {
        LOG.error("Input Context Object is null during intialization for the rule " + ruleId);
      }
      throw new RIFPOJORulesException(
          "Unable to initialize the required rules objects for rule " + ruleId);
    }
    if (LOG.isInfoEnabled()) {
      LOG.info("Executing the actions for the rule " + ruleId);
    }
    // EXTRACT_START PGM4004.9005.NH01
    checkRange = systemList.contains(value);
    // EXTRACT_END
    rulesResult.setReturnBooleanValue(checkRange);
    rulesResult.setRuleStatus(true);
    return rulesResult;
  }