Project

General

Profile

Revision f476ff86

IDf476ff862017b53219157fee7843e062673bfde6
Parent d5d3fb6e
Child fbeefcaf

Added by Andreas Müller almost 4 years ago

ref #5974 Remove synonym relationship first compiling implementation in cdmlib

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/CdmImportBase.java
16 16
import java.sql.SQLException;
17 17
import java.util.ArrayList;
18 18
import java.util.Arrays;
19
import java.util.HashSet;
20 19
import java.util.List;
21 20
import java.util.Set;
22 21
import java.util.UUID;
......
1221 1220
			return CdmBase.deproxy(taxonBase, Taxon.class);
1222 1221
		}else if(taxonBase.isInstanceOf(Synonym.class)){
1223 1222
			Synonym synonym = CdmBase.deproxy(taxonBase, Synonym.class);
1224
			Set<Taxon> acceptedTaxa = synonym.getAcceptedTaxa();
1225
			if (acceptedTaxa.size() == 0){
1226
				return null;
1227
			}else if (acceptedTaxa.size() == 1){
1228
				return acceptedTaxa.iterator().next();
1229
			}else{
1230
				Reference sec = synonym.getSec();
1231
				if (sec != null){
1232
					Set<Taxon> taxaWithSameSec = new HashSet<Taxon>();
1233
					for (Taxon taxon: acceptedTaxa){
1234
						if (sec.equals(taxon.getSec())){
1235
							taxaWithSameSec.add(taxon);
1236
						}
1237
					}
1238
					if (taxaWithSameSec.size() == 1){
1239
						return taxaWithSameSec.iterator().next();
1240
					}
1241
				}
1242
				throw new IllegalStateException("Can't define the one accepted taxon for a synonym out of multiple accept taxa");
1243
			}
1223
			Taxon acceptedTaxon = synonym.getAcceptedTaxon();
1224
			return acceptedTaxon;
1244 1225
		}else{
1245 1226
			throw new IllegalStateException("Unknown TaxonBase subclass: " + taxonBase.getClass().getName());
1246 1227
		}
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/mapping/DbImportDescriptionElementCreationMapperBase.java
108 108

  
109 109
		}else if (taxonBase instanceof Synonym){
110 110
			Synonym synonym = CdmBase.deproxy(taxonBase, Synonym.class);
111
			Set<Taxon> taxa = synonym.getAcceptedTaxa();
112
			if (taxa.size() == 0){
111
			Taxon accTaxon = synonym.getAcceptedTaxon();
112
			if (accTaxon == null){
113 113
				logger.warn("Synonym '" + synonym.getTitleCache() + "' ("+ taxonFk + ") has no accepted taxon. Can't define a taxon to add the description element to");
114
			}else if (taxa.size() == 1){
115
				taxon = taxa.iterator().next();
116
			}else{
117
				logger.warn("Synonym '" + synonym.getTitleCache() + "' ("+ taxonFk + ") has more than one accepted taxon. Can't decide which one to take");
114
			}else {
115
				taxon = accTaxon;
118 116
			}
119 117
		}else{ //null
120 118
			throw new IllegalStateException("TaxonBase must either be null, Taxon or Synonym but was something else");
......
123 121
	}
124 122

  
125 123

  
126

  
127 124
	/**
128 125
	 * Adds a description element to the taxon's first description which is not an image gallery.
129 126
	 * If no such description exists a new one is generated. Returns the element or, if null if taxon is null.
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/mapping/DbImportImageGalleryMapper.java
1 1
// $Id$
2 2
/**
3 3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
4
* European Distributed Institute of Taxonomy
5 5
* http://www.e-taxonomy.eu
6
* 
6
*
7 7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8 8
* See LICENSE.TXT at the top of this package for the full license terms.
9 9
*/
......
42 42
 */
43 43
public class DbImportImageGalleryMapper extends DbSingleAttributeImportMapperBase<DbImportStateBase<?,?>, Taxon> implements IDbImportMapper<DbImportStateBase<?,?>,Taxon>{
44 44
	private static final Logger logger = Logger.getLogger(DbImportImageGalleryMapper.class);
45
	
45

  
46 46
//************************** FACTORY METHODS ***************************************************************/
47
	
47

  
48 48
	/**
49 49
	 * @param dbAttributeString
50 50
	 * @param uuid
......
56 56
	public static DbImportImageGalleryMapper NewInstance(String dbAttributeString){
57 57
		return new DbImportImageGalleryMapper(dbAttributeString);
58 58
	}
59
	
59

  
60 60
//***************** VARIABLES **********************************************************/
61
	
61

  
62 62

  
63 63
//******************************** CONSTRUCTOR *****************************************************************/
64
	
64

  
65 65
	/**
66 66
	 * @param dbAttributeString
67 67
	 * @param extensionType
......
69 69
	private DbImportImageGalleryMapper(String dbAttributeString) {
70 70
		super(dbAttributeString, dbAttributeString);
71 71
	}
72
	
72

  
73 73
//****************************** METHODS ***************************************************/
74
	
74

  
75 75
	/**
76 76
	 * @param service
77 77
	 * @param state
......
89 89
			//do nothing
90 90
		}
91 91
	}
92
	
92

  
93 93

  
94 94
	/* (non-Javadoc)
95 95
	 * @see eu.etaxonomy.cdm.io.common.mapping.DbSingleAttributeImportMapperBase#invoke(java.sql.ResultSet, eu.etaxonomy.cdm.model.common.CdmBase)
......
98 98
		String dbValue = rs.getString(getSourceAttribute());
99 99
		return invoke(dbValue, taxonBase);
100 100
	}
101
	
101

  
102 102
	/**
103 103
	 * @param dbValue
104 104
	 * @param identifiableEntity
......
112 112
		Taxon taxon;
113 113
		if (taxonBase.isInstanceOf(Synonym.class)){
114 114
			Synonym synonym = taxonBase.deproxy(taxonBase, Synonym.class);
115
			if (synonym.getAcceptedTaxa().size() > 0){
115
			if (synonym.getAcceptedTaxon() != null){
116 116
				logger.warn("Media will be added to a synonyms accepted taxon");
117
				taxon = synonym.getAcceptedTaxa().iterator().next();
117
				taxon = synonym.getAcceptedTaxon();
118 118
			}else{
119 119
				throw new IllegalArgumentException("TaxonBase was of type synonym and does not belong to an accepted taxon");
120 120
			}
121 121
		}else{
122 122
			taxon = taxonBase.deproxy(taxonBase, Taxon.class);
123 123
		}
124
		
124

  
125 125
		TaxonDescription imageGallery = taxon.getImageGallery(createNew);
126 126
		Set<DescriptionElementBase> elements = imageGallery.getElements();
127 127
		DescriptionElementBase element = null;
......
146 146
		element.addMedia(media);
147 147
		return taxon;
148 148
	}
149
	
149

  
150 150
	//not used
151 151
	/* (non-Javadoc)
152 152
	 * @see eu.etaxonomy.cdm.io.common.CdmSingleAttributeMapperBase#getTypeClass()
153 153
	 */
154
	public Class<String> getTypeClass(){
154
	@Override
155
    public Class<String> getTypeClass(){
155 156
		return String.class;
156 157
	}
157 158

  
......
162 163
	public void initialize(DbImportStateBase<?,?> state, Class<? extends CdmBase> destinationClass) {
163 164
		super.importMapperHelper.initialize(state, destinationClass);
164 165
	}
165
	
166

  
166 167

  
167 168
}
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/mapping/DbImportSynonymMapper.java
26 26
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
27 27

  
28 28
/**
29
 * TODO synonyms are no relationships anymore, maybe we need to change something here
29 30
 * @author a.mueller
30 31
 * @created 02.03.2010
31 32
 * @param <CDM_BASE>
......
42 43
	 * @param dbToAttribute
43 44
	 * @param relatedObjectNamespace
44 45
	 * @param relTypeAttribute
45
	 * @param taxonRelationshipType this relationshiptype is taken for accepted taxa being synonyms (may be the case if data are dirty)
46
	 * @param taxonRelationshipType this relationship type is taken for accepted taxa being synonyms (may be the case if data are dirty)
46 47
	 * @return
47 48
	 */
48 49
	public static DbImportSynonymMapper<?> NewInstance(String dbFromAttribute, String dbToAttribute, String relatedObjectNamespace, String relTypeAttribute, TaxonRelationshipType taxonRelationshipType){
......
81 82

  
82 83
//************************************ METHODS *******************************************/
83 84

  
84
	/* (non-Javadoc)
85
	 * @see eu.etaxonomy.cdm.io.common.mapping.IDbImportMapper#invoke(java.sql.ResultSet, eu.etaxonomy.cdm.model.common.CdmBase)
86
	 */
87 85
	@Override
88 86
    public CdmBase invoke(ResultSet rs, CdmBase cdmBase) throws SQLException {
89 87
		STATE state = getState();
......
129 127
		if (fromObject.isInstanceOf(Synonym.class)){
130 128
			SynonymRelationshipType relType = SynonymRelationshipType.SYNONYM_OF();
131 129
			Synonym synonym = CdmBase.deproxy(fromObject, Synonym.class);
132
			taxon.addSynonym(synonym, relType, citation, microCitation);
130
			taxon.addSynonym(synonym, relType); //citation and micro citation not in use anymore as we do not have synonym relationships anymore
133 131
		}else if (fromObject.isInstanceOf(Taxon.class)  && this.useTaxonRelationship){
134 132
			TaxonRelationshipType type = relType;
135 133
			Taxon synonymTaxon = CdmBase.deproxy(fromObject, Taxon.class);
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/csv/caryophyllales/out/CsvNameExport.java
48 48
import eu.etaxonomy.cdm.model.taxon.Classification;
49 49
import eu.etaxonomy.cdm.model.taxon.HomotypicGroupTaxonComparator;
50 50
import eu.etaxonomy.cdm.model.taxon.Synonym;
51
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
52 51
import eu.etaxonomy.cdm.model.taxon.Taxon;
53 52
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
54 53
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
......
583 582
        HomotypicalGroup group;
584 583
        BotanicalName synonymName;
585 584
        String doubtfulTitleCache;
586
        for (SynonymRelationship synRel: taxon.getSynonymRelations()){
587
            synonymName = HibernateProxyHelper.deproxy(synRel.getSynonym().getName(), BotanicalName.class);
585
        for (Synonym synonym: taxon.getSynonyms()){
586
            synonymName = HibernateProxyHelper.deproxy(synonym.getName(), BotanicalName.class);
588 587
            group = HibernateProxyHelper.deproxy(synonymName.getHomotypicalGroup(), HomotypicalGroup.class);
589 588
            synonymName.generateFullTitle();
590
            if (synRel.getSynonym().isDoubtful()){
589
            if (synonym.isDoubtful()){
591 590
                if (!synonymName.getFullTitleCache().startsWith("?")){
592 591
                    doubtfulTitleCache = "?" + synonymName.getFullTitleCache();
593 592
                    synonymName = (BotanicalName) synonymName.clone();
......
596 595
            }
597 596
            if (!group.equals(name.getHomotypicalGroup())){
598 597
                if (heterotypicSynonymsList.containsKey(group)){
599
                    heterotypicSynonymsList.get(group).add(synRel.getSynonym());
598
                    heterotypicSynonymsList.get(group).add(synonym);
600 599
                }else{
601 600
                    homotypicSynonyms = new ArrayList<Synonym>();
602
                    homotypicSynonyms.add(synRel.getSynonym());
601
                    homotypicSynonyms.add(synonym);
603 602
                    heterotypicSynonymsList.put(group, homotypicSynonyms);
604 603
                    homotypicSynonyms= null;
605 604
                }
606 605
            } else{
607 606
                synonymName.generateFullTitle();
608
                homotypicSynonymsList.add(synRel.getSynonym());
607
                homotypicSynonymsList.add(synonym);
609 608
            }
610 609
        }
611 610

  
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/csv/redlist/demo/CsvDemoExport.java
42 42
import eu.etaxonomy.cdm.model.reference.Reference;
43 43
import eu.etaxonomy.cdm.model.taxon.Classification;
44 44
import eu.etaxonomy.cdm.model.taxon.Synonym;
45
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
46 45
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
47 46
import eu.etaxonomy.cdm.model.taxon.Taxon;
48 47
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
......
563 562
	 */
564 563
	private void handleSynonyms(CsvDemoRecord record, Taxon taxon) {
565 564

  
566
		Set<SynonymRelationship> synRels = taxon.getSynonymRelations();
567
		ArrayList<String> synonyms = new ArrayList<String>();
568
		for (SynonymRelationship synRel :synRels ){
569
			Synonym synonym = synRel.getSynonym();
570
			SynonymRelationshipType type = synRel.getType();
565
		Set<Synonym> synonyms = taxon.getSynonyms();
566
		ArrayList<String> synonymLabels = new ArrayList<>();
567
		for (Synonym synonym :synonyms ){
568
			SynonymRelationshipType type = synonym.getType();
571 569
			if (type == null){ // should not happen
572 570
				type = SynonymRelationshipType.SYNONYM_OF();
573 571
			}
574 572
			NonViralName<?> name = CdmBase.deproxy(synonym.getName(), NonViralName.class);
575
			synonyms.add(name.getTitleCache());
573
			synonymLabels.add(name.getTitleCache());
576 574
		}
577
		record.setSynonyms(synonyms);
575
		record.setSynonyms(synonymLabels);
578 576
	}
579 577

  
580 578
	/**
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/csv/redlist/out/CsvTaxExportRedlist.java
37 37
import eu.etaxonomy.cdm.model.name.NonViralName;
38 38
import eu.etaxonomy.cdm.model.taxon.Classification;
39 39
import eu.etaxonomy.cdm.model.taxon.Synonym;
40
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
41 40
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
42 41
import eu.etaxonomy.cdm.model.taxon.Taxon;
43 42
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
......
53 52

  
54 53
@Component
55 54
public class CsvTaxExportRedlist extends CsvExportBaseRedlist {
56
	private static final Logger logger = Logger.getLogger(CsvTaxExportRedlist.class);
55
    private static final long serialVersionUID = 841703025922543361L;
56

  
57
    private static final Logger logger = Logger.getLogger(CsvTaxExportRedlist.class);
57 58

  
58 59
	private static final String ROW_TYPE = "http://rs.tdwg.org/dwc/terms/Taxon";
59 60
	private static final String fileName = "RedlistCoreTax.csv";
......
302 303

  
303 304
	private void handleSynonyms(CsvTaxRecordRedlist record, Taxon taxon) {
304 305

  
305
		Set<SynonymRelationship> synRels = taxon.getSynonymRelations();
306
		ArrayList<String> synonyms = new ArrayList<String>();
307
		for (SynonymRelationship synRel :synRels ){
308
			Synonym synonym = synRel.getSynonym();
309
			SynonymRelationshipType type = synRel.getType();
306
		Set<Synonym> synonyms = taxon.getSynonyms();
307
		ArrayList<String> synonymLabels = new ArrayList<>();
308
		for (Synonym synonym :synonyms ){
309
			SynonymRelationshipType type = synonym.getType();
310 310
			if (type == null){ // should not happen
311 311
				type = SynonymRelationshipType.SYNONYM_OF();
312 312
			}
313 313
			NonViralName<?> name = CdmBase.deproxy(synonym.getName(), NonViralName.class);
314
			synonyms.add(name.getTitleCache());
314
			synonymLabels.add(name.getTitleCache());
315 315
		}
316
		record.setSynonyms(synonyms);
316
		record.setSynonyms(synonymLabels);
317 317
	}
318 318

  
319 319
	private void handleDiscriptionData(CsvTaxRecordRedlist record, Taxon taxon) {
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/dwca/in/DwcTaxonCsv2CdmTaxonRelationConverter.java
287 287
				if (accTaxon == null){
288 288
						fireWarningEvent("NON-ID accepted Name Usage not yet implemented or taxon for name usage id not available", item, 4);
289 289
				} else{
290
					accTaxon.addSynonym(synonym, SynonymRelationshipType.SYNONYM_OF(),null, null);
290
					accTaxon.addSynonym(synonym, SynonymRelationshipType.SYNONYM_OF());
291 291
				}
292 292
				// FIXME : no information regarding misapplied name available at this point,
293 293
				//         hence a regexp check for 'misapplied' is done to add them as a relationship
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/dwca/in/DwcTaxonStreamItem2CdmTaxonConverter.java
311 311
	 * @param taxonBase
312 312
	 */
313 313
	private void handleTdwgArea(StreamItem item, TaxonBase<?> taxonBase) {
314
		// TODO Auto-generated method stub
315 314
		String tdwg_area = item.get(TermUri.DWC_COUNTRY_CODE);
316 315
		if (tdwg_area != null){
317
		if(taxonBase instanceof Synonym){
318
			Synonym synonym = CdmBase.deproxy(taxonBase, Synonym.class);
319
			Set<Taxon> acceptedTaxaList = synonym.getAcceptedTaxa();
320
			if(acceptedTaxaList.size()>1){
321
				String message = "Synonym is related to more than one accepted Taxa";
322
				fireWarningEvent(message, item, 4);
323
			}else{
324
				for(Taxon taxon : acceptedTaxaList){
325
					TaxonDescription td = getTaxonDescription(taxon, false);
326
					NamedArea area = NamedArea.getAreaByTdwgAbbreviation(tdwg_area);
327

  
328
					if (area == null){
329
						area = NamedArea.getAreaByTdwgLabel(tdwg_area);
330
					}
331
					if (area != null){
332
						Distribution distribution = Distribution.NewInstance(area, PresenceAbsenceTerm.PRESENT());
333
						td.addElement(distribution);
334
					}
335
				}
336
			}
337
		}
338
		if(!(taxonBase instanceof Synonym)){
339
			Taxon taxon = CdmBase.deproxy(taxonBase, Taxon.class);
340
			TaxonDescription td = getTaxonDescription(taxon, false);
341
			NamedArea area = NamedArea.getAreaByTdwgAbbreviation(tdwg_area);
342

  
343
			if (area == null){
344
				area = NamedArea.getAreaByTdwgLabel(tdwg_area);
345
			}
346
			if (area != null){
347
				Distribution distribution = Distribution.NewInstance(area, PresenceAbsenceTerm.PRESENT());
348
				td.addElement(distribution);
349
			}
350
		}
351
	}
316
    		if(taxonBase instanceof Synonym){
317
    			Synonym synonym = CdmBase.deproxy(taxonBase, Synonym.class);
318
    			Taxon acceptedTaxon = synonym.getAcceptedTaxon();
319
    			if (acceptedTaxon != null){
320
    			    TaxonDescription td = getTaxonDescription(acceptedTaxon, false);
321
    			    NamedArea area = NamedArea.getAreaByTdwgAbbreviation(tdwg_area);
322

  
323
    			    if (area == null){
324
    			        area = NamedArea.getAreaByTdwgLabel(tdwg_area);
325
    			    }
326
    			    if (area != null){
327
    			        Distribution distribution = Distribution.NewInstance(area, PresenceAbsenceTerm.PRESENT());
328
    			        td.addElement(distribution);
329
    			    }
330
    			}
331
    		}
332
    		if(!(taxonBase instanceof Synonym)){
333
    			Taxon taxon = CdmBase.deproxy(taxonBase, Taxon.class);
334
    			TaxonDescription td = getTaxonDescription(taxon, false);
335
    			NamedArea area = NamedArea.getAreaByTdwgAbbreviation(tdwg_area);
336

  
337
    			if (area == null){
338
    				area = NamedArea.getAreaByTdwgLabel(tdwg_area);
339
    			}
340
    			if (area != null){
341
    				Distribution distribution = Distribution.NewInstance(area, PresenceAbsenceTerm.PRESENT());
342
    				td.addElement(distribution);
343
    			}
344
    		}
345
    	}
352 346
	}
353 347

  
354 348

  
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/dwca/in/GbifReferenceCsv2CdmConverter.java
171 171
					resultList.add(new MappedCdmBase<CdmBase>(desc));
172 172
				}else if (taxon.isInstanceOf(Synonym.class)){
173 173
					Synonym syn = CdmBase.deproxy(taxon, Synonym.class);
174
					for (Taxon tax: syn.getAcceptedTaxa()){
175
						TaxonDescription desc = getTaxonDescription(tax, false);
176
						createCitation(desc, reference, syn.getName());
177
						resultList.add(new MappedCdmBase<CdmBase>(desc));
174
					Taxon tax = syn.getAcceptedTaxon();
175
					if (tax != null){
176
    					TaxonDescription desc = getTaxonDescription(tax, false);
177
    					createCitation(desc, reference, syn.getName());
178
    					resultList.add(new MappedCdmBase<CdmBase>(desc));
178 179
					}
179 180
				}
180 181

  
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/dwca/out/DwcaTaxExport.java
35 35
import eu.etaxonomy.cdm.model.reference.Reference;
36 36
import eu.etaxonomy.cdm.model.taxon.Classification;
37 37
import eu.etaxonomy.cdm.model.taxon.Synonym;
38
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
39 38
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
40 39
import eu.etaxonomy.cdm.model.taxon.Taxon;
41 40
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
......
48 47
 */
49 48
@Component
50 49
public class DwcaTaxExport extends DwcaExportBase {
51
	private static final Logger logger = Logger.getLogger(DwcaTaxExport.class);
50
    private static final long serialVersionUID = -3770976064909193441L;
51

  
52
    private static final Logger logger = Logger.getLogger(DwcaTaxExport.class);
52 53

  
53 54
	private static final String ROW_TYPE = "http://rs.tdwg.org/dwc/terms/Taxon";
54 55
	private static final String fileName = "coreTax.txt";
......
133 134
	}
134 135

  
135 136
	private void handleSynonyms(Taxon taxon, PrintWriter writer, Classification classification, DwcaMetaDataRecord metaRecord, DwcaTaxExportConfigurator config) {
136
		Set<SynonymRelationship> synRels = taxon.getSynonymRelations();
137
		for (SynonymRelationship synRel :synRels ){
137
		for (Synonym synonym :taxon.getSynonyms() ){
138 138
			DwcaTaxRecord record = new DwcaTaxRecord(metaRecord, config);
139
			Synonym synonym = synRel.getSynonym();
140
			SynonymRelationshipType type = synRel.getType();
141
			boolean isProParte = synRel.isProParte();
142
			boolean isPartial = synRel.isPartial();
139
			SynonymRelationshipType type = synonym.getType();
140
			boolean isProParte = synonym.isProParte();
141
			boolean isPartial = synonym.isPartial();
143 142
			if (type == null){ // should not happen
144 143
				type = SynonymRelationshipType.SYNONYM_OF();
145 144
			}
......
153 152
				record.write(writer);
154 153
				this.addExistingRecord(synonym);
155 154
			}
156

  
157 155
		}
158

  
159 156
	}
160 157

  
161

  
162 158
	private void handleMisapplication(Taxon taxon, PrintWriter writer, Classification classification, DwcaMetaDataRecord metaRecord, DwcaTaxExportConfigurator config) {
163 159
		Set<Taxon> misappliedNames = taxon.getMisappliedNames();
164 160
		for (Taxon misappliedName : misappliedNames ){
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
}
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/pilotOutputHtml/PilotOutputExporter.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;
......
45 42
// public class JaxbExport extends CdmIoBase implements ICdmIoExport {
46 43
// TODO: public class JaxbExport extends CdmIoBase implements ICdmIO {
47 44

  
48
	private static final Logger logger = Logger.getLogger(PilotOutputExporter.class);
45
    private static final long serialVersionUID = -5556376038773540067L;
46
    private static final Logger logger = Logger.getLogger(PilotOutputExporter.class);
49 47
	private PilotOutputDocumentBuilder pilotOutputDocumentBuilder = null;
50 48

  
51 49
	private boolean doOccurrence = true;
52 50

  
53
	
51

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

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

  
118 116
		return;
119 117

  
120 118
	}
......
125 123
		PilotOutputExportConfigurator pilotOutputExpConfig = (PilotOutputExportConfigurator)config;
126 124
		final int MAX_ROWS = 50000;
127 125
		int numberOfRows = pilotOutputExpConfig.getMaxRows();
128
		// TODO: 
126
		// TODO:
129 127
		//CdmApplicationController appCtr = config.getCdmAppController(false, true);
130 128

  
131 129
		int agentRows = numberOfRows;
......
203 201
			}
204 202
		}
205 203

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

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

  
222 220
		if (pilotOutputExpConfig.isDoReferencedEntities() == true) {
223 221
			logger.info("# Referenced Entities");
......
262 260
	}
263 261

  
264 262

  
265
	
263

  
266 264
}
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/sdd/out/SDDCdmExporter.java
16 16
import java.io.IOException;
17 17
import java.io.OutputStreamWriter;
18 18
import java.io.PrintWriter;
19
import java.util.HashSet;
20 19
import java.util.List;
21
import java.util.Set;
22 20

  
23 21
import org.apache.log4j.Logger;
24 22
import org.springframework.stereotype.Component;
......
33 31
import eu.etaxonomy.cdm.io.common.mapping.out.IExportTransformer;
34 32
import eu.etaxonomy.cdm.model.agent.AgentBase;
35 33
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
36
import eu.etaxonomy.cdm.model.common.RelationshipBase;
37 34
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
38 35
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
39 36
import eu.etaxonomy.cdm.model.reference.Reference;
......
273 270
//		logger.info("# Synonym: " + taxonBaseRows);
274 271
//		dataSet.setSynonyms(new ArrayList<Synonym>());
275 272
//		dataSet.setSynonyms(getTaxonService().getAllSynonyms(taxonBaseRows, 0));
276

  
277
		if (sddExpConfig.isDoRelTaxa() == true) {
278
			if (relationshipRows == 0) { relationshipRows = MAX_ROWS; }
279
			logger.info("# Relationships");
280
			List<RelationshipBase> relationList = getTaxonService().getAllRelationships(relationshipRows, 0);
281
			Set<RelationshipBase> relationSet = new HashSet<RelationshipBase>(relationList);
282
			sddDataSet.setRelationships(relationSet);
283
		}
273
//
274
//		if (sddExpConfig.isDoRelTaxa() == true) {
275
//			if (relationshipRows == 0) { relationshipRows = MAX_ROWS; }
276
//			logger.info("# Relationships");
277
//			List<RelationshipBase> relationList = getTaxonService()..listTaxonRelationships(relationshipRows, 0);
278
//			Set<RelationshipBase> relationSet = new HashSet<>(relationList);
279
//			sddDataSet.setRelationships(relationSet);
280
//		}
284 281

  
285 282
		if (sddExpConfig.isDoReferencedEntities() == true) {
286 283
			logger.info("# Referenced Entities");
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/sdd/out/SDDDataSet.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
*/
......
82 82
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
83 83
import eu.etaxonomy.cdm.model.reference.Reference;
84 84
import eu.etaxonomy.cdm.model.taxon.Synonym;
85
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
86 85
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
87 86
import eu.etaxonomy.cdm.model.taxon.Taxon;
88 87
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
......
112 111
})
113 112
@XmlRootElement(name = "DataSet", namespace = "http://etaxonomy.eu/cdm/model/1.0")
114 113
public class SDDDataSet {
115
	
116
    // Some fields are of type List and some are of type Set. 
114

  
115
    // Some fields are of type List and some are of type Set.
117 116
	// This is mainly because
118 117
	// the service classes return lists, i.e.
119 118
    // TaxonServiceImpl.getRootTaxa() returns List<Taxon>
......
127 126
        @XmlElement(name = "Person", namespace = "http://etaxonomy.eu/cdm/model/agent/1.0", type = Person.class)
128 127
    })
129 128
    protected List<? extends AgentBase> agents;
130
    
129

  
131 130
    @XmlElementWrapper(name = "AgentData")
132 131
    @XmlElements({
133 132
    @XmlElement(name = "Address", namespace = "http://etaxonomy.eu/cdm/model/agent/1.0", type = Address.class),
......
150 149
    @XmlElement(name = "LanguageString", namespace = "http://etaxonomy.eu/cdm/model/common/1.0", type = LanguageString.class)
151 150
    })
152 151
    protected List<LanguageStringBase> languageData;
153
    
152

  
154 153
    @XmlElementWrapper(name = "Terms")
155 154
    @XmlElements({
156 155
    	@XmlElement(name = "AnnotationType", namespace = "http://etaxonomy.eu/cdm/model/common/1.0", type = AnnotationType.class),
......
199 198
    	@XmlElement(name = "FieldUnit", namespace = "http://etaxonomy.eu/cdm/model/occurrence/1.0", type = FieldUnit.class)
200 199
    })
201 200
    protected List<SpecimenOrObservationBase> occurrences;
202
    
201

  
203 202
    @XmlElementWrapper(name = "References")
204 203
   	@XmlElement(name = "Reference", namespace = "http://etaxonomy.eu/cdm/model/reference/1.0", type = Reference.class)
205 204

  
......
213 212
    })
214 213
    protected List<ReferencedEntityBase> referencedEntities;
215 214

  
216
    	
215

  
217 216
    @XmlElementWrapper(name = "TaxonomicNames")
218 217
    @XmlElements({
219 218
    	@XmlElement(name = "BacterialName", namespace = "http://etaxonomy.eu/cdm/model/name/1.0", type = BacterialName.class),
......
227 226
    @XmlElementWrapper(name = "Taxa")
228 227
    @XmlElement(name = "Taxon", namespace = "http://etaxonomy.eu/cdm/model/taxon/1.0")
229 228
    protected List<Taxon> taxa;
230
	
229

  
231 230
    @XmlElementWrapper(name = "Synonyms")
232 231
    @XmlElement(name = "Synonym", namespace = "http://etaxonomy.eu/cdm/model/taxon/1.0")
233 232
    protected List<Synonym> synonyms;
......
235 234
    @XmlElementWrapper(name = "Relationships")
236 235
    @XmlElements({
237 236
    	@XmlElement(name = "TaxonRelationship", namespace = "http://etaxonomy.eu/cdm/model/taxon/1.0", type = TaxonRelationship.class),
238
    	@XmlElement(name = "SynonymRelationship", namespace = "http://etaxonomy.eu/cdm/model/taxon/1.0", type = SynonymRelationship.class),
239
    	@XmlElement(name = "NameRelationship", namespace = "http://etaxonomy.eu/cdm/model/name/1.0", type = NameRelationship.class),
237
     	@XmlElement(name = "NameRelationship", namespace = "http://etaxonomy.eu/cdm/model/name/1.0", type = NameRelationship.class),
240 238
    	@XmlElement(name = "HybridRelationship", namespace = "http://etaxonomy.eu/cdm/model/name/1.0", type = HybridRelationship.class)
241 239
    })
242
    protected Set<RelationshipBase> relationships;
240
    protected Set<RelationshipBase> relationshipsX;
243 241

  
244 242
    @XmlElementWrapper(name = "Media_")
245 243
    @XmlElement(name = "Media", namespace = "http://etaxonomy.eu/cdm/model/media/1.0")
246 244
    protected List<VersionableEntity> media;
247
    
245

  
248 246
    @XmlElementWrapper(name = "HomotypicalGroups")
249 247
    @XmlElement(name = "HomotypicalGroup", namespace = "http://etaxonomy.eu/cdm/model/name/1.0")
250 248
    protected List<HomotypicalGroup> homotypicalGroups;
......
252 250
//	@XmlElement(name = "TdwgArea", namespace = "http://etaxonomy.eu/cdm/model/location/1.0", type = TdwgArea.class),
253 251

  
254 252
	public SDDDataSet () {
255
		
256
		agents = new ArrayList<AgentBase>(); 
257
		agentData = new ArrayList<VersionableEntity>();
253

  
254
		agents = new ArrayList<>();
255
		agentData = new ArrayList<>();
258 256
//		featureData = new ArrayList<VersionableEntity>();
259
		featureData = new ArrayList<VersionableEntity>();
260
		languageData = new ArrayList<LanguageStringBase>();
261
		terms = new ArrayList<DefinedTermBase>();
262
		termVocabularies = new ArrayList<TermVocabulary<DefinedTermBase>>();
263
		occurrences = new ArrayList<SpecimenOrObservationBase>();
264
		references = new ArrayList<Reference>();
265
		referencedEntities = new ArrayList<ReferencedEntityBase>();
266
		taxonomicNames = new ArrayList<TaxonNameBase>();
267
		taxa = new ArrayList<Taxon>();
268
		synonyms = new ArrayList<Synonym>();
269
		relationships = new HashSet<RelationshipBase>();
270
		media = new ArrayList<VersionableEntity>();
271
		homotypicalGroups = new ArrayList<HomotypicalGroup>();
257
		featureData = new ArrayList<>();
258
		languageData = new ArrayList<>();
259
		terms = new ArrayList<>();
260
		termVocabularies = new ArrayList<>();
261
		occurrences = new ArrayList<>();
262
		references = new ArrayList<>();
263
		referencedEntities = new ArrayList<>();
264
		taxonomicNames = new ArrayList<>();
265
		taxa = new ArrayList<>();
266
		synonyms = new ArrayList<>();
267
		media = new ArrayList<>();
268
		homotypicalGroups = new ArrayList<>();
272 269
	}
273 270

  
274 271
    /**
275 272
     * Gets the value of the agents property.
276
     * 
273
     *
277 274
     * @return
278 275
     *     possible object is
279 276
     *     {@link List<Agent> }
280
     *     
277
     *
281 278
     */
282 279
    public List<? extends AgentBase> getAgents() {
283 280
        return agents;
......
285 282

  
286 283
    /**
287 284
     * Sets the value of the agents property.
288
     * 
285
     *
289 286
     * @param value
290 287
     *     allowed object is
291 288
     *     {@link List<Agent> }
292
     *     
289
     *
293 290
     */
294 291
    public void setAgents(List<? extends AgentBase> value) {
295 292
        this.agents = value;
......
297 294

  
298 295
    /**
299 296
     * Gets the value of the agentData property.
300
     * 
297
     *
301 298
     * @return
302 299
     *     possible object is
303 300
     *     {@link List<VersionableEntity> }
304
     *     
301
     *
305 302
     */
306 303
    public List<VersionableEntity> getAgentData() {
307 304
        return agentData;
......
309 306

  
310 307
    /**
311 308
     * Sets the value of the agentData property.
312
     * 
309
     *
313 310
     * @param value
314 311
     *     allowed object is
315 312
     *     {@link List<VersionableEntity> }
316
     *     
313
     *
317 314
     */
318 315
    public void setAgentData(List<VersionableEntity> value) {
319 316
        this.agentData = value;
......
321 318

  
322 319
    /**
323 320
     * Gets the value of the terms property.
324
     * 
321
     *
325 322
     * @return
326 323
     *     possible object is
327 324
     *     {@link List<TermBase> }
328
     *     
325
     *
329 326
     */
330
    
327

  
331 328
    //public List<? extends TermBase> getTerms() {
332 329
    public List<DefinedTermBase> getTerms() {
333 330
        return terms;
......
335 332

  
336 333
    /**
337 334
     * Sets the value of the terms property.
338
     * 
335
     *
339 336
     * @param value
340 337
     *     allowed object is
341 338
     *     {@link List<TermBase> }
342
     *     
339
     *
343 340
     */
344 341
    //public void setTerms(List<? extends TermBase> value) {
345 342
    public void setTerms(List<DefinedTermBase> value) {
......
348 345

  
349 346
    /**
350 347
     * Gets the value of the term vocabularies property.
351
     * 
348
     *
352 349
     * @return
353 350
     *     possible object is
354 351
     *     {@link List<TermVocabulary> }
355
     *     
352
     *
356 353
     */
357
    
354

  
358 355
    public List<TermVocabulary<DefinedTermBase>> getTermVocabularies() {
359 356
        return termVocabularies;
360 357
    }
361 358

  
362 359
    /**
363 360
     * Sets the value of the term vocabularies property.
364
     * 
361
     *
365 362
     * @param value
366 363
     *     allowed object is
367 364
     *     {@link List<TermVocabulary> }
368
     *     
365
     *
369 366
     */
370 367
    public void setTermVocabularies(List<TermVocabulary<DefinedTermBase>> value) {
371 368
        this.termVocabularies = value;
......
373 370

  
374 371
    /**
375 372
     * Gets the value of the taxonomicNames property.
376
     * 
373
     *
377 374
     * @return
378 375
     *     possible object is
379 376
     *     {@link List<axonNameBase> }
380
     *     
377
     *
381 378
     */
382 379
    public List<TaxonNameBase> getTaxonomicNames() {
383 380
        return taxonomicNames;
......
385 382

  
386 383
    /**
387 384
     * Sets the value of the taxonomicNames property.
388
     * 
385
     *
389 386
     * @param value
390 387
     *     allowed object is
391 388
     *     {@link List<TaxonNameBase> }
392
     *     
389
     *
393 390
     */
394 391
    public void setTaxonomicNames(List<TaxonNameBase> value) {
395 392
        this.taxonomicNames = value;
......
397 394

  
398 395
    /**
399 396
     * Gets the value of the references property.
400
     * 
397
     *
401 398
     * @return
402 399
     *     possible object is
403 400
     *     {@link List<SpecimenOrObservationBase> }
404
     *     
401
     *
405 402
     */
406 403
    public List<SpecimenOrObservationBase> getOccurrences() {
407 404
        return occurrences;
......
409 406

  
410 407
    /**
411 408
     * Sets the value of the references property.
412
     * 
409
     *
413 410
     * @param value
414 411
     *     allowed object is
415 412
     *     {@link List<SpecimenOrObservationBase> }
416
     *     
413
     *
417 414
     */
418 415
    public void setOccurrences(List<SpecimenOrObservationBase> value) {
419 416
        this.occurrences = value;
......
421 418

  
422 419
    /**
423 420
     * Gets the value of the references property.
424
     * 
421
     *
425 422
     * @return
426 423
     *     possible object is
427 424
     *     {@link List<Reference> }
428
     *     
425
     *
429 426
     */
430 427
    public List<Reference> getReferences() {
431 428
        return references;
......
433 430

  
434 431
    /**
435 432
     * Sets the value of the references property.
436
     * 
433
     *
437 434
     * @param value
438 435
     *     allowed object is
439 436
     *     {@link List<Reference> }
440
     *     
437
     *
441 438
     */
442 439
    public void setReferences(List<Reference> value) {
443 440
        this.references = value;
......
445 442

  
446 443
    /**
447 444
     * Adds the referenced entities in value to the referenced entity property list.
448
     * 
445
     *
449 446
     * @param value
450 447
     *     allowed object is
451 448
     *     {@link Collection<ReferencedEntityBase> }
452
     *     
449
     *
453 450
     */
454 451
    public <T extends ReferencedEntityBase> void addReferencedEntities(Collection<T> value) {
455 452
    	for (T referencedEntity: value) {
......
459 456

  
460 457
    /**
461 458
     * Gets the value of the  property.
462
     * 
459
     *
463 460
     * @return
464 461
     *     possible object is
465 462
     *     {@link List<ReferencedEntityBase> }
466
     *     
463
     *
467 464
     */
468 465
    public List<ReferencedEntityBase> getReferencedEntities() {
469 466
        return referencedEntities;
......
471 468

  
472 469
    /**
473 470
     * Sets the value of the referencedEntities property.
474
     * 
471
     *
475 472
     * @param value
476 473
     *     allowed object is
477 474
     *     {@link List<ReferencedEntityBase> }
478
     *     
475
     *
479 476
     */
480 477
    public void setReferencedEntities(List<? extends ReferencedEntityBase> value) {
481 478
        this.referencedEntities = new ArrayList<ReferencedEntityBase>();
482 479
        referencedEntities.addAll(value);
483 480
    }
484
    
481

  
485 482
    /**
486 483
     * Adds the features in value to the feature data property list.
487
     * 
484
     *
488 485
     * @param value
489 486
     *     allowed object is
490 487
     *     {@link Collection<VersionableEntity> }
491
     *     
488
     *
492 489
     */
493 490
    public <T extends VersionableEntity> void addFeatureData(Collection<T> value) {
494 491
    	for (T featureItem: value) {
......
498 495

  
499 496
    /**
500 497
     * Gets the value of the feature data property.
501
     * 
498
     *
502 499
     * @return
503 500
     *     possible object is
504 501
     *     {@link List<VersionableEntity> }
505
     *     
502
     *
506 503
     */
507 504
//    public List<VersionableEntity> getFeatureData() {
508 505
    public List<VersionableEntity> getFeatureData() {
......
511 508

  
512 509
    /**
513 510
     * Sets the value of the feature data property.
514
     * 
511
     *
515 512
     * @param value
516 513
     *     allowed object is
517 514
     *     {@link List<VersionableEntity> }
518
     *     
515
     *
519 516
     */
520 517
    public <T extends VersionableEntity> void setFeatureData(List<T> value) {
521 518
        featureData = new ArrayList<VersionableEntity>();
......
530 527
    //    this.featureData = new ArrayList<VersionableEntity<?>>();
531 528
    //    featureData.addAll(value);
532 529
    //}
533
    
530

  
534 531
    /**
535 532
     * Adds the features in value to the language data property list.
536
     * 
533
     *
537 534
     * @param value
538 535
     *     allowed object is
539 536
     *     {@link Collection<LanguageStringBase> }
540
     *     
537
     *
541 538
     */
542 539
    public <T extends LanguageStringBase> void addLanguageData(Collection<T> value) {
543 540
    	for (T languageItem: value) {
......
547 544

  
548 545
    /**
549 546
     * Gets the value of the language data property.
550
     * 
547
     *
551 548
     * @return
552 549
     *     possible object is
553 550
     *     {@link List<LanguageStringBase> }
554
     *     
551
     *
555 552
     */
556 553
    public List<LanguageStringBase> getLanguageData() {
557 554
        return languageData;
......
559 556

  
560 557
    /**
561 558
     * Sets the value of the feature data property.
562
     * 
559
     *
563 560
     * @param value
564 561
     *     allowed object is
565 562
     *     {@link List<LanguageStringBase> }
566
     *     
563
     *
567 564
     */
568 565
    public void setLanguageData(List<? extends LanguageStringBase> value) {
569 566
        this.languageData = new ArrayList<LanguageStringBase>();
570 567
        languageData.addAll(value);
571 568
    }
572
    
569

  
573 570
    /**
574 571
     * Adds the taxa in value to the taxa property list.
575
     * 
572
     *
576 573
     * @param value
577 574
     *     allowed object is
578 575
     *     {@link Collection<Taxon> }
579
     *     
576
     *
580 577
     */
581 578
    public void addTaxa(Collection<Taxon> value) {
582 579
    	for (Taxon taxon: value) {
......
586 583

  
587 584
    /**
588 585
     * Gets the value of the taxa property.
589
     * 
586
     *
590 587
     * @return
591 588
     *     possible object is
592 589
     *     {@link List<Taxon> }
593
     *     
590
     *
594 591
     */
595 592
//    public List<Taxon> getTaxa() {
596 593
//        return taxa;
......
598 595

  
599 596
    /**
600 597
     * Gets the value of the taxa property as {@link Collection<TaxonBase> }
601
     * 
598
     *
602 599
     * @return
603 600
     *     possible object is
604 601
     *     {@link Collection<TaxonBase> }
605
     *     
602
     *
606 603
     */
607 604
    public Collection<? extends TaxonBase> getTaxa() {
608
    	
605

  
609 606
    	//TODO can be deleted when everything works
610 607
    	//Object obj = taxa;
611 608
    	//Collection<TaxonBase> taxonBases = (Collection<TaxonBase>)obj;
......
614 611
    }
615 612

  
616 613
    public Collection<TaxonBase> getTaxonBases() {
617
    	
614

  
618 615
    	Collection<TaxonBase> result = new HashSet<TaxonBase>();;
619 616
    	if (taxa != null) {
620 617
        	result.addAll(taxa);
......
627 624

  
628 625
    /**
629 626
     * Sets the value of the taxa property.
630
     * 
627
     *
631 628
     * @param value
632 629
     *     allowed object is
633 630
     *     {@link List<Taxon> }
634
     *     
631
     *
635 632
     */
636 633
    public void setTaxa(List<Taxon> value) {
637 634
        this.taxa = value;
......
639 636

  
640 637
    /**
641 638
     * Adds the taxon in value to the taxa property list.
642
     * 
639
     *
643 640
     * @param value
644
     *     
641
     *
645 642
     */
646 643
    public void addTaxon(Taxon value) {
647 644
    		this.taxa.add(value);
......
650 647

  
651 648
    /**
652 649
     * Gets the value of the synonyms property.
653
     * 
650
     *
654 651
     * @return
655 652
     *     possible object is
656 653
     *     {@link List<Synonym> }
657
     *     
654
     *
658 655
     */
659 656
    public List<Synonym> getSynonyms() {
660 657
        return synonyms;
......
662 659

  
663 660
    /**
664 661
     * Sets the value of the synonyms property.
665
     * 
662
     *
666 663
     * @param value
667 664
     *     allowed object is
668 665
     *     {@link List<Synonym> }
669
     *     
666
     *
670 667
     */
671 668
    public void setSynonyms(List<Synonym> value) {
672 669
        this.synonyms = value;
673 670
    }
674
    
671

  
675 672
    /**
676 673
     * Adds the synonym in value to the taxa property list.
677
     * 
674
     *
678 675
     * @param value
679
     *     
676
     *
680 677
     */
681 678
    public void addSynonym(Synonym value) {
682 679
    		this.synonyms.add(value);
683 680
    }
684
    
681

  
685 682
    /**
686 683
     * Adds the synonym in value to the synonyms property list.
687
     * 
684
     *
688 685
     * @param value
689 686
     *     allowed object is
690 687
     *     {@link Collection<Synonym> }
691
     *     
688
     *
692 689
     */
693 690
    public void addSynonyms(Collection<Synonym> value) {
694 691
    	for (Synonym synonym: value) {
......
697 694
    }
698 695

  
699 696
    /**
700
     * Gets the value of the relationships property.
701
     * 
702
     * @return
703
     *     possible object is
704
     *     {@link Set<RelationshipBase> }
705
     *     
706
     */
707
    public Set<RelationshipBase> getRelationships() {
708
        return relationships;
709
    }
710

  
711
    /**
712
     * Sets the value of the relationships property.
713
     * 
714
     * @param value
715
     *     allowed object is
716
     *     {@link Set<RelationshipBase> }
717
     *     
718
     */
719
    public void setRelationships(Set<RelationshipBase> value) {
720
        this.relationships = value;
721
    }
722

  
723
    /**
724
     * Adds the relationship in value to the relationships property list.
725
     * 
726
     * @param value
727
     *     allowed object is
728
     *     {@link Collection<RelationshipBase> }
729
     *     
730
     */
731
    public void addRelationships(Collection<? extends RelationshipBase> value) {
732
    	for (RelationshipBase relationship: value) {
733
    		this.relationships.add(relationship);
734
    	}
735
    }
736

  
737
    /**
738 697
     * Adds the media in value to the media property list.
739
     * 
698
     *
740 699
     * @param value
741 700
     *     allowed object is
742 701
     *     {@link Collection<VersionableEntity> }
743
     *     
702
     *
744 703
     */
745 704
    public <T extends VersionableEntity> void addMedia(Collection<T> value) {
746 705
    	for (T medium: value) {
......
750 709

  
751 710
    /**
752 711
     * Gets the value of the  property.
753
     * 
712
     *
754 713
     * @return
755 714
     *     possible object is
756 715
     *     {@link List<ReferencedEntityBase> }
757
     *     
716
     *
758 717
     */
... 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)