Project

General

Profile

Revision 7691ed2a

ID7691ed2a6be3542832ec174770f6fa7dd29b5bb4
Parent 6556d6fb
Child 67e58b3f

Added by Andreas Müller over 2 years ago

ref #8257 remove factory method for term node creation in app-import

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/app/berlinModelImport/AlgaTerraActivator.java
208 208
	 * @param app
209 209
	 */
210 210
	private void makeTaxonFeatureTree(AlgaTerraImportConfigurator config, ICdmRepository app) {
211
		FeatureTree tree = TreeCreator.flatTree(featureTreeUuid, config.getFeatureMap(), featureKeyList);
211
		FeatureTree<Feature> tree = TreeCreator.flatTree(featureTreeUuid, config.getFeatureMap(), featureKeyList);
212 212
		tree.setTitleCache("AlgaTerra Taxon Feature Tree", true);
213 213

  
214
		FeatureNode node = FeatureNode.NewInstance(Feature.HABITAT());
215
		tree.getRoot().addChild(node);
214
		tree.getRoot().addChild(Feature.HABITAT());
216 215

  
217
//		node = FeatureNode.NewInstance(Feature.OBSERVATION());
218
//		tree.getRoot().addChild(node);
216
//		tree.getRoot().addChild(Feature.OBSERVATION());
219 217
//
220
//		node = FeatureNode.NewInstance(Feature.SPECIMEN());
221
//		tree.getRoot().addChild(node);
218
//		tree.getRoot().addChild(Feature.SPECIMEN());
222 219
//
223
//		node = FeatureNode.NewInstance(Feature.INDIVIDUALS_ASSOCIATION());
224
//		tree.getRoot().addChild(node);
220
//		tree.getRoot().addChild(Feature.INDIVIDUALS_ASSOCIATION());
225 221

  
226 222
		//needed ??
227
		FeatureNode distributionNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());
228
		tree.getRoot().addChild(distributionNode, 2);
223
		tree.getRoot().addChild(Feature.DISTRIBUTION(), 2);
229 224

  
230 225
//		//needed ??
231
//		FeatureNode imageNode = FeatureNode.NewInstance(Feature.IMAGE());
232
//		tree.getRoot().addChild(imageNode);
226
//		tree.getRoot().addChild(Feature.IMAGE());
233 227

  
234 228
		app.getFeatureTreeService().saveOrUpdate(tree);
235 229
	}
......
242 236
	 */
243 237
	private void makeSpecimenFeatureTree(AlgaTerraImportConfigurator config, ICdmRepository app) {
244 238
		ITermService termService = app.getTermService();
245
		FeatureTree specimenTree = FeatureTree.NewInstance(specimenFeatureTreeUuid);
239
		FeatureTree<Feature> specimenTree = FeatureTree.NewInstance(specimenFeatureTreeUuid);
246 240
//		FeatureTree specimenTree = TreeCreator.flatTree(specimenFeatureTreeUuid, config.getFeatureMap(), featureKeyList);
247 241
		specimenTree.setTitleCache("AlgaTerra Specimen Feature Tree", true);
248
		FeatureNode root = specimenTree.getRoot();
242
		FeatureNode<Feature> root = specimenTree.getRoot();
249 243

  
250 244

  
251
		FeatureNode imageNode = FeatureNode.NewInstance(Feature.IMAGE());
252
		root.addChild(imageNode);
245
		root.addChild(Feature.IMAGE());
253 246

  
254 247
		addFeatureNodeByUuid(root, termService, AlgaTerraSpecimenImportBase.uuidFeatureAlgaTerraClimate);
255
		FeatureNode node = FeatureNode.NewInstance(Feature.HABITAT());
256
		root.addChild(node);
248
		root.addChild(Feature.HABITAT());
257 249
		addFeatureNodeByUuid(root, termService, AlgaTerraSpecimenImportBase.uuidFeatureHabitatExplanation);
258 250
		addFeatureNodeByUuid(root, termService, AlgaTerraSpecimenImportBase.uuidFeatureAlgaTerraLifeForm);
259 251

  
......
280 272
		app.getFeatureTreeService().saveOrUpdate(specimenTree);
281 273
	}
282 274

  
283
	private FeatureNode makeNitrogenNode(FeatureNode root, ITermService termService) {
275
	private FeatureNode<Feature> makeNitrogenNode(FeatureNode<Feature> root, ITermService termService) {
284 276
		Feature nFeature = Feature.NewInstance("Supra feature for all Nitrogen related subfeatures", "Nitrogen", "N");
285 277
		termService.save(nFeature);
286
		FeatureNode nNode = FeatureNode.NewInstance(nFeature);
287
		root.addChild(nNode);
278
		FeatureNode<Feature> nNode = root.addChild(nFeature);
288 279
		return nNode;
289 280
	}
290 281

  
......
304 295
	 * @param termService
305 296
	 * @param featureUuid
306 297
	 */
307
	private void addFeatureNodeByUuid(FeatureNode root, ITermService termService, UUID featureUuid) {
298
	private void addFeatureNodeByUuid(FeatureNode<Feature> root, ITermService termService, UUID featureUuid) {
308 299
		Feature feature = (Feature)termService.find(featureUuid);
309 300
		if (feature != null){
310
			FeatureNode child = FeatureNode.NewInstance(feature);
311
			root.addChild(child);
301
			root.addChild(feature);
312 302
		}
313 303
	}
314 304

  
app-import/src/main/java/eu/etaxonomy/cdm/app/berlinModelImport/CampanulaceaeActivator.java
26 26
import eu.etaxonomy.cdm.io.common.Source;
27 27
import eu.etaxonomy.cdm.model.description.Feature;
28 28
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
29
import eu.etaxonomy.cdm.model.term.FeatureNode;
30 29
import eu.etaxonomy.cdm.model.term.FeatureTree;
31 30

  
32 31

  
......
176 175
			ICdmRepository app = bmImport.getCdmAppController();
177 176

  
178 177
			//make feature tree
179
			FeatureTree tree = TreeCreator.flatTree(featureTreeUuid, bmImportConfigurator.getFeatureMap(), featureKeyList);
180
			FeatureNode distributionNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());
181
			tree.getRoot().addChild(distributionNode, 1);
178
			FeatureTree<Feature> tree = TreeCreator.flatTree(featureTreeUuid, bmImportConfigurator.getFeatureMap(), featureKeyList);
179
			tree.getRoot().addChild(Feature.DISTRIBUTION(), 1);
182 180
			app.getFeatureTreeService().saveOrUpdate(tree);
183 181
		}
184 182

  
185 183
		System.out.println("End import from BerlinModel ("+ source.getDatabase() + ")...");
186 184

  
187

  
188 185
		logger.warn("!!!! NOTE: RefDetail notes and RelPTaxon notes are not imported automatically. Please check for these notes and import them manually.");
189 186

  
190 187
		return success;
app-import/src/main/java/eu/etaxonomy/cdm/app/berlinModelImport/CaucasusEuroMedActivator.java
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;
61
import eu.etaxonomy.cdm.model.term.FeatureNode;
62 61
import eu.etaxonomy.cdm.model.term.FeatureTree;
63 62
import eu.etaxonomy.cdm.model.term.Representation;
64 63
import eu.etaxonomy.cdm.persistence.hibernate.permission.Role;
......
400 399
                TransactionStatus tx = app.startTransaction();
401 400

  
402 401
                //make feature tree
403
                FeatureTree tree = TreeCreator.flatTree(featureTreeUuid, config.getFeatureMap(), featureKeyList);
402
                FeatureTree<Feature> tree = TreeCreator.flatTree(featureTreeUuid, config.getFeatureMap(), featureKeyList);
404 403
                tree.setTitleCache("Euro+Med Feature Tree", true);
405
                FeatureNode imageNode = FeatureNode.NewInstance(Feature.IMAGE());
406
                tree.getRoot().addChild(imageNode);
407
                FeatureNode distributionNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());
408
                tree.getRoot().addChild(distributionNode, 1);
409
                FeatureNode commonNameNode = FeatureNode.NewInstance(Feature.COMMON_NAME());
410
                tree.getRoot().addChild(commonNameNode, 2);
404
                tree.getRoot().addChild(Feature.IMAGE());
405
                tree.getRoot().addChild(Feature.DISTRIBUTION(), 1);
406
                tree.getRoot().addChild(Feature.COMMON_NAME(), 2);
411 407
                app.getFeatureTreeService().saveOrUpdate(tree);
