1 10 package org.mmbase.bridge.jsp.taglib.containers; 11 12 import javax.servlet.jsp.JspTagException ; 13 14 import org.mmbase.bridge.Query; 15 import org.mmbase.bridge.util.Queries; 16 import org.mmbase.bridge.jsp.taglib.CloudReferrerTag; 17 import org.mmbase.bridge.jsp.taglib.util.Attribute; 18 import org.mmbase.storage.search.*; 19 21 28 public class QuerySortOrderTag extends CloudReferrerTag implements QueryContainerReferrer { 29 30 32 protected Attribute container = Attribute.NULL; 33 protected Attribute direction = Attribute.NULL; 34 protected Attribute field = Attribute.NULL; 35 protected Attribute casesensitive = Attribute.NULL; 36 37 public void setContainer(String c) throws JspTagException { 38 container = getAttribute(c); 39 } 40 41 public void setDirection(String d) throws JspTagException { 42 direction = getAttribute(d); 43 } 44 public void setCasesensitive(String s) throws JspTagException { 45 casesensitive = getAttribute(s); 46 } 47 public void setField(String f) throws JspTagException { 48 field = getAttribute(f); 49 } 50 51 52 public int doStartTag() throws JspTagException { 53 QueryContainer c = (QueryContainer) findParentTag(QueryContainer.class, (String ) container.getValue(this)); 54 55 Query query = c.getQuery(); 56 int order = Queries.getSortOrder(direction.getString(this)); 57 StepField stepField = query.createStepField(field.getString(this)); 58 59 query.addSortOrder(stepField, order, casesensitive.getBoolean(this, false)); 60 return SKIP_BODY; 61 } 62 63 } 64 | Popular Tags |