Revision 44262 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/DefaultFeatureType.java
DefaultFeatureType.java | ||
---|---|---|
27 | 27 |
import java.util.ArrayList; |
28 | 28 |
import java.util.Arrays; |
29 | 29 |
import java.util.Collections; |
30 |
import java.util.Comparator; |
|
30 | 31 |
import java.util.HashSet; |
31 | 32 |
import java.util.Iterator; |
32 | 33 |
import java.util.LinkedHashSet; |
33 | 34 |
import java.util.List; |
34 | 35 |
import java.util.Set; |
35 |
import java.util.logging.Level; |
|
36 |
import java.util.logging.Logger; |
|
36 |
import java.util.function.Predicate; |
|
37 | 37 |
import java.util.zip.CRC32; |
38 | 38 |
import org.apache.commons.lang3.ArrayUtils; |
39 | 39 |
import org.apache.commons.lang3.StringUtils; |
... | ... | |
65 | 65 |
import org.gvsig.tools.persistence.Persistent; |
66 | 66 |
import org.gvsig.tools.persistence.PersistentState; |
67 | 67 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
68 |
import org.gvsig.tools.util.ChainedIterator; |
|
68 | 69 |
|
69 | 70 |
public class DefaultFeatureType |
70 | 71 |
extends ArrayList<FeatureAttributeDescriptor> |
... | ... | |
80 | 81 |
*/ |
81 | 82 |
private static final long serialVersionUID = -7988721447349282215L; |
82 | 83 |
|
84 |
public static final RecentUsedsAttributesImpl RECENTS_USEDS = new RecentUsedsAttributesImpl(); |
|
85 |
|
|
83 | 86 |
private DefaultFeatureRules rules; |
84 | 87 |
protected boolean hasEvaluators; |
85 | 88 |
protected boolean hasEmulators; |
... | ... | |
938 | 941 |
} |
939 | 942 |
|
940 | 943 |
@Override |
944 |
public List<FeatureAttributeDescriptor> getFilteredAttributes( |
|
945 |
Predicate<FeatureAttributeDescriptor> filter, |
|
946 |
int max |
|
947 |
) { |
|
948 |
List<FeatureAttributeDescriptor> attrs = new ArrayList<>(); |
|
949 |
for (FeatureAttributeDescriptor attribute : this) { |
|
950 |
if (filter.test(attribute)) { |
|
951 |
attrs.add(attribute); |
|
952 |
} |
|
953 |
} |
|
954 |
return attrs; |
|
955 |
} |
|
956 |
|
|
957 |
@Override |
|
958 |
public List<FeatureAttributeDescriptor> getRecentUseds() { |
|
959 |
return RECENTS_USEDS.getAttributes(this); |
|
960 |
} |
|
961 |
|
|
962 |
@Override |
|
941 | 963 |
public void loadFromState(PersistentState state) |
942 | 964 |
throws PersistenceException { |
943 | 965 |
|
... | ... | |
954 | 976 |
|
955 | 977 |
requiredFields = state.getBoolean("requiredFields"); |
956 | 978 |
internalID = state.getString("internalID"); |
979 |
tags = (Tags) state.get("tags"); |
|
980 |
if( tags == null ) { |
|
981 |
this.tags = new DefaultTags(); |
|
982 |
} |
|
957 | 983 |
|
958 | 984 |
List<FeatureAttributeDescriptor> elements = state.getList("elements"); |
959 | 985 |
for (FeatureAttributeDescriptor element : elements) { |
... | ... | |
984 | 1010 |
List<FeatureAttributeDescriptor> elements = new ArrayList<>(); |
985 | 1011 |
elements.addAll(this); |
986 | 1012 |
state.set("elements", elements); |
1013 |
state.set("tags", tags); |
|
987 | 1014 |
|
988 | 1015 |
} |
989 | 1016 |
|
... | ... | |
1017 | 1044 |
|
1018 | 1045 |
definition.addDynFieldList("elements") |
1019 | 1046 |
.setClassOfItems(FeatureAttributeDescriptor.class); |
1047 |
|
|
1048 |
definition.addDynFieldObject("tags") |
|
1049 |
.setClassOfValue(Tags.class); |
|
1050 |
|
|
1020 | 1051 |
} |
1021 | 1052 |
} |
1022 | 1053 |
|
Also available in: Unified diff