svn-gvsig-desktop / 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 / DefaultFeatureExtraColumn.java @ 44753
History | View | Annotate | Download (1.71 KB)
1 |
/*
|
---|---|
2 |
* To change this license header, choose License Headers in Project Properties.
|
3 |
* To change this template file, choose Tools | Templates
|
4 |
* and open the template in the editor.
|
5 |
*/
|
6 |
package org.gvsig.fmap.dal.feature.impl; |
7 |
|
8 |
import java.util.ArrayList; |
9 |
import java.util.List; |
10 |
import org.apache.commons.lang3.StringUtils; |
11 |
import org.gvsig.fmap.dal.DALLocator; |
12 |
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor; |
13 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
14 |
import org.gvsig.fmap.dal.feature.FeatureExtraColumn; |
15 |
|
16 |
/**
|
17 |
*
|
18 |
* @author osc
|
19 |
*/
|
20 |
public class DefaultFeatureExtraColumn implements FeatureExtraColumn { |
21 |
|
22 |
private List<EditableFeatureAttributeDescriptor> extraColumns; |
23 |
public DefaultFeatureExtraColumn() {
|
24 |
this.extraColumns = new ArrayList(); |
25 |
} |
26 |
@Override
|
27 |
public EditableFeatureAttributeDescriptor get(String columnName) { |
28 |
for (EditableFeatureAttributeDescriptor extraColumn : this.extraColumns) { |
29 |
if (StringUtils.equals(extraColumn.getName(), columnName)) {
|
30 |
return extraColumn;
|
31 |
} |
32 |
} |
33 |
return null; |
34 |
} |
35 |
|
36 |
@Override
|
37 |
public EditableFeatureAttributeDescriptor add(String name) { |
38 |
//TODO que no hayan dos columnas iguales
|
39 |
// exi.addExtraColumn()
|
40 |
EditableFeatureAttributeDescriptor newAttr = DALLocator.getDataManager().createFeatureAttributeDescriptor(); |
41 |
newAttr.setName(name); |
42 |
extraColumns.add(newAttr); |
43 |
return newAttr;
|
44 |
} |
45 |
|
46 |
@Override
|
47 |
public List<EditableFeatureAttributeDescriptor> getColumns() { |
48 |
return this.extraColumns; |
49 |
} |
50 |
|
51 |
@Override
|
52 |
public void merge(FeatureExtraColumn other) { |
53 |
this.extraColumns.addAll(other.getColumns());
|
54 |
} |
55 |
|
56 |
} |