List of usage examples for javax.el Expression getExpressionString
public abstract String getExpressionString();
From source file:org.rhq.core.gui.model.PagedDataModel.java
/** * Convert RichFaces SortField2s to RHQ OrderingFields. * * @param sortFields the SortField2s to be converted * * @return the equivalent RHQ OrderingFields */// w ww.ja va 2s. c o m private List<OrderingField> toOrderingFields(List<SortField2> sortFields) { if (sortFields == null) { sortFields = Collections.emptyList(); } List<OrderingField> orderingFields = new ArrayList<OrderingField>(sortFields.size()); for (SortField2 sortField : sortFields) { Expression expression = sortField.getExpression(); String expressionString = expression.getExpressionString(); String field; if (expression.isLiteralText()) { field = expressionString; } else { field = expressionString.replaceAll("[#|$]\\{", "").replaceAll("\\}", ""); } Ordering ordering = sortField.getOrdering(); PageOrdering pageOrdering = (ordering == Ordering.ASCENDING) ? PageOrdering.ASC : PageOrdering.DESC; OrderingField orderingField = new OrderingField(field, pageOrdering); orderingFields.add(orderingField); } return orderingFields; }