1
|
/**
|
2
|
*
|
3
|
*/
|
4
|
package eu.etaxonomy.cdm.io.markup;
|
5
|
|
6
|
import java.util.ArrayList;
|
7
|
import java.util.List;
|
8
|
import java.util.UUID;
|
9
|
|
10
|
import org.apache.commons.lang.StringUtils;
|
11
|
|
12
|
import eu.etaxonomy.cdm.model.description.Feature;
|
13
|
|
14
|
/**
|
15
|
* This class is meant to hold all information about a feature that is needed by the {@link FeatureSorter} class.
|
16
|
* @author a.mueller
|
17
|
*
|
18
|
*/
|
19
|
public class FeatureSorterInfo {
|
20
|
|
21
|
private UUID uuid;
|
22
|
private String title;
|
23
|
private List<FeatureSorterInfo> subFeatures = new ArrayList<FeatureSorterInfo>();
|
24
|
|
25
|
public FeatureSorterInfo(Feature feature){
|
26
|
this.setUuid(feature.getUuid());
|
27
|
}
|
28
|
|
29
|
public FeatureSorterInfo(UUID uuid){
|
30
|
this.setUuid(uuid);
|
31
|
}
|
32
|
|
33
|
|
34
|
public UUID getUuid() {
|
35
|
return uuid;
|
36
|
}
|
37
|
|
38
|
private void setUuid(UUID uuid) {
|
39
|
this.uuid = uuid;
|
40
|
}
|
41
|
|
42
|
public List<FeatureSorterInfo> getSubFeatures() {
|
43
|
return subFeatures;
|
44
|
}
|
45
|
|
46
|
public void addSubFeature(FeatureSorterInfo subFeature){
|
47
|
subFeatures.add(subFeature);
|
48
|
}
|
49
|
|
50
|
@Override
|
51
|
public String toString(){
|
52
|
if (StringUtils.isNotBlank(title)){
|
53
|
return title;
|
54
|
}else if (uuid != null){
|
55
|
return uuid.toString();
|
56
|
}else{
|
57
|
return super.toString();
|
58
|
}
|
59
|
}
|
60
|
|
61
|
|
62
|
}
|