Project

General

Profile

« Previous | Next » 

Revision f476ff86

Added by Andreas Müller over 7 years ago

ref #5974 Remove synonym relationship first compiling implementation in cdmlib

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/pilotOutputHtml/PilotOutputDescriptionExporter.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
*/
......
13 13
import java.io.FileOutputStream;
14 14
import java.io.OutputStreamWriter;
15 15
import java.io.PrintWriter;
16
import java.util.HashSet;
17 16
import java.util.List;
18
import java.util.Set;
19 17

  
20 18
import org.apache.log4j.Logger;
21 19
import org.springframework.stereotype.Component;
......
28 26
import eu.etaxonomy.cdm.io.sdd.out.SDDDataSet;
29 27
import eu.etaxonomy.cdm.model.agent.AgentBase;
30 28
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
31
import eu.etaxonomy.cdm.model.common.RelationshipBase;
32 29
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
33 30
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
34 31
import eu.etaxonomy.cdm.model.reference.Reference;
......
51 48

  
52 49
	private String ioName = null;
53 50

  
54
	
51

  
55 52
	/**
56
	 * 
53
	 *
57 54
	 */
58 55
	public PilotOutputDescriptionExporter() {
59 56
		super();
......
63 60
	/** Retrieves data from a CDM DB and serializes them CDM to XML.
64 61
	 * Starts with root taxa and traverses the classification to retrieve children taxa, synonyms and relationships.
65 62
	 * Taxa that are not part of theclassification are not found.
66
	 * 
63
	 *
67 64
	 * @param exImpConfig
68 65
	 * @param dbname
69 66
	 * @param filename
......
72 69
	protected void doInvoke(PilotOutputExportState state){
73 70
//		protected boolean doInvoke(IExportConfigurator config,
74 71
//		Map<String, MapWrapper<? extends CdmBase>> stores) {
75
	
72

  
76 73
		PilotOutputExportConfigurator sddExpConfig = state.getConfig();
77 74
		String dbname = sddExpConfig.getSource().getName();
78 75
    	String fileName = sddExpConfig.getDestinationNameString();
......
114 111
		} catch (Exception e) {
115 112
			logger.error("Marshalling error");
116 113
			e.printStackTrace();
117
		} 
114
		}
118 115
		commitTransaction(txStatus);
119
		
116

  
120 117
		return;
121 118

  
122 119
	}
......
127 124
		PilotOutputExportConfigurator sddExpConfig = (PilotOutputExportConfigurator)config;
128 125
		final int MAX_ROWS = 50000;
129 126
		int numberOfRows = sddExpConfig.getMaxRows();
130
		// TODO: 
127
		// TODO:
131 128
		//CdmApplicationController appCtr = config.getCdmAppController(false, true);
132 129

  
133 130
		int agentRows = numberOfRows;
......
205 202
			}
206 203
		}
207 204

  
208
		// TODO: 
205
		// TODO:
209 206
		// retrieve taxa and synonyms separately
210 207
		// need correct count for taxa and synonyms
211 208
//		if (taxonBaseRows == 0) { taxonBaseRows = getTaxonService().count(TaxonBase.class); }
212 209
//		logger.info("# Synonym: " + taxonBaseRows);
213 210
//		dataSet.setSynonyms(new ArrayList<Synonym>());
214 211
//		dataSet.setSynonyms(getTaxonService().getAllSynonyms(taxonBaseRows, 0));
215

  
216
		if (sddExpConfig.isDoRelTaxa() == true) {
217
			if (relationshipRows == 0) { relationshipRows = MAX_ROWS; }
218
			logger.info("# Relationships");
219
			List<RelationshipBase> relationList = getTaxonService().getAllRelationships(relationshipRows, 0);
220
			Set<RelationshipBase> relationSet = new HashSet<RelationshipBase>(relationList);
221
			sddDataSet.setRelationships(relationSet);
222
		}
212
//
213
//		if (sddExpConfig.isDoRelTaxa() == true) {
214
//			if (relationshipRows == 0) { relationshipRows = MAX_ROWS; }
215
//			logger.info("# Relationships");
216
//			List<RelationshipBase> relationList = getTaxonService().getAllRelationships(relationshipRows, 0);
217
//			Set<RelationshipBase> relationSet = new HashSet<RelationshipBase>(relationList);
218
//			sddDataSet.setRelationships(relationSet);
219
//		}
223 220

  
224 221
		if (sddExpConfig.isDoReferencedEntities() == true) {
225 222
			logger.info("# Referenced Entities");
......
262 259
	protected boolean isIgnore(PilotOutputExportState state) {
263 260
		return false;
264 261
	}
265
	
262

  
266 263
}

Also available in: Unified diff