use of org.jaffa.rules.rulemeta.AuditRuleHelper in project jaffa-framework by jaffa-projects.
the class MetaDataAuditIntrospector method findPropertyRuleMap.
/**
* Returns a Map of propertyName and first applicable rule for the className/ruleName combination.
*/
private Map<String, RuleMetaData> findPropertyRuleMap(String className, Object obj, String ruleName) {
try {
Map<String, List<RuleMetaData>> ruleMap = MetaDataRepository.instance().getPropertyRuleMap(className, ruleName);
if (ruleMap != null) {
Map<String, RuleMetaData> output = new LinkedHashMap<String, RuleMetaData>();
IRuleHelper ruleHelper = new AuditRuleHelper();
for (Map.Entry<String, List<RuleMetaData>> me : ruleMap.entrySet()) {
List<RuleMetaData> applicableRules = ruleHelper.getApplicableRules(className, obj, me.getValue(), false);
if (applicableRules != null && applicableRules.size() > 0)
output.put(me.getKey(), applicableRules.get(0));
}
return output;
}
} catch (Exception e) {
// do nothing
if (log.isDebugEnabled())
log.debug("Error in finding the applicable rules of type " + ruleName, e);
}
return null;
}
Aggregations