Project

General

Profile

Revision 29de4478

ID29de44789713f66c7e670269dcf14fe7a7816645
Parent edec16d2
Child a3a55498

Added by Andreas Kohlbecker about 2 years ago

ref #8398 adding codeEdition to NameRelationship constructors and to related add* methods in TaxonName and some more

View differences:

cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/ipni/IpniService.java
588 588
		if (config.isDoBasionyms() && valueMap.get(REPLACED_SYNONYM)!= null){
589 589
		    TaxonName replacedSynoynm = TaxonNameFactory.NewBotanicalInstance(null);
590 590
		    replacedSynoynm.setTitleCache(valueMap.get(REPLACED_SYNONYM), true);
591
		    name.addReplacedSynonym(replacedSynoynm, null, null, null);
591
		    name.addReplacedSynonym(replacedSynoynm, null, null, null, null);
592 592
		}
593 593

  
594 594
		//type information
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/taxa/NormalExplicitImport.java
442 442
    				if (basionymNameStr != null){
443 443
    				    Synonym syn = createSynonym(state,taxonBase,basionymNameStr);
444 444
                        acceptedTaxon.addSynonym(syn, SynonymType.HOMOTYPIC_SYNONYM_OF());
445
                        syn.getName().addRelationshipToName(acceptedTaxon.getName(), NameRelationshipType.BASIONYM(), null);
445
                        syn.getName().addRelationshipToName(acceptedTaxon.getName(), NameRelationshipType.BASIONYM(), null, null);
446 446
    				}
447 447
    				nameUsedInSource = taxonBase.getName();
448 448

  
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/tcsxml/in/TcsXmlTaxonNameRelationsImport.java
263 263
						String id = elTaxonName.getAttributeValue("id");
264 264

  
265 265
						TaxonName relatedTaxonName =  taxonNameMap.get(removeVersionOfRef(id));
266
						taxonName.addRelationshipFromName(relatedTaxonName, nameRelType, ruleConsidered);
266
						taxonName.addRelationshipFromName(relatedTaxonName, nameRelType, ruleConsidered, null);
267 267
					}
268 268
				}
269 269

  
......
337 337

  
338 338
		//TODO note, microreference
339 339
		if (inverse == false){
340
			toName.addRelationshipToName(fromName, relType, ruleConsidered);
340
			toName.addRelationshipToName(fromName, relType, ruleConsidered, null);
341 341
		}else{
342
			fromName.addRelationshipToName(toName, relType, ruleConsidered);
342
			fromName.addRelationshipToName(toName, relType, ruleConsidered, null);
343 343
		}
344 344
		nameStore.add(fromName);
345 345
		return true;
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/wfo/in/WfoAccessClassificationImport.java
171 171
                TaxonName basionym;
