endeca sample code

Posted by Eric Fordelon


Quick Tip:

Here’s a sample method of cleaning up a content item of common things you want to strip out from it.

What approaches have you taken in your projects?

/**
* Recursive method to cleanup content item of any “endeca:auditInfo: properties
* @param contentItem the content item
*/
public static void cleanupContentItem(ContentItem contentItem) {
if(logger.isDebugEnabled()){
logger.debug(“inside cleanupContentItem”);
}
if(contentItem==null){
return;
}
if(contentItem.containsKey(ENDECA_AUDIT_INFO)){
contentItem.remove(ENDECA_AUDIT_INFO);
}
Set keySet = contentItem.keySet();
if(keySet!=null && keySet.isEmpty()==false){
for(String key: keySet){
Object value = contentItem.get(key);
if(value instanceof ContentItem){
cleanupContentItem((ContentItem)value);
}
if(value instanceof List){
List

Need further strategic or technical help?