412 408

  
413 409
                app.commitTransaction(tx);
app-import/src/main/java/eu/etaxonomy/cdm/app/berlinModelImport/EuroMedActivator.java
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;
61
import eu.etaxonomy.cdm.model.term.FeatureNode;
62 61
import eu.etaxonomy.cdm.model.term.FeatureTree;
63 62
import eu.etaxonomy.cdm.model.term.Representation;
64 63
import eu.etaxonomy.cdm.persistence.hibernate.permission.Role;
......
404 403
                TransactionStatus tx = app.startTransaction();
405 404

  
406 405
                //make feature tree
407
                FeatureTree tree = TreeCreator.flatTree(featureTreeUuid, config.getFeatureMap(), featureKeyList);
406
                FeatureTree<Feature> tree = TreeCreator.flatTree(featureTreeUuid, config.getFeatureMap(), featureKeyList);
408 407
                tree.setTitleCache("Euro+Med Feature Tree", true);
409
                FeatureNode imageNode = FeatureNode.NewInstance(Feature.IMAGE());
410
                tree.getRoot().addChild(imageNode);
411
                FeatureNode distributionNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());
412
                tree.getRoot().addChild(distributionNode, 1);
413
                FeatureNode commonNameNode = FeatureNode.NewInstance(Feature.COMMON_NAME());
414
                tree.getRoot().addChild(commonNameNode, 2);
408
                tree.getRoot().addChild(Feature.IMAGE());
409
                tree.getRoot().addChild(Feature.DISTRIBUTION(), 1);
410
                tree.getRoot().addChild(Feature.COMMON_NAME(), 2);
415 411
                app.getFeatureTreeService().saveOrUpdate(tree);
416 412

  
417 413
                app.commitTransaction(tx);
app-import/src/main/java/eu/etaxonomy/cdm/app/berlinModelImport/IldisActivator.java
25 25
import eu.etaxonomy.cdm.io.common.Source;
26 26
import eu.etaxonomy.cdm.model.description.Feature;
27 27
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
28
import eu.etaxonomy.cdm.model.term.FeatureNode;
29 28
import eu.etaxonomy.cdm.model.term.FeatureTree;
30 29

  
31 30
/**
......
158 157
			ICdmRepository app = bmImport.getCdmAppController();
159 158

  
160 159
			//make feature tree
161
			FeatureTree tree = TreeCreator.flatTree(featureTreeUuid, bmImportConfigurator.getFeatureMap(), featureKeyList);
162
			FeatureNode imageNode = FeatureNode.NewInstance(Feature.IMAGE());
163
			tree.getRoot().addChild(imageNode);
164
			FeatureNode distributionNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());
165
			tree.getRoot().addChild(distributionNode, 2);
160
			FeatureTree<Feature> tree = TreeCreator.flatTree(featureTreeUuid, bmImportConfigurator.getFeatureMap(), featureKeyList);
161
			tree.getRoot().addChild(Feature.IMAGE());
162
			tree.getRoot().addChild(Feature.DISTRIBUTION(), 2);
166 163
			app.getFeatureTreeService().saveOrUpdate(tree);
167 164
		}
168 165

  
app-import/src/main/java/eu/etaxonomy/cdm/app/berlinModelImport/MTStandardlisteActivator.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
	*/
......
24 24
import eu.etaxonomy.cdm.io.common.Source;
25 25
import eu.etaxonomy.cdm.model.description.Feature;
26 26
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
27
import eu.etaxonomy.cdm.model.term.FeatureNode;
28 27
import eu.etaxonomy.cdm.model.term.FeatureTree;
29 28

  
30 29
public class MTStandardlisteActivator {
31
	
30

  
32 31

  
33 32

  
34 33
	/**
35 34
	 * TODO add the following to a wiki page:
36
	 * HINT: If you are about to import into a mysql data base running under windows and if you wish to dump and restore the resulting data bas under another operation systen 
35
	 * HINT: If you are about to import into a mysql data base running under windows and if you wish to dump and restore the resulting data bas under another operation systen
37 36
	 * you must set the mysql system variable lower_case_table_names = 0 in order to create data base with table compatible names.
38
	 * 
39
	 * 
37
	 *
38
	 *
40 39
	 * @author a.mueller
41 40
	 *
42 41
	 */
......
48 47
		static final Source berlinModelSource = BerlinModelSources.MT_Standardliste();
49 48
		static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_test_mysql_standardliste();
50 49
//		static final ICdmDataSource cdmDestination = CdmDestinations.cdm_mt_standardliste();
51
		
50

  
52 51
		static final UUID treeUuid = UUID.fromString("70549f1a-3d30-42ae-8257-c8367e2703b0");
53 52
		static final int sourceSecId = 7331;
54 53
		static final UUID sourceRefUuid = UUID.fromString("33baaf62-f5c4-4260-aacb-090fe4d24206");
55
		
54

  
56 55
		static final UUID featureTreeUuid = UUID.fromString("2b592057-de3a-4782-a6f3-90a87e2a004d");
57
		static final Object[] featureKeyList = new Integer[]{7,201,202,203,204,205,206,207}; 
58
		
59
		static final boolean includeFlatClassifications = true; 
56
		static final Object[] featureKeyList = new Integer[]{7,201,202,203,204,205,206,207};
57

  
58
		static final boolean includeFlatClassifications = true;
59

  
60 60

  
61
		
62 61
		//check - import
63 62
		static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
64 63

  
65
		
64

  
66 65

  
67 66
		//NomenclaturalCode
68 67
		static final NomenclaturalCode nomenclaturalCode = NomenclaturalCode.ICNAFP;
69 68

  
70 69
	// ****************** ALL *****************************************
71
		
70

  
72 71
		//authors
73 72
		static final boolean doAuthors = true;
74 73
		//references
......
77 76
		static final boolean doTaxonNames = true;
78 77
		static final boolean doRelNames = true;
79 78
		static final boolean doNameStatus = false;
80
		static final boolean doTypes = false;  
81
		static final boolean doNameFacts = false;   
82
		
79
		static final boolean doTypes = false;
80
		static final boolean doNameFacts = false;
81

  
83 82
		//taxa
84 83
		static final boolean doTaxa = true;
85 84
		static final boolean doRelTaxa = true;
......
91 90

  
92 91

  
93 92
	// ************************ NONE **************************************** //
94
		
93

  
95 94
//		//authors
96 95
//		static final boolean doAuthors = false;
97 96
//		//references
......
102 101
//		static final boolean doNameStatus = false;
103 102
//		static final boolean doTypes = false;
104 103
//		static final boolean doNameFacts = false;
105
	//	
104
	//
106 105
//		//taxa
107 106
//		static final boolean doTaxa = false;
108 107
//		static final boolean doRelTaxa = false;
109 108
//		static final boolean doFacts = false;
110 109
//		static final boolean doOccurences = false;
111 110
//		static final boolean doCommonNames = false;
112
		
113
		
111

  
112

  
114 113
		public void invoke(String[] args){
115 114
			System.out.println("Start import from BerlinModel("+ berlinModelSource.getDatabase() + ") ...");
116 115
			logger.debug("Start");
117 116
			//make BerlinModel Source
118 117
			Source source = berlinModelSource;
119 118
			ICdmDataSource destination = CdmDestinations.chooseDestination(args) != null ? CdmDestinations.chooseDestination(args) : cdmDestination;
120
			
119

  
121 120
			BerlinModelImportConfigurator config = BerlinModelImportConfigurator.NewInstance(source,  destination);
122
			
121

  
123 122
			config.setClassificationUuid(treeUuid);
124 123
			config.setSourceSecId(sourceSecId);
125 124
			config.setNomenclaturalCode(nomenclaturalCode);
......
131 130
			config.setDoNameStatus(doNameStatus);
132 131
			config.setDoTypes(doTypes);
133 132
			config.setDoNameFacts(doNameFacts);
134
			
133

  
135 134
			config.setDoTaxa(doTaxa);
136 135
			config.setDoRelTaxa(doRelTaxa);
137 136
			config.setDoFacts(doFacts);
138 137
			config.setDoOccurrence(doOccurences);
139 138
			config.setDoCommonNames(doCommonNames);
140 139
			config.setSourceRefUuid(sourceRefUuid);
141
			
140

  
142 141
			config.setDbSchemaValidation(hbm2dll);
143 142
			config.setIncludeFlatClassifications(includeFlatClassifications);
144 143
			config.setIncludeAllNonMisappliedRelatedClassifications(includeAllNonMisappliedRelatedClassifications);
145 144

  
146 145
			config.setCheck(check);
147
			
146

  
148 147
			// invoke import
149 148
			CdmDefaultImport<BerlinModelImportConfigurator> bmImport = new CdmDefaultImport<BerlinModelImportConfigurator>();
150 149
			bmImport.invoke(config);
151 150

  
152 151
			if (doFacts && (config.getCheck().equals(CHECK.CHECK_AND_IMPORT)  || config.getCheck().equals(CHECK.IMPORT_WITHOUT_CHECK) )   ){
153 152
				ICdmRepository app = bmImport.getCdmAppController();
154
				
153

  
155 154
				//make feature tree
156
				FeatureTree tree = TreeCreator.flatTree(featureTreeUuid, config.getFeatureMap(), featureKeyList);
157
				FeatureNode imageNode = FeatureNode.NewInstance(Feature.IMAGE());
158
				tree.getRoot().addChild(imageNode);
159
				FeatureNode distributionNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());
160
				tree.getRoot().addChild(distributionNode, 2); 
155
				FeatureTree<Feature> tree = TreeCreator.flatTree(featureTreeUuid, config.getFeatureMap(), featureKeyList);
156
				tree.getRoot().addChild(Feature.IMAGE());
157
				tree.getRoot().addChild(Feature.DISTRIBUTION(), 2);
161 158
				app.getFeatureTreeService().saveOrUpdate(tree);
162 159
			}
163
			
164
			
160

  
161

  
165 162
			System.out.println("End import from BerlinModel ("+ source.getDatabase() + ")...");
166 163
		}
