public int compareTo(Object obj) {
if (this == obj) return 0;
Section section = (Section) obj;
// Section path number cache, to avoid lots of getParent() in the same request...
RequestContext ctx = RequestContext.getCurrentContext();
if (ctx == null || ctx.getRequest() == null) {
return comparePathNumbers(getPathNumber(), section.getPathNumber());
}
Map sectionsCache = (Map) ctx.getRequest().getRequestObject().getAttribute("sectionsPathNumberCache");
if (sectionsCache == null)
ctx.getRequest().getRequestObject().setAttribute("sectionsPathNumberCache", sectionsCache = new HashMap());
List myPathNumber = (List) sectionsCache.get(this.getDbid());
if (myPathNumber == null) {
myPathNumber = getPathNumber();
sectionsCache.put(this.getDbid(), myPathNumber);