Revision 44349
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeatureAttributeDescriptor.java | ||
---|---|---|
26 | 26 |
import java.text.DateFormat; |
27 | 27 |
import java.util.HashMap; |
28 | 28 |
import java.util.Iterator; |
29 |
import java.util.LinkedHashMap; |
|
29 | 30 |
import java.util.List; |
30 | 31 |
import java.util.Map; |
31 | 32 |
import java.util.Map.Entry; |
... | ... | |
629 | 630 |
|
630 | 631 |
// FIXME: dateFormat; |
631 | 632 |
|
632 |
state.set("defaultValue", Objects.toString(defaultValue)); |
|
633 |
state.set("defaultValue", Objects.toString(defaultValue, null));
|
|
633 | 634 |
|
634 | 635 |
state.set("index", index); |
635 | 636 |
state.set("maximumOccurrences", maximumOccurrences); |
... | ... | |
798 | 799 |
if( values == null ) { |
799 | 800 |
return Objects.toString(value, ""); |
800 | 801 |
} |
801 |
Map<Object, String> map = new HashMap<>(); |
|
802 |
Map<Object, String> map = new LinkedHashMap<>();
|
|
802 | 803 |
for (DynObjectValueItem theValue : values) { |
803 | 804 |
map.put(theValue.getValue(), theValue.getLabel()); |
804 | 805 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/main/java/org/gvsig/fmap/dal/store/jdbc2/spi/operations/CalculateEnvelopeOfColumnOperation.java | ||
---|---|---|
86 | 86 |
) |
87 | 87 |
) |
88 | 88 |
); |
89 |
|
|
89 |
sqlbuilder.select().group_by(expbuilder.column(columnName)); |
|
90 | 90 |
sqlbuilder.select().from().table() |
91 | 91 |
.database(this.table.getDatabase()) |
92 | 92 |
.schema(this.table.getSchema()) |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.h2/src/main/java/org/gvsig/fmap/dal/store/h2/H2SpatialSQLBuilder.java | ||
---|---|---|
393 | 393 |
builder.append(" FROM "); |
394 | 394 |
builder.append(this.from.toString(formatter)); |
395 | 395 |
} |
396 |
if( this.has_group_by() ) { |
|
397 |
builder.append(" GROUP BY "); |
|
398 |
builder.append(this.groupColumn.get(0).name()); |
|
399 |
for (int i = 1; i < groupColumn.size(); i++) { |
|
400 |
builder.append(", "); |
|
401 |
builder.append(this.groupColumn.get(i).name()); |
|
402 |
} |
|
403 |
} |
|
396 | 404 |
if ( this.has_where() ) { |
397 | 405 |
builder.append(" WHERE "); |
398 | 406 |
builder.append(this.where.toString(formatter)); |
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/SQLBuilder.java | ||
---|---|---|
223 | 223 |
|
224 | 224 |
public OrderByBuilder order_by(); |
225 | 225 |
|
226 |
public SelectBuilder group_by(Variable... column); |
|
227 |
|
|
226 | 228 |
public SelectBuilder distinct(); |
227 | 229 |
|
228 | 230 |
public SelectBuilder limit(long limit); |
... | ... | |
248 | 250 |
|
249 | 251 |
public boolean has_order_by(); |
250 | 252 |
|
253 |
public boolean has_group_by(); |
|
254 |
|
|
251 | 255 |
public boolean has_limit(); |
252 | 256 |
|
253 | 257 |
public boolean has_offset(); |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.spi/src/main/java/org/gvsig/fmap/dal/feature/spi/SQLBuilderBase.java | ||
---|---|---|
775 | 775 |
protected List<SelectColumnBuilder> columns; |
776 | 776 |
protected List<OrderByBuilder> order_by; |
777 | 777 |
protected boolean distinct; |
778 |
protected List<Variable> groupColumn; |
|
778 | 779 |
|
779 | 780 |
public SelectBuilderBase() { |
780 | 781 |
this.columns = new ArrayList<>(); |
... | ... | |
782 | 783 |
} |
783 | 784 |
|
784 | 785 |
@Override |
786 |
public SelectBuilder group_by(Variable... columns) { |
|
787 |
if( this.groupColumn==null ) { |
|
788 |
this.groupColumn = new ArrayList<>(); |
|
789 |
} |
|
790 |
for (Variable column : columns) { |
|
791 |
this.groupColumn.add(column); |
|
792 |
} |
|
793 |
return this; |
|
794 |
} |
|
795 |
|
|
796 |
@Override |
|
785 | 797 |
public void accept(Visitor visitor, VisitorFilter filter) { |
786 | 798 |
if (filter.accept(this)) { |
787 | 799 |
visitor.visit(this); |
... | ... | |
903 | 915 |
} |
904 | 916 |
return !this.order_by.isEmpty(); |
905 | 917 |
} |
906 |
|
|
918 |
|
|
919 |
@Override |
|
920 |
public boolean has_group_by() { |
|
921 |
if (this.groupColumn == null) { |
|
922 |
return false; |
|
923 |
} |
|
924 |
return !this.groupColumn.isEmpty(); |
|
925 |
} |
|
926 |
|
|
907 | 927 |
protected boolean isValid(StringBuilder message) { |
908 | 928 |
if (message == null) { |
909 | 929 |
message = new StringBuilder(); |
... | ... | |
951 | 971 |
builder.append(" FROM "); |
952 | 972 |
builder.append(this.from.toString(formatter)); |
953 | 973 |
} |
974 |
if( this.has_group_by() ) { |
|
975 |
builder.append(" GROUP BY "); |
|
976 |
builder.append(this.groupColumn.get(0).name()); |
|
977 |
for (int i = 1; i < groupColumn.size(); i++) { |
|
978 |
builder.append(", "); |
|
979 |
builder.append(this.groupColumn.get(i).name()); |
|
980 |
} |
|
981 |
} |
|
954 | 982 |
if (this.has_where()) { |
955 | 983 |
builder.append(" WHERE "); |
956 | 984 |
builder.append(this.where.toString(formatter)); |
Also available in: Unified diff