167
		
168
		
164

  
165

  
169 166
		/**
170 167
		 * @param args
171 168
		 */
app-import/src/main/java/eu/etaxonomy/cdm/app/berlinModelImport/TreeCreator.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
*/
......
15 15

  
16 16
import org.apache.log4j.Logger;
17 17

  
18
import eu.etaxonomy.cdm.app.berlinModelImport.TreeCreator;
19 18
import eu.etaxonomy.cdm.model.description.Feature;
20 19
import eu.etaxonomy.cdm.model.term.FeatureNode;
21 20
import eu.etaxonomy.cdm.model.term.FeatureTree;
......
23 22
/**
24 23
 * @author a.mueller
25 24
 * @since 03.07.2008
26
 * @version 1.0
27 25
 */
28 26
public class TreeCreator {
29 27
	@SuppressWarnings("unused")
30 28
	private static final Logger logger = Logger.getLogger(TreeCreator.class);
31 29

  
32
	public static FeatureTree flatTree(UUID featureTreeUuid, Map<Integer, Feature> featureMap, Object[] featureKeyList){
33
		FeatureTree result = FeatureTree.NewInstance(featureTreeUuid);
34
		FeatureNode root = result.getRoot();
35
		
30
	public static FeatureTree<Feature> flatTree(UUID featureTreeUuid, Map<Integer, Feature> featureMap, Object[] featureKeyList){
31
		FeatureTree<Feature> result = FeatureTree.NewInstance(featureTreeUuid);
32
		FeatureNode<Feature> root = result.getRoot();
33

  
36 34
		for (Object featureKey : featureKeyList){
37 35
			Feature feature = featureMap.get(featureKey);
38 36
			if (feature != null){
39
				FeatureNode child = FeatureNode.NewInstance(feature);
40
				root.addChild(child);	
37
				root.addChild(feature);
41 38
			}
42 39
		}
43 40
		return result;
44 41
	}
45
	
46
	
42

  
43

  
47 44
	/**
48 45
	 * @param args
49 46
	 */
......
52 49
		map.put(1, Feature.DISTRIBUTION());
53 50
		map.put(2, Feature.ECOLOGY());
54 51

  
55
		Object[] strFeatureList = new Integer[]{1,2}; 
52
		Object[] strFeatureList = new Integer[]{1,2};
56 53

  
57
		FeatureTree tree = TreeCreator.flatTree(UUID.randomUUID(), map, strFeatureList);
54
		FeatureTree<Feature> tree = TreeCreator.flatTree(UUID.randomUUID(), map, strFeatureList);
58 55
		System.out.println(tree.getRootChildren());
59 56
	}
60 57
}
app-import/src/main/java/eu/etaxonomy/cdm/app/cuba/CubaActivator.java
226 226
		return result;
227 227
	}
228 228

  
229
	private FeatureTree makeFeatureNodes(ITermService service){
229
	private FeatureTree<Feature> makeFeatureNodes(ITermService service){
230 230
//		CyprusTransformer transformer = new CyprusTransformer();
231 231

  
232
		FeatureTree result = FeatureTree.NewInstance(featureTreeUuid);
232
		FeatureTree<Feature> result = FeatureTree.NewInstance(featureTreeUuid);
233 233
		result.setTitleCache("Cuba Feature Tree", true);
234
		FeatureNode root = result.getRoot();
235
		FeatureNode newNode;
234
		FeatureNode<Feature> root = result.getRoot();
236 235

  
237
		newNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());
238
		root.addChild(newNode);
236
		root.addChild(Feature.DISTRIBUTION());
239 237

  
240 238
//		Feature featurAltFam = (Feature)service.find(CubaTransformer.uuidAlternativeFamily);
241
//		newNode = FeatureNode.NewInstance(featurAltFam);
242
//		root.addChild(newNode);
239
//		root.addChild(featurAltFam);
243 240

  
244 241
	    Feature featurAltFam2 = (Feature)service.find(CubaTransformer.uuidAlternativeFamily2);
245
	    newNode = FeatureNode.NewInstance(featurAltFam2);
246
	    root.addChild(newNode);
242
	    root.addChild(featurAltFam2);
247 243

  
248 244
		return result;
249 245
	}
app-import/src/main/java/eu/etaxonomy/cdm/app/cyprus/CyprusActivator.java
115 115
		return result;
116 116
	}
117 117

  
118
	private FeatureTree makeFeatureNodes(ITermService service){
118
	private FeatureTree<Feature> makeFeatureNodes(ITermService service){
119 119
		CyprusTransformer transformer = new CyprusTransformer();
120 120

  
121
		FeatureTree result = FeatureTree.NewInstance(featureTreeUuid);
121
		FeatureTree<Feature> result = FeatureTree.NewInstance(featureTreeUuid);
122 122
		result.setTitleCache("Cyprus Feature Tree", true);
123
		FeatureNode root = result.getRoot();
124
		FeatureNode newNode;
123
		FeatureNode<Feature> root = result.getRoot();
125 124

  
126
		newNode = FeatureNode.NewInstance(Feature.STATUS());
127
		root.addChild(newNode);
125
		root.addChild(Feature.STATUS());
128 126

  
129
		newNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());
130
		root.addChild(newNode);
127
		root.addChild(Feature.DISTRIBUTION());
131 128

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

  
135 131
		//user defined features
136 132
		String [] featureList = new String[]{"Red Book", "Endemism"};
......
163 159
		}
164 160
	}
