Determine Rules triggered by endeca

自作多情 提交于 2019-12-25 05:03:28

问题


We have various endeca rules set up through Rules Manager in our application which are triggered while rendering the page.

Is it possible to determine which rule was triggered for a page through Java/JSP code?


回答1:


The proper way to do this is with the Content Assembler API (endeca_content.jar). You need to create a content query and retrive the content object:

ContentItem content = results.getContent();
content.getName();

It is also possible to use the navigation API, using the SupplementList object from the navigation object: The title key will represent the name of the rule triggered. However, is you are using page builder in any meaningful way the proper approach is to use the Content Assemble API.

SupplementList sl = nav.getSupplements();
for (Object object : sl) {
   Supplement s = (Supplement) object;
   PropertyMap map = s.getProperties();
   Set keys = map.keySet();
   for (Object key : keys) {
    logger.info("Sup prop: " + key + " \t" + map.get(key));
   }
}


来源:https://stackoverflow.com/questions/10540636/determine-rules-triggered-by-endeca

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!