2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.app
.berlinModelImport
;
12 import java
.util
.HashMap
;
14 import java
.util
.UUID
;
16 import org
.apache
.log4j
.Logger
;
18 import eu
.etaxonomy
.cdm
.app
.berlinModelImport
.TreeCreator
;
19 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
20 import eu
.etaxonomy
.cdm
.model
.description
.FeatureNode
;
21 import eu
.etaxonomy
.cdm
.model
.description
.FeatureTree
;
28 public class TreeCreator
{
29 @SuppressWarnings("unused")
30 private static final Logger logger
= Logger
.getLogger(TreeCreator
.class);
32 public static FeatureTree
flatTree(UUID featureTreeUuid
, Map
<Integer
, Feature
> featureMap
, Object
[] featureKeyList
){
33 FeatureTree result
= FeatureTree
.NewInstance(featureTreeUuid
);
34 FeatureNode root
= result
.getRoot();
36 for (Object featureKey
: featureKeyList
){
37 Feature feature
= featureMap
.get(featureKey
);
39 FeatureNode child
= FeatureNode
.NewInstance(feature
);
50 public static void main(String
[] args
) {
51 Map
<Integer
, Feature
> map
= new HashMap
<Integer
, Feature
>(null);
52 map
.put(1, Feature
.DISTRIBUTION());
53 map
.put(2, Feature
.ECOLOGY());
55 Object
[] strFeatureList
= new Integer
[]{1,2};
57 FeatureTree tree
= TreeCreator
.flatTree(UUID
.randomUUID(), map
, strFeatureList
);
58 System
.out
.println(tree
.getRootChildren());