/[schmitzm]/trunk/src/skrueger/geotools/AttributeMetadataMap.java
ViewVC logotype

Annotation of /trunk/src/skrueger/geotools/AttributeMetadataMap.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 464 - (hide annotations)
Tue Oct 13 13:22:31 2009 UTC (15 years, 4 months ago) by alfonx
Original Path: branches/1.0-gt2-2.6/src/skrueger/geotools/AttributeMetadataMap.java
File MIME type: text/plain
File size: 1526 byte(s)
* Changed AttributeMetadata and AttributeMetadataMap. It's not based on the attributes colIdx any more, but on the geotools.feature.type.Name. All the XML read/write methods have been adapted. 
This change was needed, as some users tend to change the DBF structure after the shapefile has been imported. Now columns can be moved, inserted and deleted. Just click "reload atlas" in Geopublisher after you changed the table schema. Geopublisher doesn't have to be closed.
1 alfonx 420 package skrueger.geotools;
2    
3 alfonx 464 import java.util.ArrayList;
4     import java.util.List;
5     import java.util.SortedMap;
6 alfonx 420 import java.util.TreeMap;
7    
8 alfonx 464 import org.geotools.feature.NameImpl;
9     import org.opengis.feature.type.Name;
10 alfonx 420
11 alfonx 464 import skrueger.AttributeMetadata;
12    
13 alfonx 420 /**
14 alfonx 464 * An extension of TreeMap, that is copyable in the sense of the {@link Copyable} interface
15 alfonx 420 */
16 alfonx 464 public class AttributeMetadataMap extends TreeMap<Name, AttributeMetadata>
17 alfonx 420 implements Copyable<AttributeMetadataMap> {
18    
19 alfonx 464 /**
20     * @Deprecated use get(Name name) or get(String localName)
21     */
22     @Deprecated
23     public AttributeMetadata get(Object key) {
24     return super.get(key);
25 alfonx 420 }
26    
27 alfonx 464 public AttributeMetadata get(Name name) {
28     final AttributeMetadata attributeMetadata = super.get(name);
29     if (attributeMetadata == null) {
30     put(name,new AttributeMetadata(name));
31     return super.get(name);
32     }
33     return attributeMetadata;
34     }
35    
36     public AttributeMetadata get(String localName) {
37     return this.get(new NameImpl(localName));
38     }
39    
40 alfonx 420 @Override
41     public AttributeMetadataMap copyTo(AttributeMetadataMap amdMap) {
42    
43     amdMap.clear();
44    
45 alfonx 464 for (Name key : keySet()) {
46     AttributeMetadata attributeMetaData = get(key);
47 alfonx 420 amdMap.put(key, attributeMetaData.copy());
48     }
49     return amdMap;
50     }
51    
52     @Override
53     public AttributeMetadataMap copy() {
54     AttributeMetadataMap copy = new AttributeMetadataMap();
55     return copyTo(copy);
56     }
57 alfonx 464
58     public List<AttributeMetadata> sortedValues() {
59     ArrayList<AttributeMetadata> list = new ArrayList<AttributeMetadata>();
60     list.addAll(values());
61     return list;
62     }
63 alfonx 420 }

Properties

Name Value
svn:eol-style native
svn:keywords Id URL
svn:mime-type text/plain

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26