165 161

  
166
	public void addFeataureNodesByStringList(String[] featureStringList, FeatureNode root, IInputTransformer transformer, ITermService termService){
162
	public void addFeataureNodesByStringList(String[] featureStringList, FeatureNode<Feature> root, IInputTransformer transformer, ITermService termService){
167 163
		try {
168 164
			for (String featureString : featureStringList){
169 165
			UUID featureUuid;
170 166
			featureUuid = transformer.getFeatureUuid(featureString);
171 167
			Feature feature = (Feature)termService.find(featureUuid);
172 168
			if (feature != null){
173
				FeatureNode child = FeatureNode.NewInstance(feature);
174
				root.addChild(child);
169
				root.addChild(feature);
175 170
			}
176 171
		}
177 172
		} catch (UndefinedTransformerMethodException e) {
app-import/src/main/java/eu/etaxonomy/cdm/app/edaphobase/EdaphobaseActivator.java
92 92
        CdmDefaultImport<EdaphobaseImportConfigurator> myImport = new CdmDefaultImport<>();
93 93
        myImport.invoke(config);
94 94

  
95
        FeatureTree tree = makeFeatureNodes(myImport.getCdmAppController().getTermService());
95
        FeatureTree<Feature> tree = makeFeatureNodes(myImport.getCdmAppController().getTermService());
96 96
        myImport.getCdmAppController().getFeatureTreeService().saveOrUpdate(tree);
97 97
    }
98 98

  
99
    private FeatureTree makeFeatureNodes(ITermService service){
99
    private FeatureTree<Feature> makeFeatureNodes(ITermService service){
100 100

  
101
        FeatureTree result = FeatureTree.NewInstance(featureTreeUuid);
101
        FeatureTree<Feature> result = FeatureTree.NewInstance(featureTreeUuid);
102 102
        result.setTitleCache(featureTreeTitle, true);
103
        FeatureNode root = result.getRoot();
104
        FeatureNode newNode;
103
        FeatureNode<Feature> root = result.getRoot();
105 104

  
106 105
        Feature distributionFeature = (Feature)service.find(Feature.DISTRIBUTION().getUuid());
107
        newNode = FeatureNode.NewInstance(distributionFeature);
108
        root.addChild(newNode);
106
        root.addChild(distributionFeature);
109 107

  
110 108
        return result;
111 109
    }
app-import/src/main/java/eu/etaxonomy/cdm/app/mexico/MexicoConabioActivator.java
36 36
/**
37 37
 * @author a.mueller
38 38
 * @since 16.06.2016
39
 *
40 39
 */
41 40
public class MexicoConabioActivator {
42 41
    private static final Logger logger = Logger.getLogger(MexicoConabioActivator.class);
......
92 91
        myImport.invoke(config);
93 92

  
94 93
        if (true){
95
            FeatureTree tree = makeFeatureNodes(myImport.getCdmAppController());
94
            FeatureTree<Feature> tree = makeFeatureNodes(myImport.getCdmAppController());
96 95
            myImport.getCdmAppController().getFeatureTreeService().saveOrUpdate(tree);
97 96
        }
98 97

  
......
128 127
        return result;
129 128
    }
130 129

  
131
    private FeatureTree makeFeatureNodes(ICdmRepository app){
130
    private FeatureTree<Feature> makeFeatureNodes(ICdmRepository app){
132 131

  
133
        FeatureTree result = FeatureTree.NewInstance(featureTreeUuid);
132
        FeatureTree<Feature> result = FeatureTree.NewInstance(featureTreeUuid);
134 133
        result.setTitleCache("Mexico Rubiaceae Feature Tree", true);
135
        FeatureNode root = result.getRoot();
136
        FeatureNode newNode;
134
        FeatureNode<Feature> root = result.getRoot();
137 135

  
138 136
        Feature distribution = Feature.DISTRIBUTION();
139 137
        Representation rep = Representation.NewInstance("Distribución", "Distribución", null, Language.SPANISH_CASTILIAN());
140 138
        distribution.addRepresentation(rep);
141 139
        app.getTermService().saveOrUpdate(distribution);
142
        newNode = FeatureNode.NewInstance(distribution);
143
        root.addChild(newNode);
140
        root.addChild(distribution);
144 141

  
145 142
        Feature commonName = Feature.COMMON_NAME();
146 143
        rep = Representation.NewInstance("Nombres comunes", "Nombres comunes", null, Language.SPANISH_CASTILIAN());
147 144
        commonName.addRepresentation(rep);
148 145
        app.getTermService().saveOrUpdate(commonName);
149
        newNode = FeatureNode.NewInstance(commonName);
150
        root.addChild(newNode);
146
        root.addChild(commonName);
151 147

  
152 148
        Feature notes = Feature.NOTES();
153 149
        rep = Representation.NewInstance("Notas", "Notas", null, Language.SPANISH_CASTILIAN());
154 150
        notes.addRepresentation(rep);
155 151
        app.getTermService().saveOrUpdate(notes);
156
        newNode = FeatureNode.NewInstance(notes);
157
        root.addChild(newNode);
152
        root.addChild(notes);
158 153

  
159 154
        return result;
160 155
    }
app-import/src/main/java/eu/etaxonomy/cdm/app/vibrant/EuroMedActivatorVibrant.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
*/
......
32 32
import eu.etaxonomy.cdm.model.description.Feature;
33 33
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
34 34
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
35
import eu.etaxonomy.cdm.model.term.FeatureNode;
36 35
import eu.etaxonomy.cdm.model.term.FeatureTree;
37 36

  
38 37

  
39 38
/**
40 39
 * TODO add the following to a wiki page:
41
 * HINT: If you are about to import into a mysql data base running under windows and if you wish to dump and restore the resulting data bas under another operation systen 
40
 * HINT: If you are about to import into a mysql data base running under windows and if you wish to dump and restore the resulting data bas under another operation systen
42 41
 * you must set the mysql system variable lower_case_table_names = 0 in order to create data base with table compatible names.
43
 * 
44
 * 
42
 *
43
 *
45 44
 * @author a.mueller
46 45
 *
47 46
 */
......
52 51
	static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
53 52
//	static final Source berlinModelSource = BerlinModelSources.euroMed();
54 53
	static final Source berlinModelSource = BerlinModelSources.euroMed_PESI3();
55
	
54

  
56 55
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_pesi_euroMed();
57 56
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql();
58 57
	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_test_mysql();
59
	
58

  
60 59
	static final boolean includePesiExport = false;
61
	
60

  
62 61
	static final int sourceSecId = 7000000; //500000
63 62
	static final UUID classificationUuid = UUID.fromString("5e05ebc5-6075-45ff-81df-4cefafafa4a3");
64 63
	static final boolean useSingleClassification = true;
65
	
64

  
66 65
	//from PESI-transformer
67 66
	static UUID uuidSourceRefEuroMed = UUID.fromString("0603a84a-f024-4454-ab92-9e2ac0139126");
68
	
67

  
69 68
	static final UUID featureTreeUuid = UUID.fromString("eff345e7-0619-4ec3-955d-997c1fafffc3");
70
	static final Object[] featureKeyList = new Integer[]{1, 31, 4, 98, 41}; 	
71
	
69
	static final Object[] featureKeyList = new Integer[]{1, 31, 4, 98, 41};
70

  
72 71
	// set to zero for unlimited nameFacts
73 72
	static final int maximumNumberOfNameFacts = 0;
74
	
73

  
75 74
	static final int partitionSize = 2500;
76
	
75

  
77 76
	//check - import
78 77
	static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
79 78

  
80 79
	//editor - import
81 80
	static final EDITOR editor = EDITOR.EDITOR_AS_EDITOR;
82
	
81

  
83 82
	//NomenclaturalCode
84 83
	static final NomenclaturalCode nomenclaturalCode = NomenclaturalCode.ICNAFP;
85 84

  
86 85
	//ignore null
87 86
	static final boolean ignoreNull = true;
88
	
87

  
89 88
	static final boolean switchSpeciesGroup = true;
90
	
89

  
91 90
	static boolean useClassification = true;
92
	
93
	
91

  
92

  
94 93
	static String taxonTable = "v_cdm_exp_taxaAll";
95
	static String classificationQuery = " SELECT DISTINCT t.PTRefFk, r.RefCache FROM PTaxon t INNER JOIN Reference r ON t.PTRefFk = r.RefId WHERE t.PTRefFk = " + sourceSecId; 
96
	static String relPTaxonIdQuery = " SELECT r.RelPTaxonId " + 
94
	static String classificationQuery = " SELECT DISTINCT t.PTRefFk, r.RefCache FROM PTaxon t INNER JOIN Reference r ON t.PTRefFk = r.RefId WHERE t.PTRefFk = " + sourceSecId;
95
	static String relPTaxonIdQuery = " SELECT r.RelPTaxonId " +
97 96
					" FROM RelPTaxon AS r INNER JOIN v_cdm_exp_taxaDirect AS a ON r.PTNameFk2 = a.PTNameFk AND r.PTRefFk2 = a.PTRefFk ";
98 97
	static String nameIdTable = " v_cdm_exp_namesAll ";
99 98
	static String referenceIdTable = " v_cdm_exp_refAll ";
100 99
	static String factFilter = " factId IN ( SELECT factId FROM v_cdm_exp_factsAll )";
101 100
	static String occurrenceFilter = " occurrenceId IN ( SELECT occurrenceId FROM v_cdm_exp_occurrenceAll )";
102
	static String occurrenceSourceFilter = " occurrenceFk IN ( SELECT occurrenceId FROM v_cdm_exp_occurrenceAll )"; 
101
	static String occurrenceSourceFilter = " occurrenceFk IN ( SELECT occurrenceId FROM v_cdm_exp_occurrenceAll )";
103 102
	static String commonNameFilter = " commonNameId IN ( SELECT commonNameId FROM v_cdm_exp_commonNamesAll )";
104 103
	static String webMarkerFilter = " TableNameFk <> 500 OR ( RIdentifierFk IN (SELECT RIdentifier FROM v_cdm_exp_taxaAll)) ";
105 104
	static String authorTeamFilter = null; // " authorTeamId IN (SELECT authorTeamId FROM v_cdm_exp_authorTeamsAll) ";
106
	static String authorFilter = null;  // " authorId IN (SELECT authorId FROM v_cdm_exp_authorsAll) "; 
107
	
105
	static String authorFilter = null;  // " authorId IN (SELECT authorId FROM v_cdm_exp_authorsAll) ";
106

  
108 107

  
109
	
110
// **************** ALL *********************	
108

  
109
// **************** ALL *********************
111 110

  
112 111
	static final boolean doUser = true;
113 112
	//authors
......
119 118
	static final boolean doRelNames = true;
120 119
	static final boolean doNameStatus = true;
121 120
	static final boolean doNameFacts = true;
122
	
121

  
123 122
	//taxa
124 123
	static final boolean doTaxa = true;
125 124
	static final boolean doRelTaxa = true;
......
128 127
	static final boolean doCommonNames = false;  //currently creates errors
129 128

  
130 129

  
131
	
130

  
132 131
// **************** SELECTED *********************
133 132

  
134 133
//	static final boolean doUser = true;
......
142 141
//	static final boolean doNameStatus = false;
143 142
//	static final boolean doTypes = false;
144 143
//	static final boolean doNameFacts = false;
145
//	
146
//	//taxa 
144
//
145
//	//taxa
147 146
//	static final boolean doTaxa = false;
148 147
//	static final boolean doRelTaxa = false;
149 148
//	static final boolean doFacts = false;
150 149
//	static final boolean doOccurences = false;
151 150
//	static final boolean doCommonNames = false;
152
//	
151
//
153 152
//	//etc.
154 153
//	static final boolean doMarker = false;
155 154

  
156 155
	//always false
157
	static final boolean doTypes = false;  
156
	static final boolean doTypes = false;
158 157
	static final boolean doMarker = false;
159 158

  
160
	
159

  
161 160
	public void importEm2CDM (Source source, ICdmDataSource destination, DbSchemaValidation hbm2dll){
162 161
		System.out.println("Start import from BerlinModel("+ source.getDatabase() + ") to " + destination.getDatabase() + " ...");
163 162
		//make BerlinModel Source
164
		
163

  
165 164
		logger.warn("REMIND: Set publishFlag = 1 filter in 'v_cdm_exp_taxaDirect' view !! ");
166
		
165

  
167 166
		BerlinModelImportConfigurator config = BerlinModelImportConfigurator.NewInstance(source,  destination);
168
		
167

  
169 168
		config.setClassificationUuid(classificationUuid);
170 169
		config.setSourceSecId(sourceSecId);
171
		
170

  
172 171
		config.setNomenclaturalCode(nomenclaturalCode);
173 172

  
174 173
		try {
......
178 177
			e.printStackTrace();
179 178
			return;
180 179
		}
181
		
182
		
180

  
181

  
183 182
		config.setIgnoreNull(ignoreNull);
184 183
		config.setDoAuthors(doAuthors);
185 184
		config.setDoReferences(doReferences);
......
190 189
		config.setDoNameFacts(doNameFacts);
191 190
		config.setUseClassification(useClassification);
192 191
		config.setSourceRefUuid(uuidSourceRefEuroMed);
193
		
192

  
194 193
		config.setDoTaxa(doTaxa);
195 194
		config.setDoRelTaxa(doRelTaxa);
196 195
		config.setDoFacts(doFacts);
197 196
		config.setDoOccurrence(doOccurences);
198 197
		config.setDoCommonNames(doCommonNames);
199
		
198

  
200 199
		config.setDoMarker(doMarker);
201 200
		config.setDoUser(doUser);
202 201
		config.setEditor(editor);
203 202
		config.setDbSchemaValidation(hbm2dll);
204
		
203

  
205 204
		// maximum number of name facts to import
206 205
		config.setMaximumNumberOfNameFacts(maximumNumberOfNameFacts);
207
		
206

  
208 207
//		filter
209 208
		config.setTaxonTable(taxonTable);
210 209
		config.setClassificationQuery(classificationQuery);
......
219 218
		config.setOccurrenceSourceFilter(occurrenceSourceFilter);
220 219
		config.setWebMarkerFilter(webMarkerFilter);
221 220
		config.setUseSingleClassification(useSingleClassification);
222
		
221

  
223 222
		config.setCheck(check);
224 223
		config.setEditor(editor);
225 224
		config.setRecordsPerTransaction(partitionSize);
226
		
225

  
227 226
		config.setSwitchSpeciesGroup(switchSpeciesGroup);
228
		
227

  
229 228
		// invoke import
230 229
		CdmDefaultImport<BerlinModelImportConfigurator> bmImport = new CdmDefaultImport<BerlinModelImportConfigurator>();
231 230
		bmImport.invoke(config);
232
		
231

  
233 232
		if (doFacts && config.getCheck().equals(CHECK.CHECK_AND_IMPORT)  || config.getCheck().equals(CHECK.IMPORT_WITHOUT_CHECK)    ){
234 233
			ICdmRepository app = bmImport.getCdmAppController();
235
			
234

  
236 235
			//make feature tree
237
			FeatureTree tree = TreeCreator.flatTree(featureTreeUuid, config.getFeatureMap(), featureKeyList);
238
			FeatureNode imageNode = FeatureNode.NewInstance(Feature.IMAGE());
239
			tree.getRoot().addChild(imageNode);
240
			FeatureNode distributionNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());
241
			tree.getRoot().addChild(distributionNode, 2); 
236
			FeatureTree<Feature> tree = TreeCreator.flatTree(featureTreeUuid, config.getFeatureMap(), featureKeyList);
237
			tree.getRoot().addChild(Feature.IMAGE());
238
			tree.getRoot().addChild(Feature.DISTRIBUTION(), 2);
242 239
			app.getFeatureTreeService().saveOrUpdate(tree);
243 240
		}
244
		
241

  
245 242
		System.out.println("End import from BerlinModel ("+ source.getDatabase() + ")...");
246 243

  
247 244
		logger.warn("REMIND: Set publishFlag back to <= 1  in 'v_cdm_exp_taxaDirect' view !! ");
248 245

  
249
		
246

  
250 247
	}
251
	
248

  
252 249
	/**
253 250
	 * @param args
254 251
	 */
......
256 253
		EuroMedActivatorVibrant importActivator = new EuroMedActivatorVibrant();
257 254
		Source source = berlinModelSource;
258 255
		ICdmDataSource cdmRepository = CdmDestinations.chooseDestination(args) != null ? CdmDestinations.chooseDestination(args) : cdmDestination;
259
		
256

  
260 257
		importActivator.importEm2CDM(source, cdmRepository, hbm2dll);
261 258
	}
262
	
259

  
263 260
	private static final String URLbase = "http://ww2.bgbm.org/EuroPlusMed/PTaxonDetail.asp?";
264 261
	public static Method makeUrlForTaxon(TaxonBase<?> taxon, ResultSet rs){
265 262
		Method result = null;
......
277 274
		} catch (SQLException e) {
278 275
			logger.warn("Exception when trying to access result set for url creation.");
279 276
		}
280
		
277

  
281 278
		return result;
282 279
	}
283 280

  
app-import/src/main/java/eu/etaxonomy/cdm/app/vibrant/EuroMedVibrantActivator.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
*/
......
32 32
import eu.etaxonomy.cdm.model.description.Feature;
33 33
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
34 34
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
35
import eu.etaxonomy.cdm.model.term.FeatureNode;
36 35
import eu.etaxonomy.cdm.model.term.FeatureTree;
37 36

  
38 37

  
39 38
/**
40 39
 * TODO add the following to a wiki page:
41
 * HINT: If you are about to import into a mysql data base running under windows and if you wish to dump and restore the resulting data bas under another operation systen 
40
 * HINT: If you are about to import into a mysql data base running under windows and if you wish to dump and restore the resulting data bas under another operation systen
42 41
 * you must set the mysql system variable lower_case_table_names = 0 in order to create data base with table compatible names.
43
 * 
44
 * 
42
 *
43
 *
45 44
 * @author a.mueller
46 45
 *
47 46
 */
......
52 51
	static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
53 52
//	static final Source berlinModelSource = BerlinModelSources.euroMed();
54 53
	static final Source berlinModelSource = BerlinModelSources.euroMed_PESI3();
55
	
54

  
56 55
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_pesi_euroMed();
57 56
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql();
58 57
	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_test_mysql();
59
	
58

  
60 59
	static final boolean includePesiExport = false;
61
	
60

  
62 61
	static final int sourceSecId = 7000000; //500000
63 62
	static final UUID classificationUuid = UUID.fromString("5e05ebc5-6075-45ff-81df-4cefafafa4a3");
64 63
	static final boolean useSingleClassification = true;
65
	
64

  
66 65
	//from PESI-transformer
67 66
	static UUID uuidSourceRefEuroMed = UUID.fromString("0603a84a-f024-4454-ab92-9e2ac0139126");
68
	
67

  
69 68
	static final UUID featureTreeUuid = UUID.fromString("eff345e7-0619-4ec3-955d-997c1fafffc3");
70
	static final Object[] featureKeyList = new Integer[]{1, 31, 4, 98, 41}; 	
71
	
69
	static final Object[] featureKeyList = new Integer[]{1, 31, 4, 98, 41};
70

  
72 71
	// set to zero for unlimited nameFacts
73 72
	static final int maximumNumberOfNameFacts = 0;
74
	
73

  
75 74
	static final int partitionSize = 2500;
76
	
75

  
77 76
	//check - import
78 77
	static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
79 78

  
80 79
	//editor - import
81 80
	static final EDITOR editor = EDITOR.EDITOR_AS_EDITOR;
82
	
81

  
83 82
	//NomenclaturalCode
84 83
	static final NomenclaturalCode nomenclaturalCode = NomenclaturalCode.ICNAFP;
85 84

  
86 85
	//ignore null
87 86
	static final boolean ignoreNull = true;
88
	
87

  
89 88
	static final boolean switchSpeciesGroup = true;
90
	
89

  
91 90
	static boolean useClassification = true;
92
	
93
	
91

  
92

  
94 93
	static String taxonTable = "v_cdm_exp_taxaAll";
95
	static String classificationQuery = " SELECT DISTINCT t.PTRefFk, r.RefCache FROM PTaxon t INNER JOIN Reference r ON t.PTRefFk = r.RefId WHERE t.PTRefFk = " + sourceSecId; 
96
	static String relPTaxonIdQuery = " SELECT r.RelPTaxonId " + 
94
	static String classificationQuery = " SELECT DISTINCT t.PTRefFk, r.RefCache FROM PTaxon t INNER JOIN Reference r ON t.PTRefFk = r.RefId WHERE t.PTRefFk = " + sourceSecId;
95
	static String relPTaxonIdQuery = " SELECT r.RelPTaxonId " +
97 96
					" FROM RelPTaxon AS r INNER JOIN v_cdm_exp_taxaDirect AS a ON r.PTNameFk2 = a.PTNameFk AND r.PTRefFk2 = a.PTRefFk ";
98 97
	static String nameIdTable = " v_cdm_exp_namesAll ";
99 98
	static String referenceIdTable = " v_cdm_exp_refAll ";
100 99
	static String factFilter = " factId IN ( SELECT factId FROM v_cdm_exp_factsAll )";
101 100
	static String occurrenceFilter = " occurrenceId IN ( SELECT occurrenceId FROM v_cdm_exp_occurrenceAll )";
102
	static String occurrenceSourceFilter = " occurrenceFk IN ( SELECT occurrenceId FROM v_cdm_exp_occurrenceAll )"; 
101
	static String occurrenceSourceFilter = " occurrenceFk IN ( SELECT occurrenceId FROM v_cdm_exp_occurrenceAll )";
103 102
	static String commonNameFilter = " commonNameId IN ( SELECT commonNameId FROM v_cdm_exp_commonNamesAll )";
104 103
	static String webMarkerFilter = " TableNameFk <> 500 OR ( RIdentifierFk IN (SELECT RIdentifier FROM v_cdm_exp_taxaAll)) ";
105 104
	static String authorTeamFilter = null; // " authorTeamId IN (SELECT authorTeamId FROM v_cdm_exp_authorTeamsAll) ";
106
	static String authorFilter = null;  // " authorId IN (SELECT authorId FROM v_cdm_exp_authorsAll) "; 
107
	
105
	static String authorFilter = null;  // " authorId IN (SELECT authorId FROM v_cdm_exp_authorsAll) ";
106

  
108 107

  
109
	
110
// **************** ALL *********************	
108

  
109
// **************** ALL *********************
111 110

  
112 111
	static final boolean doUser = true;
113 112
	//authors
......
119 118
	static final boolean doRelNames = true;
120 119
	static final boolean doNameStatus = true;
121 120
	static final boolean doNameFacts = true;
122
	
121

  
123 122
	//taxa
124 123
	static final boolean doTaxa = true;
125 124
	static final boolean doRelTaxa = true;
......
128 127
	static final boolean doCommonNames = false;  //currently creates errors
129 128

  
130 129

  
131
	
130

  
132 131
// **************** SELECTED *********************
133 132

  
134 133
//	static final boolean doUser = true;
......
142 141
//	static final boolean doNameStatus = false;
143 142
//	static final boolean doTypes = false;
144 143
//	static final boolean doNameFacts = false;
145
//	
146
//	//taxa 
144
//
145
//	//taxa
147 146
//	static final boolean doTaxa = false;
148 147
//	static final boolean doRelTaxa = false;
149 148
//	static final boolean doFacts = false;
150 149
//	static final boolean doOccurences = false;
151 150
//	static final boolean doCommonNames = false;
152
//	
151
//
153 152
//	//etc.
154 153
//	static final boolean doMarker = false;
155 154

  
156 155
	//always false
157
	static final boolean doTypes = false;  
156
	static final boolean doTypes = false;
158 157
	static final boolean doMarker = false;
159 158

  
160
	
159

  
161 160
	public void importEm2CDM (Source source, ICdmDataSource destination, DbSchemaValidation hbm2dll){
162 161
		System.out.println("Start import from BerlinModel("+ source.getDatabase() + ") to " + destination.getDatabase() + " ...");
163 162
		//make BerlinModel Source
164
		
163

  
165 164
		logger.warn("REMIND: Set publishFlag = 1 filter in 'v_cdm_exp_taxaDirect' view !! ");
166
		
165

  
167 166
		BerlinModelImportConfigurator config = BerlinModelImportConfigurator.NewInstance(source,  destination);
168
		
167

  
169 168
		config.setClassificationUuid(classificationUuid);
170 169
		config.setSourceSecId(sourceSecId);
171
		
170

  
172 171
		config.setNomenclaturalCode(nomenclaturalCode);
173 172

  
174 173
		try {
......
178 177
			e.printStackTrace();
179 178
			return;
180 179
		}
181
		
182
		
180

  
181

  
183 182
		config.setIgnoreNull(ignoreNull);
184 183
		config.setDoAuthors(doAuthors);
185 184
		config.setDoReferences(doReferences);
......
190 189
		config.setDoNameFacts(doNameFacts);
191 190
		config.setUseClassification(useClassification);
192 191
		config.setSourceRefUuid(uuidSourceRefEuroMed);
193
		
192

  
194 193
		config.setDoTaxa(doTaxa);
195 194
		config.setDoRelTaxa(doRelTaxa);
196 195
		config.setDoFacts(doFacts);
197 196
		config.setDoOccurrence(doOccurences);
198 197
		config.setDoCommonNames(doCommonNames);
199
		
198

  
200 199
		config.setDoMarker(doMarker);
201 200
		config.setDoUser(doUser);
202 201
		config.setEditor(editor);
203 202
		config.setDbSchemaValidation(hbm2dll);
204
		
203

  
205 204
		// maximum number of name facts to import
206 205
		config.setMaximumNumberOfNameFacts(maximumNumberOfNameFacts);
207
		
206

  
208 207
//		filter
209 208
		config.setTaxonTable(taxonTable);
210 209
		config.setClassificationQuery(classificationQuery);
......
219 218
		config.setOccurrenceSourceFilter(occurrenceSourceFilter);
220 219
		config.setWebMarkerFilter(webMarkerFilter);
221 220
		config.setUseSingleClassification(useSingleClassification);
222
		
221

  
223 222
		config.setCheck(check);
224 223
		config.setEditor(editor);
225 224
		config.setRecordsPerTransaction(partitionSize);
226
		
225

  
227 226
		config.setSwitchSpeciesGroup(switchSpeciesGroup);
228
		
227

  
229 228
		// invoke import
230 229
		CdmDefaultImport<BerlinModelImportConfigurator> bmImport = new CdmDefaultImport<BerlinModelImportConfigurator>();
231 230
		bmImport.invoke(config);
232
		
231

  
233 232
		if (doFacts && config.getCheck().equals(CHECK.CHECK_AND_IMPORT)  || config.getCheck().equals(CHECK.IMPORT_WITHOUT_CHECK)    ){
234 233
			ICdmRepository app = bmImport.getCdmAppController();
235
			
234

  
236 235
			//make feature tree
237
			FeatureTree tree = TreeCreator.flatTree(featureTreeUuid, config.getFeatureMap(), featureKeyList);
238
			FeatureNode imageNode = FeatureNode.NewInstance(Feature.IMAGE());
239
			tree.getRoot().addChild(imageNode);
240
			FeatureNode distributionNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());
241
			tree.getRoot().addChild(distributionNode, 2); 
236
			FeatureTree<Feature> tree = TreeCreator.flatTree(featureTreeUuid, config.getFeatureMap(), featureKeyList);
237
			tree.getRoot().addChild(Feature.IMAGE());
238
			tree.getRoot().addChild(Feature.DISTRIBUTION(), 2);
242 239
			app.getFeatureTreeService().saveOrUpdate(tree);
243 240
		}
244
		
241

  
245 242
		System.out.println("End import from BerlinModel ("+ source.getDatabase() + ")...");
246 243

  
247 244
		logger.warn("REMIND: Set publishFlag back to <= 1  in 'v_cdm_exp_taxaDirect' view !! ");
248 245

  
249
		
246

  
250 247
	}