172 172
                try {
173 173
                    basionym = getName(state, ORIGINAL_NAME_USAGE_ID);
174
                    name.addBasionym(basionym, sec, null, null);
174
                    name.addBasionym(basionym, sec, null, null, null);
175 175
                    TaxonBase<?> basionymTaxon = getCdmTaxon(state, basionym, ORIGINAL_NAME_USAGE_ID, Synonym.class);
176 176
                    if (basionymTaxon.isInstanceOf(Synonym.class)){
177 177
                        Synonym basioSynonym = CdmBase.deproxy(basionymTaxon, Synonym.class);
......
304 304
            if (state.getCurrentRecord().get(ORIGINAL_NAME_USAGE_ID)!= null){
305 305
                try{
306 306
                    TaxonName basionym = getName(state, ORIGINAL_NAME_USAGE_ID);
307
                    name.addBasionym(basionym, getTransactionalSourceReference(state), null, null);
307
                    name.addBasionym(basionym, getTransactionalSourceReference(state), null, null, null);
308 308

  
309 309
                    TaxonBase<?> basionymTaxon = getCdmTaxon(state, basionym, ORIGINAL_NAME_USAGE_ID, TaxonBase.class);
310 310
                    if (basionymTaxon.isInstanceOf(Taxon.class)){
......
397 397
//                TaxonName basionym = makeDoubtfulBasionym(state, ORIGINAL_NAME_USAGE_ID, sec);
398 398
                  try {
399 399
                      TaxonName basionym = getName(state, ORIGINAL_NAME_USAGE_ID);
400
                      name.addBasionym(basionym, sec, null, null);
400
                      name.addBasionym(basionym, sec, null, null, null);
401 401
                } catch (Exception e) {
402 402
                    String message = "Problem when handling basionym for " + name.getTitleCache();
403 403
                    state.getResult().addError(message, state.getRow());
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/HomotypicalGroup.java
243 243
     */
244 244
	@Transient
245 245
	public void setGroupBasionym(TaxonName basionymName) throws IllegalArgumentException{
246
    	setGroupBasionym(basionymName, null, null, null);
246
    	setGroupBasionym(basionymName, null, null, null, null);
247 247
    }
248 248

  
249
	public void setGroupBasionym(TaxonName basionymName, Reference citation, String microCitation, String ruleConsidered)
249
	public void setGroupBasionym(TaxonName basionymName, Reference citation, String microCitation, String ruleConsidered, NomenclaturalCodeEdition codeEdition)
250 250
    			throws IllegalArgumentException {
251 251
    	if (! typifiedNames.contains(basionymName)){
252 252
        	throw new IllegalArgumentException("Name to be set as basionym/original combination must be part of the homotypical group but is not");
......
260 260
        }
261 261
        for (TaxonName name : typified) {
262 262
    		if (!name.equals(basionymName)) {
263
		    	name.addRelationshipFromName(basionymName, NameRelationshipType.BASIONYM(), citation, microCitation, ruleConsidered);
263
		    	name.addRelationshipFromName(basionymName, NameRelationshipType.BASIONYM(), citation, microCitation, ruleConsidered, codeEdition);
264 264
			}
265 265
    	}
266 266
        typifiedNames= typified;
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/ITaxonNameBase.java
101 101
     * @see                   #addRelationshipFromName(TaxonName, NameRelationshipType, String)
102 102
     * @see                   #addNameRelationship(NameRelationship)
103 103
     */
104
    public NameRelationship addRelationshipToName(TaxonName toName, NameRelationshipType type, String ruleConsidered);
104
    public NameRelationship addRelationshipToName(TaxonName toName, NameRelationshipType type, String ruleConsidered, NomenclaturalCodeEdition codeEdition);
105 105

  
106 106
    /**
107 107
     * Creates a new {@link NameRelationship#NameRelationship(TaxonName, TaxonName, NameRelationshipType, String) name relationship} from <i>this</i> taxon name to another taxon name
......
118 118
     * @see                   #addNameRelationship(NameRelationship)
119 119
     */
120 120
    public NameRelationship addRelationshipToName(TaxonName toName, NameRelationshipType type, Reference citation,
121
            String microCitation, String ruleConsidered);
121
            String microCitation, String ruleConsidered, NomenclaturalCodeEdition codeEdition);
122 122

  
123 123
    /**
124 124
     * Creates a new {@link NameRelationship#NameRelationship(TaxonName, TaxonName, NameRelationshipType, String) name relationship} from another taxon name to <i>this</i> taxon name
......
135 135
     * @see                   #addRelationshipToName(TaxonName, NameRelationshipType, String)
136 136
     * @see                   #addNameRelationship(NameRelationship)
137 137
     */
138
    public NameRelationship addRelationshipFromName(TaxonName fromName, NameRelationshipType type, String ruleConsidered);
138
    public NameRelationship addRelationshipFromName(TaxonName fromName, NameRelationshipType type, String ruleConsidered, NomenclaturalCodeEdition codeEdition);
139 139

  
140 140
    /**
141 141
     * Creates a new {@link NameRelationship#NameRelationship(TaxonName, TaxonName, NameRelationshipType, String) name relationship} from another taxon name to <i>this</i> taxon name
......
153 153
     * @see                   #addNameRelationship(NameRelationship)
154 154
     */
155 155
    public NameRelationship addRelationshipFromName(TaxonName fromName, NameRelationshipType type, Reference citation,
156
            String microCitation, String ruleConsidered);
156
            String microCitation, String ruleConsidered, NomenclaturalCodeEdition codeEdition);
157 157

  
158 158
    /**
159 159
     * Removes one {@link NameRelationship name relationship} from one of both sets of
......
289 289
     * @see                     #getBasionym()
290 290
     * @see                     #addBasionym(TaxonName)
291 291
     */
292
    public NameRelationship addBasionym(TaxonName basionym, Reference citation, String microcitation, String ruleConsidered);
292
    public NameRelationship addBasionym(TaxonName basionym, Reference citation, String microcitation, String ruleConsidered, NomenclaturalCodeEdition codeEdition);
293 293

  
294 294
    /**
295 295
     * Returns the set of taxon names which are the {@link NameRelationshipType#REPLACED_SYNONYM() replaced synonyms} of <i>this</i> taxon name.
......
310 310
     * @see                     #addBasionym(TaxonName)
311 311
     */
312 312
    //TODO: Check if true: The replaced synonym cannot have itself a replaced synonym (?).
313
    public void addReplacedSynonym(TaxonName replacedSynonym, Reference citation, String microcitation, String ruleConsidered);
313
    public void addReplacedSynonym(TaxonName replacedSynonym, Reference citation, String microcitation, String ruleConsidered, NomenclaturalCodeEdition codeEdition);
314 314

  
315 315
    /**
316 316
     * Removes the {@link NameRelationshipType#BASIONYM() basionym} {@link NameRelationship relationship} from the set of
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NameRelationship.java
107 107
	 * @param fromName			the taxon name to be set as source for the new name relationship
108 108
	 * @param type				the relationship type to be assigned to the new name relationship
109 109
	 * @param ruleConsidered	the string indicating the article of the nomenclatural code for the new name relationship
110
     * @param codeEdition           the edition of the nomenclatural code where the <code>ruleConsidered</code> has been published.
110 111
	 * @see						#NameRelationship(TaxonName, TaxonName, NameRelationshipType, Reference, String, String)
111 112
	 * @see						TaxonName#addNameRelationship(NameRelationship)
112 113
	 * @see						TaxonName#addRelationshipFromName(TaxonName, NameRelationshipType, String)
113 114
	 * @see						TaxonName#addRelationshipToName(TaxonName, NameRelationshipType, String)
114 115
	 */
115
	protected NameRelationship(TaxonName toName, TaxonName fromName, NameRelationshipType type, String ruleConsidered) {
116
		this(toName, fromName, type, null, null, ruleConsidered);
116
	protected NameRelationship(TaxonName toName, TaxonName fromName, NameRelationshipType type, String ruleConsidered, NomenclaturalCodeEdition codeEdition) {
117
		this(toName, fromName, type, null, null, ruleConsidered, codeEdition);
117 118
	}
118 119

  
119 120
	/**
......
127 128
	 * @param citation				the reference source for the new name relationship
128 129
	 * @param citationMicroReference	the string with the details describing the exact localisation within the reference
129 130
	 * @param ruleConsidered		the string indicating the article of the nomenclatural code justifying the new name relationship
131
	 * @param codeEdition           the edition of the nomenclatural code where the <code>ruleConsidered</code> has been published.
130 132
	 * @see							#NameRelationship(TaxonName, TaxonName, NameRelationshipType, String)
131 133
	 * @see							TaxonName#addNameRelationship(NameRelationship)
132 134
	 * @see							TaxonName#addRelationshipFromName(TaxonName, NameRelationshipType, String)
133 135
	 * @see							TaxonName#addRelationshipToName(TaxonName, NameRelationshipType, String)
134 136
	 */
135
	protected NameRelationship(TaxonName  toName, TaxonName fromName, NameRelationshipType type, Reference citation, String citationMicroReference, String ruleConsidered) {
137
	protected NameRelationship(TaxonName  toName, TaxonName fromName, NameRelationshipType type, Reference citation, String citationMicroReference, String ruleConsidered, NomenclaturalCodeEdition codeEdition) {
136 138
		super(fromName, toName, type, citation, citationMicroReference);
137 139
		this.setRuleConsidered(ruleConsidered);
140
		this.setCodeEdition(codeEdition);
138 141
	}
139 142

  
140 143
	//********* METHODS **************************************/
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/TaxonName.java
1676 1676
     * @param toName		  the taxon name of the target for this new name relationship
1677 1677
     * @param type			  the type of this new name relationship
1678 1678
     * @param ruleConsidered  the string which specifies the rule on which this name relationship is based
1679
     * @param codeEdition     the edition of the nomenclatural code where the <code>ruleConsidered</code> has been published.
1679 1680
     * @return
1680 1681
     * @see    				  #getRelationsToThisName()
1681 1682
     * @see    				  #getNameRelations()
......
1683 1684
     * @see    				  #addNameRelationship(NameRelationship)
1684 1685
     */
1685 1686
    @Override
1686
    public NameRelationship addRelationshipToName(TaxonName toName, NameRelationshipType type, String ruleConsidered){
1687
        return addRelationshipToName(toName, type, null, null, ruleConsidered);
1687
    public NameRelationship addRelationshipToName(TaxonName toName, NameRelationshipType type, String ruleConsidered, NomenclaturalCodeEdition codeEdition){
1688
        return addRelationshipToName(toName, type, null, null, ruleConsidered, codeEdition);
1688 1689
    }
1689 1690

  
1690 1691
    /**
......
1695 1696
     * @param toName		  the taxon name of the target for this new name relationship
1696 1697
     * @param type			  the type of this new name relationship
1697 1698
     * @param ruleConsidered  the string which specifies the rule on which this name relationship is based
1699
     * @param codeEdition     the edition of the nomenclatural code where the <code>ruleConsidered</code> has been published.
1698 1700
     * @return
1699 1701
     * @see    				  #getRelationsToThisName()
1700 1702
     * @see    				  #getNameRelations()
......
1702 1704
     * @see    				  #addNameRelationship(NameRelationship)
1703 1705
     */
1704 1706
    @Override
1705
    public NameRelationship addRelationshipToName(TaxonName toName, NameRelationshipType type, Reference citation, String microCitation, String ruleConsidered){
1707
    public NameRelationship addRelationshipToName(TaxonName toName, NameRelationshipType type, Reference citation, String microCitation, String ruleConsidered, NomenclaturalCodeEdition codeEdition){
1706 1708
        if (toName == null){
1707 1709
            throw new NullPointerException("Null is not allowed as name for a name relationship");
1708 1710
        }
1709
        NameRelationship rel = new NameRelationship(toName, this, type, citation, microCitation, ruleConsidered);
1711
        NameRelationship rel = new NameRelationship(toName, this, type, citation, microCitation, ruleConsidered, codeEdition);
1710 1712
        return rel;
1711 1713
    }
1712 1714

  
......
1718 1720
     * @param fromName		  the taxon name of the source for this new name relationship
1719 1721
     * @param type			  the type of this new name relationship
1720 1722
     * @param ruleConsidered  the string which specifies the rule on which this name relationship is based
1723
     * @param codeEdition           the edition of the nomenclatural code where the <code>ruleConsidered</code> has been published.
1721 1724
     * @param citation		  the reference in which this relation was described
1722 1725
     * @param microCitation	  the reference detail for this relation (e.g. page)
1723 1726
     * @see    				  #getRelationsFromThisName()
......
1726 1729
     * @see    				  #addNameRelationship(NameRelationship)
1727 1730
     */
1728 1731
    @Override
1729
    public NameRelationship addRelationshipFromName(TaxonName fromName, NameRelationshipType type, String ruleConsidered){
1732
    public NameRelationship addRelationshipFromName(TaxonName fromName, NameRelationshipType type, String ruleConsidered, NomenclaturalCodeEdition codeEdition){
1730 1733
        //fromName.addRelationshipToName(this, type, null, null, ruleConsidered);
1731
        return this.addRelationshipFromName(fromName, type, null, null, ruleConsidered);
1734
        return this.addRelationshipFromName(fromName, type, null, null, ruleConsidered, codeEdition);
1732 1735
    }
1733 1736
    /**
1734 1737
     * Creates a new {@link NameRelationship#NameRelationship(TaxonName, TaxonName, NameRelationshipType, String) name relationship} from another taxon name to <i>this</i> taxon name
......
1738 1741
     * @param fromName		  the taxon name of the source for this new name relationship
1739 1742
     * @param type			  the type of this new name relationship
1740 1743
     * @param ruleConsidered  the string which specifies the rule on which this name relationship is based
1744
     * @param codeEdition           the edition of the nomenclatural code where the <code>ruleConsidered</code> has been published.
1741 1745
     * @param citation		  the reference in which this relation was described
1742 1746
     * @param microCitation	  the reference detail for this relation (e.g. page)
1743 1747
     * @see    				  #getRelationsFromThisName()
......
1746 1750
     * @see    				  #addNameRelationship(NameRelationship)
1747 1751
     */
1748 1752
    @Override
1749
    public NameRelationship addRelationshipFromName(TaxonName fromName, NameRelationshipType type, Reference citation, String microCitation, String ruleConsidered){
1750
        return fromName.addRelationshipToName(this, type, citation, microCitation, ruleConsidered);
1753
    public NameRelationship addRelationshipFromName(TaxonName fromName, NameRelationshipType type, Reference citation, String microCitation, String ruleConsidered, NomenclaturalCodeEdition codeEdition){
1754
        return fromName.addRelationshipToName(this, type, citation, microCitation, ruleConsidered, codeEdition);
1751 1755
    }
1752 1756

  
1753 1757
    /**
......
2137 2141
     */
2138 2142
    @Override
2139 2143
    public void addBasionym(TaxonName basionym){
2140
        addBasionym(basionym, null, null, null);
2144
        addBasionym(basionym, null, null, null, null);
2141 2145
    }
2142 2146
    /**
2143 2147
     * Assigns a taxon name as {@link NameRelationshipType#BASIONYM() basionym} of <i>this</i> taxon name
......
2149 2153
     *
2150 2154
     * @param  basionym			the taxon name to be set as the basionym of <i>this</i> taxon name
2151 2155
     * @param  ruleConsidered	the string identifying the nomenclatural rule
2156
     * @param codeEdition     the edition of the nomenclatural code where the <code>ruleConsidered</code> has been published.
2152 2157
     * @return
2153 2158
     * @see  					#getBasionym()
2154 2159
     * @see  					#addBasionym(TaxonName)
2155 2160
     */
2156 2161
    @Override
2157
    public NameRelationship addBasionym(TaxonName basionym, Reference citation, String microcitation, String ruleConsidered){
2162
    public NameRelationship addBasionym(TaxonName basionym, Reference citation, String microcitation, String ruleConsidered, NomenclaturalCodeEdition codeEdition){
2158 2163
        if (basionym != null){
2159
            return basionym.addRelationshipToName(this, NameRelationshipType.BASIONYM(), citation, microcitation, ruleConsidered);
2164
            return basionym.addRelationshipToName(this, NameRelationshipType.BASIONYM(), citation, microcitation, ruleConsidered, codeEdition);
2160 2165
        }else{
2161 2166
            return null;
2162 2167
        }
......
2182 2187
     *
2183 2188
     * @param  basionym			the taxon name to be set as the basionym of <i>this</i> taxon name
2184 2189
     * @param  ruleConsidered	the string identifying the nomenclatural rule
2190
     * @param codeEdition     the edition of the nomenclatural code where the <code>ruleConsidered</code> has been published.
2185 2191
     * @see  					#getBasionym()
2186 2192
     * @see  					#addBasionym(TaxonName)
2187 2193
     */
2188 2194
    //TODO: Check if true: The replaced synonym cannot have itself a replaced synonym (?).
2189 2195
    @Override
2190
    public void addReplacedSynonym(TaxonName replacedSynonym, Reference citation, String microcitation, String ruleConsidered){
2196
    public void addReplacedSynonym(TaxonName replacedSynonym, Reference citation, String microcitation, String ruleConsidered, NomenclaturalCodeEdition codeEdition){
2191 2197
        if (replacedSynonym != null){
2192
            replacedSynonym.addRelationshipToName(this, NameRelationshipType.REPLACED_SYNONYM(), citation, microcitation, ruleConsidered);
2198
            replacedSynonym.addRelationshipToName(this, NameRelationshipType.REPLACED_SYNONYM(), citation, microcitation, ruleConsidered, codeEdition);
2193 2199
        }
2194 2200
    }
2195 2201

  
......
3364 3370

  
3365 3371
                    // Then create it
3366 3372
                    name.addRelationshipFromName(this,
3367
                            NameRelationshipType.BASIONYM(), null);
3373
                            NameRelationshipType.BASIONYM(), null, null);
3368 3374
                }
3369 3375
            }
3370 3376
        }
cdmlib-model/src/test/java/eu/etaxonomy/cdm/datagenerator/TaxonGenerator.java
57 57
        basionym.setTitleCache("Hieracilla DC.", true);
58 58
        basionym.setGenusOrUninomial("Hieracilla");
59 59
        basionym.setCombinationAuthorship(deCandolle);
60
        botName.addBasionym(basionym, null, null, "216");
60
        botName.addBasionym(basionym, null, null, "216", null);
61 61

  
62 62
        //species taxon that is the child of genus taxon
63 63
        IBotanicalName botSpecies = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/name/HomotypicalGroupTest.java
93 93

  
94 94
	@Test
95 95
	public void testGetReplacedSynonym() {
96
		name3.addReplacedSynonym(name4, null, null, null);
96
		name3.addReplacedSynonym(name4, null, null, null, null);
97 97
		Set<TaxonName> replacedSyn =  name3.getHomotypicalGroup().getReplacedSynonym();
98 98
		Assert.assertNotNull("Replaced synonym set should not be null", replacedSyn);
99 99
		Assert.assertEquals("Number of replaced synonym should be 1", 1, replacedSyn.size());
......
103 103
	public void testGetBasionymAndReplacedSynonymRelations(){
104 104
		name1.addBasionym(name2);
105 105
		name3.addBasionym(name2);
106
		name4.addReplacedSynonym(name2, null, null, null);
106
		name4.addReplacedSynonym(name2, null, null, null, null);
107 107
		Set<NameRelationship> rels = name2.getHomotypicalGroup().getBasionymAndReplacedSynonymRelations();
108 108
		Assert.assertEquals("Number of relations should be 3", 3, rels.size());
109 109

  
......
112 112
	@Test
113 113
	public void testGetUnrelatedNames(){
114 114
		name1.addBasionym(name2);
115
		name4.addReplacedSynonym(name2, null, null, null);
115
		name4.addReplacedSynonym(name2, null, null, null, null);
116 116
		Set<TaxonName> unrelatedNames = name2.getHomotypicalGroup().getUnrelatedNames();
117 117
		Assert.assertEquals("Number of unrelatedNames should be 0", 0, unrelatedNames.size());
118 118
		name1.getHomotypicalGroup().merge(name3.getHomotypicalGroup());
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/name/TaxonNameTest.java
691 691
		TaxonName basionym = TaxonNameFactory.NewNonViralInstance(Rank.SPECIES());
692 692
		TaxonName earlierHomonym = TaxonNameFactory.NewNonViralInstance(Rank.SPECIES());
693 693
		taxonName1.addBasionym(basionym);
694
		taxonName1.addRelationshipToName(earlierHomonym, NameRelationshipType.LATER_HOMONYM(), "later homonym rule");
694
		taxonName1.addRelationshipToName(earlierHomonym, NameRelationshipType.LATER_HOMONYM(), "later homonym rule", null);
695 695
		//status
696 696
		Reference statusReference = ReferenceFactory.newArticle();
697 697
		NomenclaturalStatus nomStatus = NomenclaturalStatus.NewInstance(NomenclaturalStatusType.CONSERVED(), statusReference, "55");
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/taxon/HomotypicGroupTaxonComparatorTest.java
141 141
        Assert.assertEquals(botName3, list.get(3).getName());
142 142

  
143 143
        //add replaced synonym relation between basionyms
144
        botName4.addReplacedSynonym(botName5, null, null, null);
144
        botName4.addReplacedSynonym(botName5, null, null, null, null);
145 145
        Collections.sort(list, new HomotypicGroupTaxonComparator(null));
146 146
        Assert.assertEquals("basionym of second group should come first now as it is the replaced synonym",
147 147
                            botName5, list.get(0).getName());
......
244 244

  
245 245

  
246 246
        //add replaced synonym relation between basionyms
247
        botName5.addReplacedSynonym(botName4, null, null, null);
247
        botName5.addReplacedSynonym(botName4, null, null, null, null);
248 248
        Collections.sort(list, new HomotypicGroupTaxonComparator(null));
249 249
        Assert.assertEquals("basionym of second group should come first now as it is the replaced synonym",
250 250
                            botName4, list.get(0).getName());
......
286 286
        Assert.assertEquals(botName2, list.get(3).getName());
287 287

  
288 288
        //add replaced synonym relation between basionyms
289
        botName5.addReplacedSynonym(botName4, null, null, null);
289
        botName5.addReplacedSynonym(botName4, null, null, null, null);
290 290
        Collections.sort(list, new HomotypicGroupTaxonComparator(null));
291 291
        Assert.assertEquals("basionym of second group should come first now as it is the replaced synonym",
292 292
                            botName4, list.get(0).getName());
......
439 439

  
440 440
        taxon1.addHomotypicSynonymName(botName3);
441 441
        taxon1.addHomotypicSynonymName(botName5);
442
        botName3.addReplacedSynonym(botName5, null, null, null);
442
        botName3.addReplacedSynonym(botName5, null, null, null, null);
443 443

  
444 444
        Assert.assertEquals(botName1.getHomotypicalGroup(), botName5.getHomotypicalGroup());
445
        botName5.addReplacedSynonym(botName1, null, null, null);
446
        botName1.addReplacedSynonym(botName3, null, null, null);
445
        botName5.addReplacedSynonym(botName1, null, null, null, null);
446
        botName1.addReplacedSynonym(botName3, null, null, null, null);
447 447

  
448 448
        list.addAll(taxon1.getSynonyms());
449 449
        list.add(taxon1);
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/name/TaxonNameDefaultCacheStrategyTest.java
311 311
    	Assert.assertEquals("Preconditions are wrong", "Abies alpa", originalName.getTitleCache());
312 312
        Assert.assertEquals("Name cache should not show original spelling", "Abies alpa", originalName.getNameCache());
313 313

  
314
    	speciesName.addRelationshipFromName(originalName, origSpellingType, null);
314
    	speciesName.addRelationshipFromName(originalName, origSpellingType, null, null);
315 315
    	Assert.assertEquals("Abies alba [as \"alpa\"]", speciesName.getFullTitleCache());
316 316
        Assert.assertEquals("Abies alba", speciesName.getTitleCache());
317 317
        Assert.assertEquals("Name cache should not show original spelling", "Abies alba", speciesName.getNameCache());
......
326 326
    	//#3665
327 327
    	INonViralName correctName = NonViralNameParserImpl.NewInstance().parseFullName("Nepenthes glabrata J.R.Turnbull & A.T.Middleton");
328 328
    	TaxonName originalSpelling = (TaxonName)NonViralNameParserImpl.NewInstance().parseFullName("Nepenthes glabratus");
329
    	correctName.addRelationshipFromName(originalSpelling, origSpellingType, null);
329
    	correctName.addRelationshipFromName(originalSpelling, origSpellingType, null, null);
330 330
    	Assert.assertEquals("Nepenthes glabrata", correctName.getNameCache());
331 331
    	Assert.assertEquals("Nepenthes glabrata J.R.Turnbull & A.T.Middleton", correctName.getTitleCache());
332 332
    	Assert.assertEquals("Nepenthes glabrata J.R.Turnbull & A.T.Middleton [as \"glabratus\"]", correctName.getFullTitleCache());
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/merge/DefaultMergeStrategyTest.java
332 332
		botName2.setAnamorphic(false);
333 333

  
334 334
		//name relations
335
		botName2.addBasionym(botName3, book1, "p.22", null);
335
		botName2.addBasionym(botName3, book1, "p.22", null, null);
336 336
		DerivedUnit specimen1 = DerivedUnit.NewPreservedSpecimenInstance();
337 337
		botName2.addSpecimenTypeDesignation(specimen1, SpecimenTypeDesignationStatus.HOLOTYPE(), book2, "p.56", "originalNameString", false, true);
338 338

  
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/data/FullCoverageDataGenerator.java
886 886
		zooName.addDescription(TaxonNameDescription.NewInstance());
887 887
		zooName.setNomenclaturalMicroReference("p. 123");
888 888
		zooName.setNomenclaturalReference(getReference());
889
		NameRelationship rel = zooName.addRelationshipFromName(botName, NameRelationshipType.LATER_HOMONYM() , "ruleConsidered");
890
		rel.setCodeEdition(NomenclaturalCodeEdition.ICN_2017_SHENZHEN);
889
		NameRelationship rel = zooName.addRelationshipFromName(botName, NameRelationshipType.LATER_HOMONYM() , "ruleConsidered", NomenclaturalCodeEdition.ICN_2017_SHENZHEN);
891 890
		NomenclaturalStatus status = NomenclaturalStatus.NewInstance(NomenclaturalStatusType.CONSERVED(), getReference(), "p. 222");
892 891
		zooName.addStatus(status);
893 892
		handleAnnotatableEntity(rel);
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/NameServiceImplTest.java
154 154
        nameWithBasionym.setTitleCache("nameWithBasionym", true);
155 155

  
156 156
        NameRelationshipType nameRelType = (NameRelationshipType)termService.find(NameRelationshipType.BASIONYM().getUuid());
157
        name1.addRelationshipToName(nameWithBasionym,nameRelType , null, null, null);
157
        name1.addRelationshipToName(nameWithBasionym,nameRelType , null, null, null, null);
158 158
//		nameWithBasionym.addBasionym(name1);
159 159
        nameService.save(name1);
160 160
        nameService.save(nameWithBasionym);
......
199 199
        nameWithBasionym.setTitleCache("nameWithBasionym", true);
200 200

  
201 201
        NameRelationshipType nameRelType = (NameRelationshipType)termService.find(NameRelationshipType.BASIONYM().getUuid());
202
        name1.addRelationshipToName(nameWithBasionym,nameRelType , null, null, null);
202
        name1.addRelationshipToName(nameWithBasionym,nameRelType , null, null, null, null);
203 203
        nameService.save(name1);
204 204
        nameService.save(nameWithBasionym);
205 205
        commitAndStartNewTransaction(tableNames);
......
236 236
        nameWithBasionym.setTitleCache("nameWithBasionym", true);
237 237

  
238 238
        NameRelationshipType nameRelType = (NameRelationshipType)termService.find(NameRelationshipType.BASIONYM().getUuid());
239
        name1.addRelationshipToName(nameWithBasionym,nameRelType , null, null, null);
239
        name1.addRelationshipToName(nameWithBasionym,nameRelType , null, null, null, null);
240 240
        nameService.save(name1);
241 241
        nameService.save(nameWithBasionym);
242 242
        commitAndStartNewTransaction(tableNames);
......
273 273
        basionym.setTitleCache("basionym", true);
274 274

  
275 275
        NameRelationshipType nameRelType = (NameRelationshipType)termService.find(NameRelationshipType.BASIONYM().getUuid());
276
        basionym.addRelationshipToName(name1,nameRelType , null, null, null);
276
        basionym.addRelationshipToName(name1,nameRelType , null, null, null, null);
277 277
        nameService.save(name1);
278 278
        nameService.save(basionym);
279 279
        commitAndStartNewTransaction(tableNames);
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/TaxonNodeServiceImplTest.java
149 149
		//nameRelations
150 150

  
151 151
		TaxonName relatedName = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
152
		t1.getName().addRelationshipFromName(relatedName, NameRelationshipType.ALTERNATIVE_NAME(), null );
152
		t1.getName().addRelationshipFromName(relatedName, NameRelationshipType.ALTERNATIVE_NAME(), null, null );
153 153

  
154 154
		//taxonRelations
155 155
		Taxon relatedTaxon = Taxon.NewInstance(TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES()), null);
......
241 241

  
242 242
		//nameRelations
243 243
		TaxonName relatedName = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
244
		t1.getName().addRelationshipFromName(relatedName, NameRelationshipType.ALTERNATIVE_NAME(), null );
244
		t1.getName().addRelationshipFromName(relatedName, NameRelationshipType.ALTERNATIVE_NAME(), null, null );
245 245
		TaxonName name1 = t1.getName();
246 246
		UUID name1UUID = name1.getUuid();
247 247
		//taxonRelations
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/TaxonServiceImplTest.java
865 865
        TaxonName name2 = nameService.load(uuidSynonymName2);
866 866
        UUID name3Uuid = synonym1.getName().getUuid();
867 867
        TaxonName name3 = nameService.load(name3Uuid);
868
        name3.addRelationshipFromName(name2, NameRelationshipType.LATER_HOMONYM(), null);
868
        name3.addRelationshipFromName(name2, NameRelationshipType.LATER_HOMONYM(), null, null);
869 869

  
870 870
        service.saveOrUpdate(synonym1);
871 871

  
......
920 920
        TaxonName name2 = nameService.load(uuidSynonymName2);
921 921
        UUID name3Uuid = synonym1.getName().getUuid();
922 922
        TaxonName name3 = nameService.load(name3Uuid);
923
        name3.addRelationshipFromName(name2, NameRelationshipType.LATER_HOMONYM(), null);
923
        name3.addRelationshipFromName(name2, NameRelationshipType.LATER_HOMONYM(), null, null);
924 924

  
925 925
        service.saveOrUpdate(synonym1);
926 926

  
......
968 968
        TaxonName synName2 = nameService.load(uuidSynonymName2);
969 969
        UUID name3Uuid = synonym1.getName().getUuid();
970 970
        TaxonName synName1 = nameService.load(name3Uuid);
971
        synName1.addRelationshipFromName(synName2, NameRelationshipType.BASIONYM(), null);
971
        synName1.addRelationshipFromName(synName2, NameRelationshipType.BASIONYM(), null, null);
972 972

  
973 973
        service.saveOrUpdate(synonym1);
974 974

  
......
1024 1024

  
1025 1025
        Synonym synonym1 = (Synonym)service.load(uuidSynonym1);
1026 1026
        TaxonName name2 = nameService.load(uuidSynonymName2);
1027
        synonym1.getName().addRelationshipFromName(name2, NameRelationshipType.LATER_HOMONYM(), null);
1027
        synonym1.getName().addRelationshipFromName(name2, NameRelationshipType.LATER_HOMONYM(), null, null);
1028 1028

  
1029 1029
        service.deleteSynonym(synonym1, new SynonymDeletionConfigurator());
1030 1030

  
......
1062 1062

  
1063 1063
        Synonym synonym1 = (Synonym)service.load(uuidSynonym1);
1064 1064
        TaxonName name2 = nameService.load(uuidSynonymName2);
1065
        synonym1.getName().addRelationshipFromName(name2, NameRelationshipType.LATER_HOMONYM(), null);
1065
        synonym1.getName().addRelationshipFromName(name2, NameRelationshipType.LATER_HOMONYM(), null, null);
1066 1066

  
1067 1067
        service.saveOrUpdate(synonym1);
1068 1068
        nRelations = service.countSynonyms(true);
......
1463 1463
        IBotanicalName taxonName = nameService.find(SPECIES1_NAME_UUID);
1464 1464
        assertNotNull(taxonName);
1465 1465
        TaxonName fromName = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
1466
        taxonName.addRelationshipFromName(fromName, NameRelationshipType.VALIDATED_BY_NAME(), null);
1466
        taxonName.addRelationshipFromName(fromName, NameRelationshipType.VALIDATED_BY_NAME(), null, null);
1467 1467
        nameService.save(fromName);
1468 1468

  
1469 1469
        TaxonDeletionConfigurator config = new TaxonDeletionConfigurator();
......
1984 1984
            basionym.setGenusOrUninomial("Hieracilla");
1985 1985
            basionym.setCombinationAuthorship(deCandolle);
1986 1986
            basionym.setUuid(BASIONYM_UUID);
1987
            botName.addBasionym(basionym, null, null,"216");
1987
            botName.addBasionym(basionym, null, null,"216", null);
1988 1988
            nameService.saveOrUpdate(basionym);
1989 1989
            //species taxon that is the child of genus taxon
1990 1990
            IBotanicalName botSpecies = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
cdmlib-services/src/test/java/eu/etaxonomy/cdm/datagenerator/TaxonGenerator.java
77 77
        basionym.setGenusOrUninomial("Hieracilla");
78 78
        basionym.setCombinationAuthorship(deCandolle);
79 79
        basionym.setUuid(BASIONYM_UUID);
80
        botName.addBasionym(basionym, null, null,"216");
80
        botName.addBasionym(basionym, null, null,"216", null);
81 81

  
82 82
        //species taxon that is the child of genus taxon
83 83
        IBotanicalName botSpecies = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
cdmlib-services/src/test/java/eu/etaxonomy/cdm/test/function/Datasource.java
422 422
		    TaxonName botName1 = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
423 423
			TaxonName botName2 = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
424 424
			IBotanicalName hybridName = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
425
			botName1.addRelationshipToName(botName2, NameRelationshipType.ORTHOGRAPHIC_VARIANT(), null);
425
			botName1.addRelationshipToName(botName2, NameRelationshipType.ORTHOGRAPHIC_VARIANT(), null, null);
426 426
			UUID uuid1 = botName1.getUuid();
427 427
			UUID uuid2 = botName2.getUuid();
428 428
			try {
cdmlib-services/src/test/java/eu/etaxonomy/cdm/test/integration/TestTaxonServices.java
97 97
		name1 = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES(),"Name1",null,"arvensis",null,(TeamOrPersonBase)linne,null,"p.1", null);
98 98
		name2 = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES(),"Name2",null,"lanzae",null,(TeamOrPersonBase)linne,null,"p.2", null);
99 99

  
100
		name1.addRelationshipToName(name2, NameRelationshipType.BASIONYM(), "ruleTo");
101
		name2.addRelationshipFromName(name1, NameRelationshipType.BASIONYM(), "ruleFrom");
100
		name1.addRelationshipToName(name2, NameRelationshipType.BASIONYM(), "ruleTo", null);
101
		name2.addRelationshipFromName(name1, NameRelationshipType.BASIONYM(), "ruleFrom", null);
102 102

  
103 103
		appCtr.getNameService().save(name1);
104 104
		appCtr.getNameService().save(name2);

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)