use of com.agiletec.apsadmin.system.plugin.HookPointElementContainer in project entando-core by entando.
the class HookPointTag method extractElements.
private List<HookPointElementContainer> extractElements(HttpServletRequest request) {
WebApplicationContext wac = ApsWebApplicationUtils.getWebApplicationContext(request);
String[] beanNames = wac.getBeanNamesForType(HookPointElementContainer.class);
List<HookPointElementContainer> containers = new ArrayList<HookPointElementContainer>();
for (int i = 0; i < beanNames.length; i++) {
HookPointElementContainer container = (HookPointElementContainer) wac.getBean(beanNames[i]);
if (null != container && null != container.getHookPointKey() && container.getHookPointKey().equals(this.getKey())) {
containers.add(container);
}
}
BeanComparator comparator = new BeanComparator("priority");
Collections.sort(containers, comparator);
return containers;
}
use of com.agiletec.apsadmin.system.plugin.HookPointElementContainer in project entando-core by entando.
the class HookPointTag method doStartTag.
@Override
public int doStartTag() throws JspException {
HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
ValueStack stack = this.getStack();
try {
List<HookPointElementContainer> containers = extractElements(request);
if (containers.size() > 0) {
stack.getContext().put(this.getObjectName(), containers);
stack.setValue("#attr['" + this.getObjectName() + "']", containers, false);
return EVAL_BODY_INCLUDE;
}
} catch (Throwable t) {
throw new JspException("Error detected ", t);
}
return super.doStartTag();
}
Aggregations