251
	
248

  
252 249
	/**
253 250
	 * @param args
254 251
	 */
......
256 253
		EuroMedVibrantActivator importActivator = new EuroMedVibrantActivator();
257 254
		Source source = berlinModelSource;
258 255
		ICdmDataSource cdmRepository = CdmDestinations.chooseDestination(args) != null ? CdmDestinations.chooseDestination(args) : cdmDestination;
259
		
256

  
260 257
		importActivator.importEm2CDM(source, cdmRepository, hbm2dll);
261 258
	}
262
	
259

  
263 260
	private static final String URLbase = "http://ww2.bgbm.org/EuroPlusMed/PTaxonDetail.asp?";
264 261
	public static Method makeUrlForTaxon(TaxonBase<?> taxon, ResultSet rs){
265 262
		Method result = null;
......
277 274
		} catch (SQLException e) {
278 275
			logger.warn("Exception when trying to access result set for url creation.");
279 276
		}
280
		
277

  
281 278
		return result;
282 279
	}
283 280

  
app-import/src/main/java/eu/etaxonomy/cdm/app/wp6/cichorieae/CichorieaeActivator.java
36 36
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
37 37
import eu.etaxonomy.cdm.model.name.TaxonName;
38 38
import eu.etaxonomy.cdm.model.reference.ISourceable;
39
import eu.etaxonomy.cdm.model.term.FeatureNode;
40 39
import eu.etaxonomy.cdm.model.term.FeatureTree;
41 40

  
42 41

  
......
224 223
			logger.info(obj);
