Project

General

Profile

Revision 165e1209

ID165e1209ef6e4e543edde37fafb5736e611b741e
Parent dd49afb6
Child 54627755

Added by Andreas Müller 11 months ago

ref #6794 , ref #7099 adapt app-import, pesi, eflora to modelchanges

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/app/berlinModelImport/CaucasusEuroMedActivator.java
43 43
import eu.etaxonomy.cdm.io.common.IImportConfigurator.EDITOR;
44 44
import eu.etaxonomy.cdm.io.common.Source;
45 45
import eu.etaxonomy.cdm.model.agent.Person;
46
import eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl;
47
import eu.etaxonomy.cdm.model.common.Group;
48 46
import eu.etaxonomy.cdm.model.common.Language;
49
import eu.etaxonomy.cdm.model.common.User;
50 47
import eu.etaxonomy.cdm.model.description.Feature;
51 48
import eu.etaxonomy.cdm.model.location.NamedArea;
52 49
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
......
55 52
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
56 53
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
57 54
import eu.etaxonomy.cdm.model.name.Rank;
55
import eu.etaxonomy.cdm.model.permission.GrantedAuthorityImpl;
56
import eu.etaxonomy.cdm.model.permission.Group;
57
import eu.etaxonomy.cdm.model.permission.User;
58 58
import eu.etaxonomy.cdm.model.taxon.Taxon;
59 59
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
60 60
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
app-import/src/main/java/eu/etaxonomy/cdm/app/cyprus/CyprusActivator.java
130 130

  
131 131
		//user defined features
132 132
		String [] featureList = new String[]{"Red Book", "Endemism"};
133
		addFeataureNodesByStringList(featureList, root, transformer, service);
133
		addFeatureNodesByStringList(featureList, root, transformer, service);
134 134

  
135 135
		return result;
136 136
	}
......
159 159
		}
160 160
	}
