Revision 43987 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/feature/FeatureQueryOrder.java
FeatureQueryOrder.java | ||
---|---|---|
27 | 27 |
import java.util.Iterator; |
28 | 28 |
import java.util.List; |
29 | 29 |
import java.util.NoSuchElementException; |
30 |
import org.apache.commons.lang3.StringUtils; |
|
30 | 31 |
|
31 | 32 |
import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException; |
32 | 33 |
import org.gvsig.tools.evaluator.Evaluator; |
... | ... | |
103 | 104 |
public FeatureQueryOrder() { |
104 | 105 |
} |
105 | 106 |
|
107 |
public Object add(String order) { |
|
108 |
if( StringUtils.isEmpty(order) ) { |
|
109 |
return null; |
|
110 |
} |
|
111 |
Object r = null; |
|
112 |
String[] attributes = StringUtils.split(order, ','); |
|
113 |
for (String attribute : attributes) { |
|
114 |
boolean ascending = true; |
|
115 |
if( attribute.startsWith("+") ) { |
|
116 |
ascending = true; |
|
117 |
attribute = attribute.substring(1); |
|
118 |
} else if( attribute.startsWith("-") ) { |
|
119 |
ascending = false; |
|
120 |
attribute = attribute.substring(1); |
|
121 |
} |
|
122 |
attribute = attribute.trim(); |
|
123 |
r = this.add(attribute,ascending); |
|
124 |
} |
|
125 |
return r; |
|
126 |
} |
|
127 |
|
|
106 | 128 |
public Object add(String attributeName, boolean ascending) { |
107 | 129 |
FeatureQueryOrderMember member = new FeatureQueryOrderMember( |
108 | 130 |
attributeName, ascending); |
Also available in: Unified diff