225 224

  
226 225
			//make feature tree
227
			FeatureTree tree = TreeCreator.flatTree(featureTreeUuid, bmImportConfigurator.getFeatureMap(), featureKeyList);
228
			FeatureNode imageNode = FeatureNode.NewInstance(Feature.IMAGE());
229
			tree.getRoot().addChild(imageNode);
230
			FeatureNode distributionNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());
231
			tree.getRoot().addChild(distributionNode, 2);
226
			FeatureTree<Feature> tree = TreeCreator.flatTree(featureTreeUuid, bmImportConfigurator.getFeatureMap(), featureKeyList);
227
			tree.getRoot().addChild(Feature.IMAGE());
228
			tree.getRoot().addChild(Feature.DISTRIBUTION(), 2);
232 229
			app.getFeatureTreeService().saveOrUpdate(tree);
233 230
		}
234 231

  
app-import/src/main/java/eu/etaxonomy/cdm/app/wp6/diptera/DipteraActivator.java
12 12
import java.lang.reflect.Method;
13 13
import java.util.UUID;
14 14

  
15
import org.apache.commons.lang3.StringUtils;
15 16
import org.apache.log4j.Logger;
16 17

  
17 18
import eu.etaxonomy.cdm.api.application.ICdmRepository;
18 19
import eu.etaxonomy.cdm.app.berlinModelImport.BerlinModelSources;
19 20
import eu.etaxonomy.cdm.app.berlinModelImport.TreeCreator;
20 21
import eu.etaxonomy.cdm.app.common.CdmDestinations;
21
import eu.etaxonomy.cdm.common.CdmUtils;
22 22
import eu.etaxonomy.cdm.database.DbSchemaValidation;
23 23
import eu.etaxonomy.cdm.database.ICdmDataSource;
24 24
import eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportConfigurator;
......
32 32
import eu.etaxonomy.cdm.model.description.Feature;
33 33
import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus;
34 34
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
35
import eu.etaxonomy.cdm.model.term.FeatureNode;
36 35
import eu.etaxonomy.cdm.model.term.FeatureTree;
37 36

  
38 37

  
......
195 194
			}
