Write a Group Processor
A group processor is a Java class that can be used to process the contents of a template group: add content, filter content or modify it in some way. A group processor must
-
Implement
com.escenic.framework.processor.GroupProcessor
-
Override
com.escenic.framework.processor.GroupProcessor
'sprocess
method
The following example shows a group processor called MyDummyGroupProcessor
:
package com.mycompany.group.processor; import com.escenic.framework.processor.GroupProcessor; import neo.xredsys.presentation.PresentationElement; import javax.servlet.http.HttpServletRequest; import java.util.Map; public class MyDummyGroupProcessor implements GroupProcessor { protected static final String CUSTOM_ATTRIBUTE_NAME = "myProperty"; @Override public void process(final PresentationElement pGroup, final Map<String, Object> pGroupContext, final HttpServletRequest pRequest) { //TODO: Process result and put into the group context pGroupContext.put(CUSTOM_ATTRIBUTE_NAME, "Your processed result here"); } }
In this case, all MyDummyGroupProcessor
does is to create a dummy group property called myProperty
which can be accessed from JSP templates with the following expression:
${requestScope.group.myProperty}
Before a group processor can be used it must be compiled and added to the classpath. And you must have template-common-3.5.1.174428.jar
in your classpath.
Once you have written a group processor class, you need to:
-
Create a set of properties files to declare the group processor and register it in the system
-
Package everything in a JAR file
-
Deploy the JAR file in your publication