public static SearchResult getDatesFromRule(Rule rule, SearchResult searchResult) {
if (Objects.nonNull(rule.getWhen()) && !rule.getWhen().getBundles().isEmpty()) {
for (CriteriaBundle criteriaBundle : rule.getWhen().getBundles()) {
if (criteriaBundle.getDescription().equals(WAYBILL_DATE_FACT_PROP)) {
criteriaBundle.getCriterias().forEach(criteria -> {
if (criteria.getOperator().equals(Operator.GE)) {
searchResult.setEffectiveDate(RulesUtil.formatDate(criteria.getValue(), RCConstants.DEFAULT_DATE_FORMAT,
RCConstants.UI_DATE_FORMAT));
} else if (criteria.getOperator().equals(Operator.LE)) {
searchResult.setExpirationDate(RulesUtil.formatDate(criteria.getValue(),
RCConstants.DEFAULT_DATE_FORMAT, RCConstants.UI_DATE_FORMAT));
}
});
break;
}
}
}
return searchResult;
}