196 195
			//make feature tree
197 196
			app = bmImport.getCdmAppController();
198
			FeatureTree tree = TreeCreator.flatTree(featureTreeUuid, bmImportConfigurator.getFeatureMap(), featureKeyList);
197
			FeatureTree<Feature> tree = TreeCreator.flatTree(featureTreeUuid, bmImportConfigurator.getFeatureMap(), featureKeyList);
199 198
			// add image
200
			FeatureNode imageNode = FeatureNode.NewInstance(Feature.IMAGE());
201
			tree.getRoot().addChild(imageNode);
199
			tree.getRoot().addChild(Feature.IMAGE());
202 200
			// add distribution
203
			FeatureNode distributionNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());
204
			tree.getRoot().addChild(distributionNode);
201
			tree.getRoot().addChild(Feature.DISTRIBUTION());
205 202
			app.getFeatureTreeService().saveOrUpdate(tree);
206 203
		}
207 204
		System.out.println("End import from BerlinModel ("+ source.getDatabase() + ")...");
......
223 220
		if (updateCollections){
224 221
			success = updater.updateCollections(destination);
225 222
		}
226

  
227

  
228 223
	}
229 224

  
230 225

  
231

  
232

  
233

  
234 226
	private static NameTypeDesignationStatus nameTypeDesignationStatueMethod(String note){
235
		if (CdmUtils.isEmpty(note)){
227
		if (StringUtils.isBlank(note)){
236 228
			return null;
237 229
		}
238 230
		note = note.trim();
......
250 242
			logger.warn("NameTypeDesignationStatus could not be defined for: " + note);
251 243
			return null;
252 244
		}
253

  
254

  
255 245
	}
256 246

  
257 247
}
app-import/src/main/java/eu/etaxonomy/cdm/app/wp6/palmae/PalmaeActivator.java
122 122
			logger.info("Make feature tree");
123 123
			ICdmRepository app = tcsImport.getCdmAppController();
124 124

  
125
			FeatureTree tree = getFeatureTree();
125
			FeatureTree<Feature> tree = getFeatureTree();
126 126
			app.getFeatureTreeService().saveOrUpdate(tree);
127 127
			System.out.println("End import from TCS ("+ source.toString() + ")...");
128 128

  
......
136 136
	}
137 137

  
138 138

  
139
	private FeatureTree getFeatureTree(){
140

  
141
		FeatureTree result = FeatureTree.NewInstance(featureTreeUuid);
142
		FeatureNode root = result.getRoot();
143

  
144
		FeatureNode newNode;
145
		newNode = FeatureNode.NewInstance(Feature.INTRODUCTION());
146
		root.addChild(newNode);
147
		newNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());
148
		root.addChild(newNode);
149
		newNode = FeatureNode.NewInstance(Feature.BIOLOGY_ECOLOGY());
150
		root.addChild(newNode);
151
		newNode = FeatureNode.NewInstance(Feature.CONSERVATION());
152
		root.addChild(newNode);