161 161

  
162
	public void addFeataureNodesByStringList(String[] featureStringList, TermNode<Feature> root, IInputTransformer transformer, ITermService termService){
162
	public void addFeatureNodesByStringList(String[] featureStringList, TermNode<Feature> root, IInputTransformer transformer, ITermService termService){
163 163
		try {
164 164
			for (String featureString : featureStringList){
165 165
			UUID featureUuid;
app-import/src/main/java/eu/etaxonomy/cdm/app/globis/GlobisActivator.java
25 25
import eu.etaxonomy.cdm.io.common.IImportConfigurator.EDITOR;
26 26
import eu.etaxonomy.cdm.io.common.Source;
27 27
import eu.etaxonomy.cdm.io.globis.GlobisImportConfigurator;
28
import eu.etaxonomy.cdm.model.common.User;
29 28
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
30 29
import eu.etaxonomy.cdm.model.name.TaxonName;
30
import eu.etaxonomy.cdm.model.permission.User;
31 31
import eu.etaxonomy.cdm.model.reference.ISourceable;
32 32

  
33 33
/**
app-import/src/main/java/eu/etaxonomy/cdm/app/salvador/SalvadorActivator.java
28 28
import eu.etaxonomy.cdm.io.common.IImportConfigurator.DO_REFERENCES;
29 29
import eu.etaxonomy.cdm.io.common.ImportResult;
30 30
import eu.etaxonomy.cdm.io.common.Source;
31
import eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl;
32
import eu.etaxonomy.cdm.model.common.Group;
33
import eu.etaxonomy.cdm.model.common.User;
34 31
import eu.etaxonomy.cdm.model.name.INonViralName;
35 32
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
33
import eu.etaxonomy.cdm.model.permission.GrantedAuthorityImpl;
34
import eu.etaxonomy.cdm.model.permission.Group;
35
import eu.etaxonomy.cdm.model.permission.User;
36 36
import eu.etaxonomy.cdm.persistence.hibernate.permission.Role;
37 37

  
38 38

  
app-import/src/main/java/eu/etaxonomy/cdm/io/algaterra/AlgaTerraTypeImport.java
41 41
import eu.etaxonomy.cdm.model.common.CdmBase;
42 42
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
43 43
import eu.etaxonomy.cdm.model.common.Language;
44
import eu.etaxonomy.cdm.model.common.User;
45 44
import eu.etaxonomy.cdm.model.name.Rank;
46 45
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
47 46
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
......
51 50
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
52 51
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
53 52
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
53
import eu.etaxonomy.cdm.model.permission.User;
54 54
import eu.etaxonomy.cdm.model.reference.Reference;
55 55
import eu.etaxonomy.cdm.model.term.DefinedTerm;
56 56

  
app-import/src/main/java/eu/etaxonomy/cdm/io/berlinModel/in/BerlinModelImportBase.java
34 34
import eu.etaxonomy.cdm.model.common.Language;
35 35
import eu.etaxonomy.cdm.model.common.MarkerType;
36 36
import eu.etaxonomy.cdm.model.common.SourcedEntityBase;
37
import eu.etaxonomy.cdm.model.common.User;
38 37
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
39 38
import eu.etaxonomy.cdm.model.location.Country;
40 39
import eu.etaxonomy.cdm.model.location.NamedArea;
41 40
import eu.etaxonomy.cdm.model.location.NamedAreaType;
41
import eu.etaxonomy.cdm.model.permission.User;
42 42
import eu.etaxonomy.cdm.model.reference.ISourceable;
43 43
import eu.etaxonomy.cdm.model.reference.Reference;
44 44
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
app-import/src/main/java/eu/etaxonomy/cdm/io/berlinModel/in/BerlinModelUserImport.java
29 29
import eu.etaxonomy.cdm.io.common.utils.ImportDeduplicationHelper;
30 30
import eu.etaxonomy.cdm.model.agent.Person;
31 31
import eu.etaxonomy.cdm.model.common.CdmBase;
32
import eu.etaxonomy.cdm.model.common.User;
32
import eu.etaxonomy.cdm.model.permission.User;
33 33

  
34 34

  
35 35
/**
app-import/src/main/java/eu/etaxonomy/cdm/io/globis/GlobisImportBase.java
41 41
import eu.etaxonomy.cdm.model.common.CdmBase;
42 42
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
43 43
import eu.etaxonomy.cdm.model.common.Language;
44
import eu.etaxonomy.cdm.model.common.User;
45 44
import eu.etaxonomy.cdm.model.location.Country;
46 45
import eu.etaxonomy.cdm.model.location.NamedArea;
47 46
import eu.etaxonomy.cdm.model.name.IZoologicalName;
47
import eu.etaxonomy.cdm.model.permission.User;
48 48
import eu.etaxonomy.cdm.strategy.exceptions.StringNotParsableException;
49 49
import eu.etaxonomy.cdm.strategy.parser.INonViralNameParser;
50 50
import eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl;
......
54 54
 * @since 20.03.2008
55 55
 */
56 56
public abstract class GlobisImportBase<CDM_BASE extends CdmBase> extends CdmImportBase<GlobisImportConfigurator, GlobisImportState> implements ICdmIO<GlobisImportState>, IPartitionedIO<GlobisImportState> {
57
	private static final Logger logger = Logger.getLogger(GlobisImportBase.class);
57

  
58
    private static final long serialVersionUID = -7813164269152576841L;
59
    private static final Logger logger = Logger.getLogger(GlobisImportBase.class);
58 60

  
59 61
	public static final UUID ID_IN_SOURCE_EXT_UUID = UUID.fromString("23dac094-e793-40a4-bad9-649fc4fcfd44");
60 62

  
app-import/src/main/java/eu/etaxonomy/cdm/io/globis/GlobisImportState.java
1 1
/**
2 2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
21 21
import eu.etaxonomy.cdm.model.agent.Person;
22 22
import eu.etaxonomy.cdm.model.agent.Team;
23 23
import eu.etaxonomy.cdm.model.common.MarkerType;
24
import eu.etaxonomy.cdm.model.common.User;
25 24
import eu.etaxonomy.cdm.model.name.Rank;
25
import eu.etaxonomy.cdm.model.permission.User;
26 26
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
27 27

  
28 28
/**
......
35 35
	private static final Logger logger = Logger.getLogger(GlobisImportState.class);
36 36

  
37 37
	private Map<String, DefinedTermBase> dbCdmDefTermMap = new HashMap<String, DefinedTermBase>();
38
	
38

  
39 39
	private Map<String, User> usernameMap = new HashMap<String, User>();
40
	
40

  
41 41
	private Map<Integer, Map<Integer,Rank>> rankMap;
42 42

  
43 43
	private Map<String, Person> personMap = new HashMap<String, Person>();
44
	
44

  
45 45
	private Map<String, Team> teamMap = new HashMap<String, Team>();
46
	
47
	
48
	
46

  
47

  
48

  
49 49
	@Override
50 50
	public void initialize(GlobisImportConfigurator config) {
51 51
//		super(config);
......
61 61
	public Map<String, DefinedTermBase> getDbCdmDefinedTermMap(){
62 62
		return this.dbCdmDefTermMap;
63 63
	}
64
	
64

  
65 65
	public void putDefinedTermToMap(String tableName, String id, DefinedTermBase term){
66 66
		 this.dbCdmDefTermMap.put(tableName + "_" + id, term);
67 67
	}
68
	
68

  
69 69
	public void putDefinedTermToMap(String tableName, int id, DefinedTermBase term){
70 70
		putDefinedTermToMap(tableName, String.valueOf(id), term);
71 71
	}
72
	
73
	public User getUser(String username){
72

  
73
	@Override
74
    public User getUser(String username){
74 75
		return usernameMap.get(username);
75 76
	}
76 77

  
77
	public void putUser(String username, User user){
78
	@Override
79
    public void putUser(String username, User user){
78 80
		usernameMap.put(username, user);
79 81
	}
80 82

  
......
91 93
//	public Map<Integer, Map<Integer,Rank>> getRankMap() {
92 94
//		return rankMap;
93 95
//	}
94
	
95
 
96

  
97

  
96 98
	/**
97 99
	 * Returns the CDM rank depending on the ERMS rankId and the ERMS kingdomId. Returns <code>
98 100
	 * null</code> if the rank does not exist.
......
117 119
	public void putPerson(String str, Person person){
118 120
		personMap.put(str, person);
119 121
	}
120
	
122

  
121 123

  
122 124
	public Person getPerson(String str){
123 125
		return personMap.get(str);
......
127 129
	public void putTeam(String str, Team team){
128 130
		teamMap.put(str, team);
129 131
	}
130
	
132

  
131 133

  
132 134
	public Team getTeam(String str){
133 135
		return teamMap.get(str);
134 136
	}
135
	
137

  
136 138
	public Set<AgentBase> getAgents(){
137 139
		Set<AgentBase> result = new HashSet<AgentBase>();
138 140
		result.addAll(personMap.values());
139 141
		result.addAll(teamMap.values());
140 142
		return result;
141 143
	}
142
	
144

  
143 145
}
cdm-eflora/src/main/java/eu/etaxonomy/cdm/app/eflora/CentralAfricaEricaceaeActivator.java
40 40
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
41 41
import eu.etaxonomy.cdm.model.reference.Reference;
42 42
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
43
import eu.etaxonomy.cdm.model.term.FeatureNode;
44
import eu.etaxonomy.cdm.model.term.FeatureTree;
45 43
import eu.etaxonomy.cdm.model.term.OrderedTermVocabulary;
44
import eu.etaxonomy.cdm.model.term.TermNode;
45
import eu.etaxonomy.cdm.model.term.TermTree;
46 46
import eu.etaxonomy.cdm.model.term.TermType;
47 47

  
48 48
/**
......
133 133
		}
134 134

  
135 135
		if (doFeatureTree){
136
			FeatureTree tree = makeFeatureNode(myImport.getCdmAppController().getTermService());
136
			TermTree<Feature> tree = makeFeatureNode(myImport.getCdmAppController().getTermService());
137 137
			myImport.getCdmAppController().getFeatureTreeService().saveOrUpdate(tree);
138 138
		}
139 139

  
......
285 285
		return result;
286 286
	}
287 287

  
288
	private FeatureTree makeFeatureNode(ITermService service){
288
	private TermTree<Feature> makeFeatureNode(ITermService service){
289 289
		CentralAfricaEricaceaeTransformer transformer = new CentralAfricaEricaceaeTransformer();
290 290

  
291
		FeatureTree result = FeatureTree.NewInstance(featureTreeUuid);
291
		TermTree<Feature> result = TermTree.NewFeatureInstance(featureTreeUuid);
292 292
		result.setTitleCache("Central Africa Ericaceae Feature Tree", true);
293
		FeatureNode root = result.getRoot();
294
		FeatureNode newNode;
293
		TermNode<Feature> root = result.getRoot();
295 294

  
296
		newNode = FeatureNode.NewInstance(Feature.DESCRIPTION());
297
		root.addChild(newNode);
295
		TermNode<Feature> newNode = root.addChild(Feature.DESCRIPTION());
298 296

  
299
		addFeataureNodesByStringList(descriptionFeatureList, newNode, transformer, service);
297
		addFeatureNodesByStringList(descriptionFeatureList, newNode, transformer, service);
300 298

  
301
		addFeataureNodesByStringList(generellDescriptionsList, root, transformer, service);
299
		addFeatureNodesByStringList(generellDescriptionsList, root, transformer, service);
302 300

  
301
		newNode = root.addChild(Feature.DISTRIBUTION());
303 302

  
304
		newNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());
305
		root.addChild(newNode);
303
		newNode = root.addChild(Feature.ECOLOGY());
304
		addFeatureNodesByStringList(habitatEcologyList, root, transformer, service);
306 305

  
307
		newNode = FeatureNode.NewInstance(Feature.ECOLOGY());
308
		root.addChild(newNode);
309
		addFeataureNodesByStringList(habitatEcologyList, root, transformer, service);
306
		newNode = root.addChild(Feature.USES());
310 307

  
311
		newNode = FeatureNode.NewInstance(Feature.USES());
312
		root.addChild(newNode);
308
		addFeatureNodesByStringList(chomosomesList, root, transformer, service);
313 309

  
314
		addFeataureNodesByStringList(chomosomesList, root, transformer, service);
310
		newNode = root.addChild(Feature.COMMON_NAME());
315 311

  
316
		newNode = FeatureNode.NewInstance(Feature.COMMON_NAME());
317
		root.addChild(newNode);
318

  
319
		newNode = FeatureNode.NewInstance(Feature.CITATION());
320
		root.addChild(newNode);
312
		newNode = root.addChild(Feature.CITATION());
321 313

  
322 314
		return result;
323 315
	}
......
439 431

  
440 432
	};
441 433

  
442
	public void addFeataureNodesByStringList(String[] featureStringList, FeatureNode root, IInputTransformer transformer, ITermService termService){
434
	public void addFeatureNodesByStringList(String[] featureStringList, TermNode<Feature> root, IInputTransformer transformer, ITermService termService){
443 435
		try {
444 436
			for (String featureString : featureStringList){
445 437
			UUID featureUuid;
446 438
			featureUuid = transformer.getFeatureUuid(featureString);
447 439
			Feature feature = (Feature)termService.find(featureUuid);
448 440
			if (feature != null){
449
				FeatureNode child = FeatureNode.NewInstance(feature);
450
				root.addChild(child);
441
				TermNode<Feature> child = root.addChild(feature);
451 442
			}
452 443
		}
453 444
		} catch (UndefinedTransformerMethodException e) {
cdm-eflora/src/main/java/eu/etaxonomy/cdm/app/eflora/CentralAfricaFernsActivator.java
24 24
import eu.etaxonomy.cdm.model.description.Feature;
25 25
import eu.etaxonomy.cdm.model.reference.Reference;
26 26
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
27
import eu.etaxonomy.cdm.model.term.FeatureNode;
28
import eu.etaxonomy.cdm.model.term.FeatureTree;
27
import eu.etaxonomy.cdm.model.term.TermNode;
28
import eu.etaxonomy.cdm.model.term.TermTree;
29 29

  
30 30
/**
31 31
 * @author a.mueller
......
96 96

  
97 97

  
98 98

  
99
		FeatureTree tree = makeFeatureNode(myImport.getCdmAppController().getTermService());
99
		TermTree<Feature> tree = makeFeatureNode(myImport.getCdmAppController().getTermService());
100 100
		myImport.getCdmAppController().getFeatureTreeService().saveOrUpdate(tree);
101 101

  
102 102
		//check keys
......
118 118
		return result;
119 119
	}
120 120

  
121
	private FeatureTree makeFeatureNode(ITermService service){
121
	private TermTree<Feature> makeFeatureNode(ITermService service){
122 122
		FloraMalesianaTransformer transformer = new FloraMalesianaTransformer();
123 123

  
124
		FeatureTree result = FeatureTree.NewInstance(featureTreeUuid);
124
		TermTree<Feature> result = TermTree.NewFeatureInstance(featureTreeUuid);
125 125
		result.setTitleCache("Flora Malesiana Presentation Feature Tree", true);
126
		FeatureNode root = result.getRoot();
127
		FeatureNode newNode;
126
		TermNode<Feature> root = result.getRoot();
127
		TermNode<Feature> newNode = root.addChild(Feature.CITATION());
128 128

  
129
		newNode = FeatureNode.NewInstance(Feature.CITATION());
130
		root.addChild(newNode);
131

  
132
		newNode = FeatureNode.NewInstance(Feature.DESCRIPTION());
133
		root.addChild(newNode);
129
		root.addChild(Feature.DESCRIPTION());
134 130

  
135 131
		return result;
136 132
	}
cdm-eflora/src/main/java/eu/etaxonomy/cdm/app/eflora/EfloraActivatorBase.java
1 1
/**
2
 * 
2
 *
3 3
 */
4 4
package eu.etaxonomy.cdm.app.eflora;
5 5

  
......
26 26
import eu.etaxonomy.cdm.io.markup.MarkupImportConfigurator;
27 27
import eu.etaxonomy.cdm.io.markup.MarkupImportState;
28 28
import eu.etaxonomy.cdm.model.description.Feature;
29
import eu.etaxonomy.cdm.model.term.FeatureNode;
30
import eu.etaxonomy.cdm.model.term.FeatureTree;
29
import eu.etaxonomy.cdm.model.term.TermNode;
30
import eu.etaxonomy.cdm.model.term.TermTree;
31 31

  
32 32
/**
33 33
 * @author a.mueller
......
35 35
 */
36 36
public class EfloraActivatorBase {
37 37
	private static final Logger logger = Logger.getLogger(EfloraActivatorBase.class);
38
	
38

  
39 39
	protected MarkupImportConfigurator config;
40 40
	protected CdmDefaultImport<MarkupImportConfigurator> myImport;
41 41
	protected IIoObserver observer = new LoggingIoObserver();
......
49 49
		config = MarkupImportConfigurator.NewInstance(source, cdmDestination);
50 50
		config.setObservers(observerList);
51 51
		config.setCheck(check);
52
		
53
		myImport = new CdmDefaultImport<MarkupImportConfigurator>(); 
54
		
52

  
53
		myImport = new CdmDefaultImport<MarkupImportConfigurator>();
54

  
55 55
		return config;
56 56
	}
57
	
58
	protected FeatureTree makeAutomatedFeatureTree(ICdmRepository app, 
57

  
58
	protected TermTree<Feature> makeAutomatedFeatureTree(ICdmRepository app,
59 59
			MarkupImportState state, UUID featureTreeUuid, String featureTreeTitle){
60 60
		System.out.println("Start creating automated Feature Tree");
61
		FeatureTree tree = FeatureTree.NewInstance(featureTreeUuid);
61
		TermTree<Feature> tree = TermTree.NewFeatureInstance(featureTreeUuid);
62 62
		tree.setTitleCache(featureTreeTitle, true);
63
		FeatureNode root = tree.getRoot();
64
		
63
		TermNode<Feature> root = tree.getRoot();
64

  
65 65
		ITermService termService = app.getTermService();
66 66
		FeatureSorter sorter = new FeatureSorter();
67
		FeatureNode descriptionNode = null;
68
		
67
		TermNode<Feature> descriptionNode = null;
68

  
69 69
		//general features
70 70
		Map<String, List<FeatureSorterInfo>> generalList = state.getGeneralFeatureSorterListMap();
71 71
		List<UUID> uuidList = sorter.getSortOrder(generalList);
72 72
		Map<UUID, Feature> map = makeUuidMap(uuidList, termService);
73 73
		for (UUID key : uuidList){
74 74
			Feature feature = map.get(key);
75
			FeatureNode node = FeatureNode.NewInstance(feature);
76
			root.addChild(node);
75
			TermNode<Feature> node = root.addChild(feature);
77 76
			if (feature.equals(Feature.DESCRIPTION())){
78 77
				descriptionNode = node;
79 78
			}
80 79
		}
81
		FeatureNode newNode = FeatureNode.NewInstance(Feature.CITATION());
82
		root.addChild(newNode);
83
		
84
		
80
		TermNode<Feature> newNode = root.addChild(Feature.CITATION());
81

  
82

  
85 83
		//description features
86 84
		if (descriptionNode != null){
87 85
			Map<String, List<FeatureSorterInfo>> charList = state.getCharFeatureSorterListMap();
......
89 87
			map = makeUuidMap(uuidList, termService);
90 88
			for (UUID key : uuidList){
91 89
				Feature feature = map.get(key);
92
				descriptionNode.addChild(FeatureNode.NewInstance(feature));
90
				descriptionNode.addChild(feature);
93 91
			}
94 92
		}else{
95 93
			logger.warn("No description node found. Could not create feature nodes for description features.");
......
97 95

  
98 96
		//save tree
99 97
		app.getFeatureTreeService().saveOrUpdate(tree);
100
		
98

  
101 99
		System.out.println("End creating automated Feature Tree");
102
		
100

  
103 101
		return tree;
104 102
	}
105
	
103

  
106 104
	private Map<UUID,Feature> makeUuidMap(Collection<UUID> uuids, ITermService termService){
107 105
		HashSet<UUID> uuidSet = new HashSet<UUID>();
108 106
		uuidSet.addAll(uuids);
109 107
		List<Feature> featureSet = (List)termService.find(uuidSet);
110
		
108

  
111 109
		Map<UUID,Feature> result = new HashMap<UUID, Feature>();
112 110
		for (Feature feature : featureSet){
113 111
			result.put(feature.getUuid(), feature);
114 112
		}
115 113
		return result;
116 114
	}
117
	
118
	
115

  
116

  
119 117
	/**
120 118
	 * @param markupConfig
121 119
	 * @param myImport
cdm-eflora/src/main/java/eu/etaxonomy/cdm/app/eflora/FloraGuianasActivator.java
27 27
import eu.etaxonomy.cdm.model.description.PolytomousKey;
28 28
import eu.etaxonomy.cdm.model.reference.Reference;
29 29
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
30
import eu.etaxonomy.cdm.model.term.FeatureNode;
31
import eu.etaxonomy.cdm.model.term.FeatureTree;
30
import eu.etaxonomy.cdm.model.term.TermNode;
31
import eu.etaxonomy.cdm.model.term.TermTree;
32 32

  
33 33
/**
34 34
 * Activator for Flora of the Guianas imports.
......
186 186
		//Vol30
187 187
		executeVolume(fotg30, includeFotg30 ^ inverseInclude);
188 188

  
189
		FeatureTree tree = makeFeatureNode(myImport.getCdmAppController().getTermService());
189
		TermTree<Feature> tree = makeFeatureNode(myImport.getCdmAppController().getTermService());
190 190
		myImport.getCdmAppController().getFeatureTreeService().saveOrUpdate(tree);
191 191

  
192 192
		//check keys
......
208 208
		return result;
209 209
	}
210 210

  
211
	private FeatureTree makeFeatureNode(ITermService service){
211
	private TermTree<Feature> makeFeatureNode(ITermService service){
212 212
		MarkupTransformer transformer = new MarkupTransformer();
213 213

  
214
		FeatureTree result = FeatureTree.NewInstance(featureTreeUuid);
214
		TermTree<Feature> result = TermTree.NewFeatureInstance(featureTreeUuid);
215 215
		result.setTitleCache(FEATURE_TREE_TITLE, true);
216
		FeatureNode root = result.getRoot();
217
		FeatureNode newNode;
216
		TermNode<Feature> root = result.getRoot();
218 217

  
219
		newNode = FeatureNode.NewInstance(Feature.DESCRIPTION());
220
		root.addChild(newNode);
218
		TermNode<Feature> newNode = root.addChild(Feature.DESCRIPTION());
221 219

  
222
		addFeataureNodesByStringList(descriptionFeatureList, newNode, transformer, service);
220
		addFeatureNodesByStringList(descriptionFeatureList, newNode, transformer, service);
223 221

  
224
		addFeataureNodesByStringList(generellDescriptionsUpToAnatomyList, root, transformer, service);
225
		newNode = FeatureNode.NewInstance(Feature.ANATOMY());
226
		addFeataureNodesByStringList(anatomySubfeatureList, newNode, transformer, service);
222
		addFeatureNodesByStringList(generellDescriptionsUpToAnatomyList, root, transformer, service);
223
		newNode = TermNode.NewInstance(Feature.ANATOMY());
224
		addFeatureNodesByStringList(anatomySubfeatureList, newNode, transformer, service);
227 225

  
228
		newNode = addFeataureNodesByStringList(generellDescriptionsFromAnatomyToPhytoChemoList, root, transformer, service);
229
		addFeataureNodesByStringList(phytoChemoSubFeaturesList, newNode, transformer, service);
226
		newNode = addFeatureNodesByStringList(generellDescriptionsFromAnatomyToPhytoChemoList, root, transformer, service);
227
		addFeatureNodesByStringList(phytoChemoSubFeaturesList, newNode, transformer, service);
230 228

  
231
		newNode = addFeataureNodesByStringList(generellDescriptionsFromPhytoChemoList, root, transformer, service);
229
		newNode = addFeatureNodesByStringList(generellDescriptionsFromPhytoChemoList, root, transformer, service);
232 230

  
233 231

  
234
		newNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());
235
		root.addChild(newNode);
232
		newNode = root.addChild(Feature.DISTRIBUTION());
236 233

  
237
		newNode = FeatureNode.NewInstance(Feature.COMMON_NAME());
238
		root.addChild(newNode);
234
		newNode = root.addChild(Feature.COMMON_NAME());
239 235

  
240
		newNode = FeatureNode.NewInstance(Feature.PHENOLOGY());
241
		root.addChild(newNode);
236
		newNode = root.addChild(Feature.PHENOLOGY());
242 237

  
243
		newNode = FeatureNode.NewInstance(Feature.ECOLOGY());
244
		root.addChild(newNode);
245
		addFeataureNodesByStringList(habitatEcologyList, root, transformer, service);
238
		newNode = root.addChild(Feature.ECOLOGY());
239
		addFeatureNodesByStringList(habitatEcologyList, root, transformer, service);
246 240

  
247
		newNode = FeatureNode.NewInstance(Feature.USES());
248
		root.addChild(newNode);
241
		newNode = root.addChild(Feature.USES());
249 242

  
250
		addFeataureNodesByStringList(chomosomesList, root, transformer, service);
243
		addFeatureNodesByStringList(chomosomesList, root, transformer, service);
251 244

  
252
		newNode = FeatureNode.NewInstance(Feature.CITATION());
253
		root.addChild(newNode);
245
		newNode = root.addChild(Feature.CITATION());
254 246

  
255 247
		String sql = "\nSELECT feature.titleCache " +
256 248
				" FROM DescriptionElementBase deb INNER JOIN DefinedTermBase feature ON deb.feature_id = feature.id " +
......
417 409

  
418 410
	};
419 411

  
420
	public FeatureNode addFeataureNodesByStringList(String[] featureStringList, FeatureNode root, IInputTransformer transformer, ITermService termService){
421
		FeatureNode lastChild = null;
412
	public TermNode<Feature> addFeatureNodesByStringList(String[] featureStringList, TermNode<Feature> root, IInputTransformer transformer, ITermService termService){
413
	    TermNode<Feature> lastChild = null;
422 414
		try {
423 415
			for (String featureString : featureStringList){
424 416
				UUID featureUuid;
425 417
				featureUuid = transformer.getFeatureUuid(featureString);
426 418
				Feature feature = (Feature)termService.find(featureUuid);
427 419
				if (feature != null){
428
					FeatureNode child = FeatureNode.NewInstance(feature);
429
					root.addChild(child);
420
				    root.addChild(feature);
430 421
				}
431 422
			}
432 423

  
cdm-eflora/src/main/java/eu/etaxonomy/cdm/app/eflora/FloraMalesianaActivator.java
33 33
import eu.etaxonomy.cdm.model.description.PolytomousKey;
34 34
import eu.etaxonomy.cdm.model.reference.Reference;
35 35
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
36
import eu.etaxonomy.cdm.model.term.FeatureNode;
37
import eu.etaxonomy.cdm.model.term.FeatureTree;
36
import eu.etaxonomy.cdm.model.term.TermNode;
37
import eu.etaxonomy.cdm.model.term.TermTree;
38 38

  
39 39
/**
40 40
 * @author a.mueller
......
365 365

  
366 366
//		makeGeoService();
367 367

  
368
		FeatureTree tree = makeFeatureNode(myImport.getCdmAppController().getTermService());
368
		TermTree<Feature> tree = makeFeatureNode(myImport.getCdmAppController().getTermService());
369 369
		myImport.getCdmAppController().getFeatureTreeService().saveOrUpdate(tree);
370 370

  
371 371
		//check keys
......
398 398
		return result;
399 399
	}
400 400

  
401
	private FeatureTree makeFeatureNode(ITermService service){
401
	private TermTree<Feature> makeFeatureNode(ITermService service){
402 402
		FloraMalesianaTransformer transformer = new FloraMalesianaTransformer();
403 403

  
404
		FeatureTree result = FeatureTree.NewInstance(UUID.randomUUID());
404
		TermTree<Feature> result = TermTree.NewFeatureInstance(UUID.randomUUID());
405 405
		result.setTitleCache("Flora Malesiana Presentation Feature Tree - Old", true);
406
		FeatureNode root = result.getRoot();
407
		FeatureNode newNode;
406
		TermNode<Feature> root = result.getRoot();
408 407

  
409
		newNode = FeatureNode.NewInstance(Feature.DESCRIPTION());
410
		root.addChild(newNode);
408
		TermNode<Feature> newNode = root.addChild(Feature.DESCRIPTION());
411 409

  
412
		addFeataureNodesByStringList(descriptionFeatureList, newNode, transformer, service);
410
		addFeatureNodesByStringList(descriptionFeatureList, newNode, transformer, service);
413 411

  
414
		addFeataureNodesByStringList(generellDescriptionsUpToAnatomyList, root, transformer, service);
415
		newNode = FeatureNode.NewInstance(Feature.ANATOMY());
416
		addFeataureNodesByStringList(anatomySubfeatureList, newNode, transformer, service);
412
		addFeatureNodesByStringList(generellDescriptionsUpToAnatomyList, root, transformer, service);
413
		newNode = TermNode.NewInstance(Feature.ANATOMY());
414
		addFeatureNodesByStringList(anatomySubfeatureList, newNode, transformer, service);
417 415

  
418
		newNode = addFeataureNodesByStringList(generellDescriptionsFromAnatomyToPhytoChemoList, root, transformer, service);
419
		addFeataureNodesByStringList(phytoChemoSubFeaturesList, newNode, transformer, service);
416
		newNode = addFeatureNodesByStringList(generellDescriptionsFromAnatomyToPhytoChemoList, root, transformer, service);
417
		addFeatureNodesByStringList(phytoChemoSubFeaturesList, newNode, transformer, service);
420 418

  
421
		newNode = addFeataureNodesByStringList(generellDescriptionsFromPhytoChemoList, root, transformer, service);
419
		newNode = addFeatureNodesByStringList(generellDescriptionsFromPhytoChemoList, root, transformer, service);
422 420

  
423 421

  
424
		newNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());
425
		root.addChild(newNode);
422
		newNode = root.addChild(Feature.DISTRIBUTION());
426 423

  
427
		newNode = FeatureNode.NewInstance(Feature.ECOLOGY());
428
		root.addChild(newNode);
429
		addFeataureNodesByStringList(habitatEcologyList, root, transformer, service);
424
		newNode = root.addChild(Feature.ECOLOGY());
425
		addFeatureNodesByStringList(habitatEcologyList, root, transformer, service);
430 426

  
431
		newNode = FeatureNode.NewInstance(Feature.USES());
432
		root.addChild(newNode);
427
		newNode = root.addChild(Feature.USES());
433 428

  
434
		addFeataureNodesByStringList(chomosomesList, root, transformer, service);
429
		addFeatureNodesByStringList(chomosomesList, root, transformer, service);
435 430

  
436
		newNode = FeatureNode.NewInstance(Feature.CITATION());
437
		root.addChild(newNode);
431
		newNode = root.addChild(Feature.CITATION());
438 432

  
439 433
		return result;
440 434
	}
......
588 582

  
589 583
	};
590 584

  
591
	public FeatureNode addFeataureNodesByStringList(String[] featureStringList, FeatureNode root, IInputTransformer transformer, ITermService termService){
592
		FeatureNode lastChild = null;
585
	public TermNode<Feature> addFeatureNodesByStringList(String[] featureStringList,
586
	        TermNode<Feature> root, IInputTransformer transformer, ITermService termService){
587
	    TermNode<Feature> lastChild = null;
593 588
		try {
594 589
			for (String featureString : featureStringList){
595 590
				UUID featureUuid;
596 591
				featureUuid = transformer.getFeatureUuid(featureString);
597 592
				Feature feature = (Feature)termService.find(featureUuid);
598 593
				if (feature != null){
599
					FeatureNode child = FeatureNode.NewInstance(feature);
600
					root.addChild(child);
594
					root.addChild(feature);
601 595
				}
602 596
			}
603 597

  
cdm-eflora/src/main/java/eu/etaxonomy/cdm/app/eflora/FloraMalesianaActivator_OLD.java
1 1
/**
2 2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
29 29
import eu.etaxonomy.cdm.model.description.PolytomousKey;
30 30
import eu.etaxonomy.cdm.model.reference.Reference;
31 31
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
32
import eu.etaxonomy.cdm.model.term.FeatureNode;
33
import eu.etaxonomy.cdm.model.term.FeatureTree;
32
import eu.etaxonomy.cdm.model.term.TermNode;
33
import eu.etaxonomy.cdm.model.term.TermTree;
34 34

  
35 35
/**
36 36
 * @author a.mueller
......
39 39
 */
40 40
public class FloraMalesianaActivator_OLD {
41 41
	private static final Logger logger = Logger.getLogger(FloraMalesianaActivator_OLD.class);
42
	
42

  
43 43
	//database validation status (create, update, validate ...)
44 44
	static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
45 45
	static final URI fmSource1 = EfloraSources.fm_sapindaceae_local();
46 46
	static final URI fmSource2 = EfloraSources.fm_sapindaceae2_local();
47 47
	static final URI fmSource13_1 = EfloraSources.fm_13_1_local();
48 48
	static final URI fmSource13_2 = EfloraSources.fm_13_2_local();
49
	
50
	
49

  
50

  
51 51
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_andreasM3();
52 52
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_flora_malesiana_preview();
53 53
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_flora_malesiana_production();
54 54
	static final ICdmDataSource cdmDestination = CdmDestinations.localH2();
55 55
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql();
56
	
56

  
57 57

  
58 58
	//feature tree uuid
59 59
	public static final UUID featureTreeUuid = UUID.fromString("168df0c6-6429-484c-b26f-ded1f7e44bd9");
60
	
60

  
61 61
	//classification
62 62
	static final UUID classificationUuid = UUID.fromString("ca4e4bcb-a1d1-4124-a358-a3d3c41dd450");
63
	
63

  
64 64
	//check - import
65 65
	static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
66
	
66

  
67 67
	static boolean doPrintKeys = false;
68
	
68

  
69 69
	//taxa
70 70
	static final boolean doTaxa = true;
71 71

  
......
74 74
	private boolean includeVol13_1 = false;
75 75
	private boolean includeVol13_2 = false;
76 76

  
77
	
77

  
78 78
	private void doImport(ICdmDataSource cdmDestination){
79
		
79

  
80 80
		//make Source
81 81
		URI source = fmSource1;
82 82
		EfloraImportConfigurator floraMalesianaConfig= EfloraImportConfigurator.NewInstance(source, cdmDestination);
......
85 85
		floraMalesianaConfig.setCheck(check);
86 86
		floraMalesianaConfig.setDoPrintKeys(doPrintKeys);
87 87
		floraMalesianaConfig.setDbSchemaValidation(hbm2dll);
88
		
88

  
89 89
		CdmDefaultImport<EfloraImportConfigurator> myImport = new CdmDefaultImport<EfloraImportConfigurator>();
90 90

  
91
		
91

  
92 92
		//Sapindaceae1
93 93
		if (includeSapindaceae1){
94 94
			System.out.println("Start import from ("+ fmSource1.toString() + ") ...");
......
96 96
			myImport.invoke(floraMalesianaConfig);
97 97
			System.out.println("End import from ("+ fmSource1.toString() + ")...");
98 98
		}
99
		
99

  
100 100
		//Sapindaceae2
101 101
		if (includeSapindaceae2){
102 102
			System.out.println("\nStart import from ("+ fmSource2.toString() + ") ...");
......
106 106
			myImport.invoke(floraMalesianaConfig);
107 107
			System.out.println("End import from ("+ fmSource2.toString() + ")...");
108 108
		}
109
		
109

  
110 110
		floraMalesianaConfig.setSourceReference(getSourceReference("Flora Malesiana - Vol. 13"));
111 111
		//Vol13_1
112 112
		if (includeVol13_1){
......
125 125
			myImport.invoke(floraMalesianaConfig);
126 126
			System.out.println("End import from ("+ fmSource13_2.toString() + ")...");
127 127
		}
128
		
129
		FeatureTree tree = makeFeatureNode(myImport.getCdmAppController().getTermService());
128

  
129
		TermTree<Feature> tree = makeFeatureNode(myImport.getCdmAppController().getTermService());
130 130
		myImport.getCdmAppController().getFeatureTreeService().saveOrUpdate(tree);
131
		
131

  
132 132
		//check keys
133 133
		if (doPrintKeys){
134 134
			TransactionStatus tx = myImport.getCdmAppController().startTransaction();
......
139 139
			}
140 140
			myImport.getCdmAppController().commitTransaction(tx);
141 141
		}
142
		
142

  
143 143
	}
144
	
144

  
145 145
	private Reference getSourceReference(String string) {
146 146
		Reference result = ReferenceFactory.newGeneric();
147 147
		result.setTitleCache(string);
148 148
		return result;
149 149
	}
150 150

  
151
	private FeatureTree makeFeatureNode(ITermService service){
151
	private TermTree<Feature> makeFeatureNode(ITermService service){
152 152
		FloraMalesianaTransformer transformer = new FloraMalesianaTransformer();
153
		
154
		FeatureTree result = FeatureTree.NewInstance(featureTreeUuid);
155
		result.setTitleCache("Flora Malesiana Presentation Feature Tree");
156
		FeatureNode root = result.getRoot();
157
		FeatureNode newNode;
158
		
159
		newNode = FeatureNode.NewInstance(Feature.DESCRIPTION());
160
		root.addChild(newNode);
161
		
162
		addFeataureNodesByStringList(descriptionFeatureList, newNode, transformer, service);
163

  
164
		addFeataureNodesByStringList(generellDescriptionsList, root, transformer, service);
165

  
166
		
167
		newNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());
168
		root.addChild(newNode);
169

  
170
		newNode = FeatureNode.NewInstance(Feature.ECOLOGY());
171
		root.addChild(newNode);
172
		addFeataureNodesByStringList(habitatEcologyList, root, transformer, service);
173
		
174
		newNode = FeatureNode.NewInstance(Feature.USES());
175
		root.addChild(newNode);
176
		
177
		addFeataureNodesByStringList(chomosomesList, root, transformer, service);
178

  
179
		newNode = FeatureNode.NewInstance(Feature.CITATION());
180
		root.addChild(newNode);
181
		
153

  
154
		TermTree<Feature> result = TermTree.NewFeatureInstance(featureTreeUuid);
155
		result.setTitleCache("Flora Malesiana Presentation Feature Tree", true);
156
		TermNode<Feature> root = result.getRoot();
157

  
158
		TermNode<Feature> newNode = root.addChild(Feature.DESCRIPTION());
159

  
160
		addFeatureNodesByStringList(descriptionFeatureList, newNode, transformer, service);
161

  
162
		addFeatureNodesByStringList(generellDescriptionsList, root, transformer, service);
163

  
164

  
165
		newNode = root.addChild(Feature.DISTRIBUTION());
166

  
167
		newNode = root.addChild(Feature.ECOLOGY());
168
		addFeatureNodesByStringList(habitatEcologyList, root, transformer, service);
169

  
170
		newNode = root.addChild(Feature.USES());
171

  
172
		addFeatureNodesByStringList(chomosomesList, root, transformer, service);
173

  
174
		newNode = root.addChild(Feature.CITATION());
175

  
182 176
		return result;
183 177
	}
184
	
178

  
185 179
	private static String [] chomosomesList = new String[]{
186
		"Chromosomes", 
180
		"Chromosomes",
187 181
	};
188 182

  
189
	
183

  
190 184
	private static String [] habitatEcologyList = new String[]{
191 185
		"Habitat",
192 186
		"Habitat & Ecology"
193 187
	};
194
	
195
	
188

  
189

  
196 190
	private static String [] generellDescriptionsList = new String[]{
197 191
		"Fossils",
198 192
		"Morphology and anatomy",
199
		"Morphology", 
193
		"Morphology",
200 194
		"Vegetative morphology and anatomy",
201 195
		"Flower morphology",
202
		"Palynology",  
203
		"Pollination",  
196
		"Palynology",
197
		"Pollination",
204 198
		"Pollen morphology",
205 199
		"Life cycle",
206 200
		"Fruits and embryology",
207 201
		"Dispersal",
208
		"Wood anatomy",  
209
		"Leaf anatomy",  
210
		"Chromosome numbers", 
202
		"Wood anatomy",
203
		"Leaf anatomy",
204
		"Chromosome numbers",
211 205
		"Phytochemistry and Chemotaxonomy",
212 206
		"Phytochemistry",
213
		"Taxonomy",	
207
		"Taxonomy",
214 208
	};
215 209

  
216 210
	private static String [] descriptionFeatureList = new String[]{
217
		"lifeform", 
218
		"Bark",  
219
		"Indumentum",  
220
		"endophytic body",  
221
		"flowering buds",  
222
		"Branchlets",  
223
		"Branches",  
224
		"Branch",  
211
		"lifeform",
212
		"Bark",
213
		"Indumentum",
214
		"endophytic body",
215
		"flowering buds",
216
		"Branchlets",
217
		"Branches",
218
		"Branch",
225 219
		"Flowering branchlets",
226
		"Trees",  
227
		"Twigs",  
228
		"stem",  
229
		"Stems",  
230
		"stem leaves", 
220
		"Trees",
221
		"Twigs",
222
		"stem",
223
		"Stems",
224
		"stem leaves",
231 225
		"Leaves",
232
		"flower-bearing stems",  
233
		"Petiole",  
234
		"Petiolules",  
235
		"Leaflets", 
236
		"Thyrsus",  
237
		"Thyrses",  
238
		"Inflorescences",  
226
		"flower-bearing stems",
227
		"Petiole",
228
		"Petiolules",
229
		"Leaflets",
230
		"Thyrsus",
231
		"Thyrses",
232
		"Inflorescences",
239 233
		"Inflorescence",
240
		"Young inflorescences", 
241
		"Bracts",  
242
		"Pedicels",  
243
		"flowering buds",  
244
		"scales",  
245
		"Buds",  
246
		"Flowers",  
247
		"Flower",  
234
		"Young inflorescences",
235
		"Bracts",
236
		"Pedicels",
237
		"flowering buds",
238
		"scales",
239
		"Buds",
240
		"Flowers",
241
		"Flower",
248 242
		"Flowering",
249
		"Stigma",  
250
		"perianth",  
251
		"Sepals",  
252
		"Sepal",  
253
		"Outer Sepals",  
254
		"Axillary",  
255
		"cymes",  
256
		"Calyx",  
257
		"Petal",  
258
		"Petals",  
243
		"Stigma",
244
		"perianth",
245
		"Sepals",
246
		"Sepal",
247
		"Outer Sepals",
248
		"Axillary",
249
		"cymes",
250
		"Calyx",
251
		"Petal",
252
		"Petals",
259 253
		"perigone tube",
260
		"Disc",  
261
		"corolla",  
262
		"Stamens",  
263
		"Staminodes",  
264
		"Ovary",  
254
		"Disc",
255
		"corolla",
256
		"Stamens",
257
		"Staminodes",
258
		"Ovary",
265 259
		"Anthers",
266
		"anther",  
267
		"Pistil",  
268
		"Pistillode",  
269
		"Ovules",  
270
		"androecium",  
271
		"gynoecium",  
272
		"Filaments",  		
273
		"Style",  
274
		"annulus",  
275
		"female flowers",  
276
		"Male flowers",  
277
		"Female",  
278
		"Infructescences",    //order not consistent (sometimes before "Flowers")  
279
		"Fruit",  
280
		"Fruits",  
281
		"fruiting axes",  
282
		"drupes",  
283
		"Arillode",  
284
		"seed",  
285
		"Seeds",  
286
		"Seedling",  
287
		"flower tube", 
288
		"nutlets",  
289
		"pollen",  
290
		"secondary xylem",  
291
		"chromosome number",  
292
	
293
		"figure",  
294
		"fig",  
295
		"figs",  
296

  
297

  
298

  
299
		
260
		"anther",
261
		"Pistil",
262
		"Pistillode",
263
		"Ovules",
264
		"androecium",
265
		"gynoecium",
266
		"Filaments",
267
		"Style",
268
		"annulus",
269
		"female flowers",
270
		"Male flowers",
271
		"Female",
272
		"Infructescences",    //order not consistent (sometimes before "Flowers")
273
		"Fruit",
274
		"Fruits",
275
		"fruiting axes",
276
		"drupes",
277
		"Arillode",
278
		"seed",
279
		"Seeds",
280
		"Seedling",
281
		"flower tube",
282
		"nutlets",
283
		"pollen",
284
		"secondary xylem",
285
		"chromosome number",
286

  
287
		"figure",
288
		"fig",
289
		"figs",
290

  
291

  
292

  
293

  
300 294
	};
301
	
302
	public void addFeataureNodesByStringList(String[] featureStringList, FeatureNode root, IInputTransformer transformer, ITermService termService){
295

  
296
	public void addFeatureNodesByStringList(String[] featureStringList, TermNode<Feature> root, IInputTransformer transformer, ITermService termService){
303 297
		try {
304 298
			for (String featureString : featureStringList){
305 299
			UUID featureUuid;
306 300
			featureUuid = transformer.getFeatureUuid(featureString);
307 301
			Feature feature = (Feature)termService.find(featureUuid);
308 302
			if (feature != null){
309
				FeatureNode child = FeatureNode.NewInstance(feature);
310
				root.addChild(child);	
303
				root.addChild(feature);
311 304
			}
312 305
		}
313 306
		} catch (UndefinedTransformerMethodException e) {
314 307
			logger.error("getFeatureUuid is not implemented in transformer. Features could not be added");
315 308
		}
316 309
	}
317
	
310

  
318 311

  
319 312

  
320 313
	/**
......
324 317
		FloraMalesianaActivator_OLD me = new FloraMalesianaActivator_OLD();
325 318
		me.doImport(cdmDestination);
326 319
	}
327
	
320

  
328 321
}
cdm-eflora/src/main/java/eu/etaxonomy/cdm/app/eflora/FloreGabonActivator.java
27 27
import eu.etaxonomy.cdm.model.description.PolytomousKey;
28 28
import eu.etaxonomy.cdm.model.reference.Reference;
29 29
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
30
import eu.etaxonomy.cdm.model.term.FeatureNode;
31
import eu.etaxonomy.cdm.model.term.FeatureTree;
30
import eu.etaxonomy.cdm.model.term.TermNode;
31
import eu.etaxonomy.cdm.model.term.TermTree;
32 32

  
33 33
/**
34 34
 * @author a.mueller
......
319 319

  
320 320

  
321 321

  
322
		FeatureTree tree = makeFeatureNode(myImport.getCdmAppController().getTermService());
322
		TermTree<Feature> tree = makeFeatureNode(myImport.getCdmAppController().getTermService());
323 323
		myImport.getCdmAppController().getFeatureTreeService().saveOrUpdate(tree);
324 324

  
325 325
		makeAutomatedFeatureTree(myImport.getCdmAppController(), config.getState(),
......
348 348

  
349 349

  
350 350

  
351
	private FeatureTree makeFeatureNode(ITermService service){
351
	private TermTree<Feature> makeFeatureNode(ITermService service){
352 352
		MarkupTransformer transformer = new MarkupTransformer();
353 353

  
354
		FeatureTree result = FeatureTree.NewInstance();
354
		TermTree<Feature> result = TermTree.NewInstance();
355 355
		result.setTitleCache("Old feature tree", true);
356
		FeatureNode root = result.getRoot();
357
		FeatureNode newNode;
356
		TermNode<Feature> root = result.getRoot();
358 357

  
359
		newNode = FeatureNode.NewInstance(Feature.DESCRIPTION());
360
		root.addChild(newNode);
358
		TermNode<Feature> newNode = root.addChild(Feature.DESCRIPTION());
361 359

  
362
		addFeataureNodesByStringList(descriptionFeatureList, newNode, transformer, service);
360
		addFeatureNodesByStringList(descriptionFeatureList, newNode, transformer, service);
363 361

  
364
		addFeataureNodesByStringList(generellDescriptionsUpToAnatomyList, root, transformer, service);
365
		newNode = FeatureNode.NewInstance(Feature.ANATOMY());
366
		addFeataureNodesByStringList(anatomySubfeatureList, newNode, transformer, service);
362
		addFeatureNodesByStringList(generellDescriptionsUpToAnatomyList, root, transformer, service);
363
		newNode = TermNode.NewInstance(Feature.ANATOMY());
364
		addFeatureNodesByStringList(anatomySubfeatureList, newNode, transformer, service);
367 365

  
368
		newNode = addFeataureNodesByStringList(generellDescriptionsFromAnatomyToPhytoChemoList, root, transformer, service);
369
		addFeataureNodesByStringList(phytoChemoSubFeaturesList, newNode, transformer, service);
366
		newNode = addFeatureNodesByStringList(generellDescriptionsFromAnatomyToPhytoChemoList, root, transformer, service);
367
		addFeatureNodesByStringList(phytoChemoSubFeaturesList, newNode, transformer, service);
370 368

  
371
		newNode = addFeataureNodesByStringList(generellDescriptionsFromPhytoChemoList, root, transformer, service);
369
		newNode = addFeatureNodesByStringList(generellDescriptionsFromPhytoChemoList, root, transformer, service);
372 370

  
373
		newNode = FeatureNode.NewInstance(Feature.COMMON_NAME());
374
		root.addChild(newNode);
371
		newNode = root.addChild(Feature.COMMON_NAME());
375 372

  
376
		newNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());
377
		root.addChild(newNode);
373
		newNode = root.addChild(Feature.DISTRIBUTION());
378 374

  
379
		newNode = FeatureNode.NewInstance(Feature.ECOLOGY());
380
		root.addChild(newNode);
381
		addFeataureNodesByStringList(habitatEcologyList, root, transformer, service);
375
		newNode = root.addChild(Feature.ECOLOGY());
376
		addFeatureNodesByStringList(habitatEcologyList, root, transformer, service);
382 377

  
383
		newNode = FeatureNode.NewInstance(Feature.USES());
384
		root.addChild(newNode);
378
		newNode = root.addChild(Feature.USES());
385 379

  
386
		addFeataureNodesByStringList(chomosomesList, root, transformer, service);
380
		addFeatureNodesByStringList(chomosomesList, root, transformer, service);
387 381

  
388
		newNode = FeatureNode.NewInstance(Feature.CITATION());
389
		root.addChild(newNode);
382
		newNode = root.addChild(Feature.CITATION());
390 383

  
391 384
		return result;
392 385
	}
......
552 545

  
553 546
	};
554 547

  
555
	public FeatureNode addFeataureNodesByStringList(String[] featureStringList, FeatureNode root, IInputTransformer transformer, ITermService termService){
556
		FeatureNode lastChild = null;
548
	public TermNode<Feature> addFeatureNodesByStringList(String[] featureStringList,
549
	             TermNode<Feature> root, IInputTransformer transformer, ITermService termService){
550

  
551
	    TermNode<Feature> lastChild = null;
557 552
		try {
558 553
			for (String featureString : featureStringList){
559 554
				UUID featureUuid;
560 555
				featureUuid = transformer.getFeatureUuid(featureString);
561 556
				Feature feature = (Feature)termService.find(featureUuid);
562 557
				if (feature != null){
563
					FeatureNode child = FeatureNode.NewInstance(feature);
564
					root.addChild(child);
558
					root.addChild(feature);
565 559
				}
566 560
			}
567 561

  
cdm-eflora/src/main/java/eu/etaxonomy/cdm/app/eflora/NepenthesActivator.java
38 38
import eu.etaxonomy.cdm.model.description.PolytomousKey;
39 39
import eu.etaxonomy.cdm.model.reference.Reference;
40 40
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
41
import eu.etaxonomy.cdm.model.term.FeatureNode;
42
import eu.etaxonomy.cdm.model.term.FeatureTree;
41
import eu.etaxonomy.cdm.model.term.TermNode;
42
import eu.etaxonomy.cdm.model.term.TermTree;
43 43

  
44 44
/**
45 45
 * @author a.mueller
......
138 138

  
139 139
//		makeGeoService();
140 140

  
141
		FeatureTree tree = makeFeatureNode(myImport.getCdmAppController().getTermService());
141
		TermTree<Feature> tree = makeFeatureNode(myImport.getCdmAppController().getTermService());
142 142
		myImport.getCdmAppController().getFeatureTreeService().saveOrUpdate(tree);
143 143

  
144 144
		//check keys
......
196 196
		return result;
197 197
	}
198 198

  
199
	private FeatureTree makeFeatureNode(ITermService service){
199
	private TermTree<Feature> makeFeatureNode(ITermService service){
200 200
		FloraMalesianaTransformer transformer = new FloraMalesianaTransformer();
201 201

  
202
		FeatureTree result = FeatureTree.NewInstance(UUID.randomUUID());
202
		TermTree<Feature> result = TermTree.NewFeatureInstance(UUID.randomUUID());
203 203
		result.setTitleCache("Flora Malesiana Nepenthaceae Simple Feature Tree", true);
204
		FeatureNode root = result.getRoot();
205
		FeatureNode newNode;
204
		TermNode<Feature> root = result.getRoot();
206 205

  
207
		newNode = FeatureNode.NewInstance(Feature.CITATION());
208
        root.addChild(newNode);
206
		TermNode<Feature> newNode = root.addChild(Feature.CITATION());
209 207

  
208
		newNode = root.addChild(Feature.DESCRIPTION());
210 209

  
211
		newNode = FeatureNode.NewInstance(Feature.DESCRIPTION());
212
		root.addChild(newNode);
210
	    newNode = root.addChild(Feature.DISTRIBUTION());
213 211

  
214
	    newNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());
215
	    root.addChild(newNode);
212
        newNode = root.addChild(Feature.ECOLOGY());
216 213

  
217
        newNode = FeatureNode.NewInstance(Feature.ECOLOGY());
218
        root.addChild(newNode);
214
        newNode = root.addChild(Feature.SPECIMEN());
219 215

  
220
        newNode = FeatureNode.NewInstance(Feature.SPECIMEN());
221
        root.addChild(newNode);
216
        newNode = root.addChild(Feature.NOTES());
222 217

  
223
        newNode = FeatureNode.NewInstance(Feature.NOTES());
224
        root.addChild(newNode);
218
//		addFeatureNodesByStringList(descriptionFeatureList, newNode, transformer, service);
225 219

  
226
//		addFeataureNodesByStringList(descriptionFeatureList, newNode, transformer, service);
227

  
228
//		addFeataureNodesByStringList(generellDescriptionsUpToAnatomyList, root, transformer, service);
220
//		addFeatureNodesByStringList(generellDescriptionsUpToAnatomyList, root, transformer, service);
229 221
//		newNode = FeatureNode.NewInstance(Feature.ANATOMY());
230
//		addFeataureNodesByStringList(anatomySubfeatureList, newNode, transformer, service);
222
//		addFeatureNodesByStringList(anatomySubfeatureList, newNode, transformer, service);
231 223
//
232
//		newNode = addFeataureNodesByStringList(generellDescriptionsFromAnatomyToPhytoChemoList, root, transformer, service);
233
//		addFeataureNodesByStringList(phytoChemoSubFeaturesList, newNode, transformer, service);
224
//		newNode = addFeatureNodesByStringList(generellDescriptionsFromAnatomyToPhytoChemoList, root, transformer, service);
225
//		addFeatureNodesByStringList(phytoChemoSubFeaturesList, newNode, transformer, service);
234 226
//
235
//		newNode = addFeataureNodesByStringList(generellDescriptionsFromPhytoChemoList, root, transformer, service);
227
//		newNode = addFeatureNodesByStringList(generellDescriptionsFromPhytoChemoList, root, transformer, service);
236 228
//
237 229
//
238 230

  
239 231
//
240 232
//		newNode = FeatureNode.NewInstance(Feature.ECOLOGY());
241 233
//		root.addChild(newNode);
242
//		addFeataureNodesByStringList(habitatEcologyList, root, transformer, service);
234
//		addFeatureNodesByStringList(habitatEcologyList, root, transformer, service);
243 235
//
244 236
//		newNode = FeatureNode.NewInstance(Feature.USES());
245 237
//		root.addChild(newNode);
246 238
//
247
//		addFeataureNodesByStringList(chomosomesList, root, transformer, service);
239
//		addFeatureNodesByStringList(chomosomesList, root, transformer, service);
248 240

  
249 241

  
250 242
		return result;
......
399 391

  
400 392
	};
401 393

  
402
	public FeatureNode addFeataureNodesByStringList(String[] featureStringList, FeatureNode root, IInputTransformer transformer, ITermService termService){
403
		FeatureNode lastChild = null;
394
	public TermNode<Feature> addFeatureNodesByStringList(String[] featureStringList,
395
	            TermNode<Feature> root, IInputTransformer transformer, ITermService termService){
396

  
397
	    TermNode<Feature> lastChild = null;
404 398
		try {
405 399
			for (String featureString : featureStringList){
406 400
				UUID featureUuid;
407 401
				featureUuid = transformer.getFeatureUuid(featureString);
408 402
				Feature feature = (Feature)termService.find(featureUuid);
409 403
				if (feature != null){
410
					FeatureNode child = FeatureNode.NewInstance(feature);
411
					root.addChild(child);
404
					root.addChild(feature);
412 405
				}
413 406
			}
414 407

  
cdm-eflora/src/main/java/eu/etaxonomy/cdm/app/testUpdate/EricaceaeTestUpdateActivator.java
1 1
/**
2 2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
28 28
import eu.etaxonomy.cdm.io.eflora.EfloraImportConfigurator;
29 29
import eu.etaxonomy.cdm.io.eflora.centralAfrica.ericaceae.CentralAfricaEricaceaeImportConfigurator;
30 30
import eu.etaxonomy.cdm.model.common.Language;
31
import eu.etaxonomy.cdm.model.description.Feature;
31 32
import eu.etaxonomy.cdm.model.reference.Reference;
32 33
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
33
import eu.etaxonomy.cdm.model.term.FeatureNode;
34
import eu.etaxonomy.cdm.model.term.FeatureTree;
34
import eu.etaxonomy.cdm.model.term.TermNode;
35
import eu.etaxonomy.cdm.model.term.TermTree;
35 36

  
36 37
/**
37 38
 * @author a.mueller
......
41 42
public class EricaceaeTestUpdateActivator {
42 43
	@SuppressWarnings("unused")
43 44
	private static final Logger logger = Logger.getLogger(EricaceaeTestUpdateActivator.class);
44
	
45

  
45 46
	//database validation status (create, update, validate ...)
46 47
	static DbSchemaValidation hbm2dll = DbSchemaValidation.VALIDATE;
47 48
	static final URI source = EfloraSources.ericacea_local();
48 49

  
49
	
50

  
50 51
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_andreasM2();
51 52
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_flora_central_africa_preview();
52 53
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_flora_central_africa_production();
53 54
	static final ICdmDataSource cdmDestination = CdmDestinations.localH2();
54 55
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_postgres_CdmTest();
55
	
56

  
56 57

  
57 58
	//feature tree uuid
58 59
	public static final UUID featureTreeUuid = UUID.fromString("051d35ee-22f1-42d8-be07-9e9bfec5bcf7");
59
	
60

  
60 61
	public static UUID defaultLanguageUuid = Language.uuidEnglish;
61
	
62

  
62 63
	//classification
63 64
	static final UUID classificationUuid = UUID.fromString("10e5efcc-6e13-4abc-ad42-e0b46e50cbe7");
64
	
65

  
65 66
	//check - import
66 67
	static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
67
	
68

  
68 69
	static boolean doPrintKeys = false;
69
	
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)