153
		newNode = FeatureNode.NewInstance(Feature.COMMON_NAME());
154
		root.addChild(newNode);
155
		newNode = FeatureNode.NewInstance(Feature.ETYMOLOGY());
156
		root.addChild(newNode);
157
		newNode = FeatureNode.NewInstance(Feature.USES());
158
		root.addChild(newNode);
159
		newNode = FeatureNode.NewInstance(Feature.CULTIVATION());
160
		root.addChild(newNode);
161
		newNode = FeatureNode.NewInstance(Feature.DISCUSSION());
162
		root.addChild(newNode);
163
		newNode = FeatureNode.NewInstance(Feature.DIAGNOSIS());
164
		root.addChild(newNode);
165
		newNode = FeatureNode.NewInstance(Feature.DESCRIPTION());
166
		root.addChild(newNode);
167
		newNode = FeatureNode.NewInstance(Feature.MATERIALS_EXAMINED());
168
		root.addChild(newNode);
169
		newNode = FeatureNode.NewInstance(Feature.ANATOMY());
170
		root.addChild(newNode);
139
	private FeatureTree<Feature> getFeatureTree(){
140

  
141
		FeatureTree<Feature> result = FeatureTree.NewInstance(featureTreeUuid);
142
		FeatureNode<Feature> root = result.getRoot();
143

  
144
		root.addChild(Feature.INTRODUCTION());
145
		root.addChild(Feature.DISTRIBUTION());
146
		root.addChild(Feature.BIOLOGY_ECOLOGY());
147
		root.addChild(Feature.CONSERVATION());
148
		root.addChild(Feature.COMMON_NAME());
149
		root.addChild(Feature.ETYMOLOGY());
150
		root.addChild(Feature.USES());
151
		root.addChild(Feature.CULTIVATION());
152
		root.addChild(Feature.DISCUSSION());
153
		root.addChild(Feature.DIAGNOSIS());
154
		root.addChild(Feature.DESCRIPTION());
155
		root.addChild(Feature.MATERIALS_EXAMINED());
156
		root.addChild(Feature.ANATOMY());
171 157

  
172 158
		return result;
173 159

  
app-import/src/main/java/eu/etaxonomy/cdm/app/wp6/palmae/PalmaePostImportUpdater.java
55 55

  
56 56
			TransactionStatus tx = cdmApp.startTransaction();
57 57

  
58
			FeatureTree tree = cdmApp.getFeatureTreeService().find(featureTreeUuid);
59
			FeatureNode root = tree.getRoot();
58
			FeatureTree<Feature> tree = cdmApp.getFeatureTreeService().find(featureTreeUuid);
59
			FeatureNode<Feature> root = tree.getRoot();
60 60

  
61 61
			List<Feature> featureList = cdmApp.getTermService().list(Feature.class, null, null, null, null);
62 62
			for (Feature feature : featureList){
63 63
				String label = feature.getLabel();
64 64
				if (relationships.equals(label)){
65
					FeatureNode newNode = FeatureNode.NewInstance(feature);
66
					root.addChild(newNode);
65
					root.addChild(feature);
67 66
					count++;
68 67
				}else if(taxonomicAccounts.equals(label)){
69
					FeatureNode newNode = FeatureNode.NewInstance(feature);
70
					root.addChild(newNode);
68
					root.addChild(feature);
71 69
					count++;
72 70
				}else if(fossilRecord.equals(label)){
73
					FeatureNode newNode = FeatureNode.NewInstance(feature);
74
					root.addChild(newNode);
71
					root.addChild(feature);
75 72
					count++;
76 73
				}
77 74
			}
......
131 128
			}
132 129
			//add citation feature to feature tree
133 130
			UUID featureTreeUuid = PalmaeActivator.featureTreeUuid;
134
			FeatureTree tree = cdmApp.getFeatureTreeService().find(featureTreeUuid);
135
			FeatureNode root = tree.getRoot();
131
			FeatureTree<Feature> tree = cdmApp.getFeatureTreeService().find(featureTreeUuid);
132
			FeatureNode<Feature> root = tree.getRoot();
136 133
			List<Feature> featureList = cdmApp.getTermService().list(Feature.class, null, null, null, null);
137 134
			count = 0;
138 135
			for (Feature feature : featureList){
139 136
				if (feature.equals(Feature.CITATION())){
140
					FeatureNode newNode = FeatureNode.NewInstance(feature);
141
					root.addChild(newNode);
137
					root.addChild(feature);
142 138
					count++;
143 139
				}
144 140
			}
app-import/src/main/java/eu/etaxonomy/cdm/app/wp6/palmae/UseImport.java
65 65
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
66 66
import eu.etaxonomy.cdm.model.term.DefinedTerm;
67 67
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
68
import eu.etaxonomy.cdm.model.term.FeatureNode;
69 68
import eu.etaxonomy.cdm.model.term.FeatureTree;
70 69
import eu.etaxonomy.cdm.model.term.TermType;
71 70
import eu.etaxonomy.cdm.model.term.TermVocabulary;
......
764 763
		}
765 764
		if(featureUseRecord == null|| featureUseSummary == null) {
766 765
			TermVocabulary<Feature> featureVocabulary = vocabularyService.find((UUID.fromString("b187d555-f06f-4d65-9e53-da7c93f8eaa8")));
767
			FeatureTree palmWebFeatureTree = featureTreeService.find(UUID.fromString("72ccce05-7cc8-4dab-8e47-bf3f5fd848a0"));
766
			FeatureTree<Feature> palmWebFeatureTree = featureTreeService.find(UUID.fromString("72ccce05-7cc8-4dab-8e47-bf3f5fd848a0"));
768 767
			//List<FeatureTree> featureTrees = CdmStore.getService(IFeatureTreeService.class).list(FeatureTree.class, null, null, null, null);
769 768

  
770 769
			if (featureUseRecord == null ) {
......
773 772
				featureUseRecord.isSupportsCategoricalData();
774 773
				featureUseRecord.setSupportsCategoricalData(true);
775 774
				featureVocabulary.addTerm(featureUseRecord);
776
				FeatureNode useRecFeatureNode = FeatureNode.NewInstance(featureUseRecord);
777
				palmWebFeatureTree.getRoot().addChild(useRecFeatureNode);
775
				palmWebFeatureTree.getRoot().addChild(featureUseRecord);
778 776
			}
779 777
			if (featureUseSummary == null) {
780 778
				featureUseSummary = Feature.NewInstance("Use", "Use", null);
......
783 781
				featureUseSummary.setSupportsTextData(true);
784 782
				//TermVocabulary<Feature> featureVocabulary = (TermVocabulary<Feature>)CdmStore.getService(IVocabularyService.class).find((UUID.fromString("b187d555-f06f-4d65-9e53-da7c93f8eaa8")));
785 783
				featureVocabulary.addTerm(featureUseSummary);
786
				FeatureNode useSumFeatureNode = FeatureNode.NewInstance(featureUseSummary);
787
				palmWebFeatureTree.getRoot().addChild(useSumFeatureNode);
784
				palmWebFeatureTree.getRoot().addChild(featureUseSummary);
788 785
			}
789 786

  
790 787
			vocabularyService.saveOrUpdate(featureVocabulary);
app-import/src/main/java/eu/etaxonomy/cdm/io/berlinModel/in/BerlinModelFactsImport.java
70 70
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
71 71
import eu.etaxonomy.cdm.model.taxon.Taxon;
72 72
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
73
import eu.etaxonomy.cdm.model.term.FeatureNode;
74 73
import eu.etaxonomy.cdm.model.term.FeatureTree;
75 74
import eu.etaxonomy.cdm.model.term.Representation;
76 75
import eu.etaxonomy.cdm.model.term.TermBase;
......
172 171

  
173 172
				result.put(factCategoryId, feature);
174 173
				if (createFeatureTree && isPublicFeature(factCategoryId)){
175
				    featureTree.getRoot().addChild(FeatureNode.NewInstance(feature));
174
				    featureTree.getRoot().addChild(feature);
176 175
				}
177 176
			}
178 177
			if (createFeatureTree){
179
			    featureTree.getRoot().addChild(FeatureNode.NewInstance(Feature.DISTRIBUTION()),2);
180
                featureTree.getRoot().addChild(FeatureNode.NewInstance(Feature.NOTES()), featureTree.getRoot().getChildCount()-1);
178
			    featureTree.getRoot().addChild(Feature.DISTRIBUTION(),2);
... 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)