Project

General

Profile

« Previous | Next » 

Revision 34965c7d

Added by Katja Luther almost 5 years ago

fix #8315: fix Parser in TaxEditor to avoid inReference change of existing references

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/parser/ParseHandler.java
61 61
		if(name == null){
62 62
			this.name = nonViralNameParser.getNonViralNameInstance("", PreferencesUtil.getPreferredNomenclaturalCode());
63 63
		}else{
64
			this.name = (INonViralName) HibernateProxyHelper.deproxy(name);
64
			this.name = HibernateProxyHelper.deproxy(name);
65 65
		}
66 66
	}
67 67

  
......
102 102
	public static TaxonName parseName(String unparsedNameString, Rank rank){
103 103
		INonViralName name = nonViralNameParser.parseFullName(unparsedNameString,
104 104
				PreferencesUtil.getPreferredNomenclaturalCode(), rank);
105
		
105

  
106 106
		return (TaxonName)name;
107 107
	}
108 108

  
......
180 180

  
181 181
		resolveDuplicateReferences(name, matchMatrix);
182 182

  
183
		if(matchMatrix.duplicateInReferences != null) {
184
            resolveDuplicateInReferences(name, matchMatrix);
185
        }
183
//		if(matchMatrix.duplicateInReferences != null) {
184
//            resolveDuplicateInReferences(name, matchMatrix);
185
//        }
186 186
	}
187 187

  
188 188

  
......
212 212
			INomenclaturalReference duplicate = matchMatrix.duplicateReferences.iterator().next();
213 213
			name.setNomenclaturalReference(duplicate);
214 214
		}
215
		//if reference is new but the in reference is already in db
216
		if (matchMatrix.duplicateReferences.size() == 0 && name.getNomenclaturalReference().getInReference() != null && matchMatrix.duplicateInReferences.size() > 0){
217
		    resolveDuplicateInReferences(name, matchMatrix);
218
		}
215 219
	}
216 220

  
217 221
	/**
218 222
	 * @param name The name to resolve duplicates for.
219 223
	 */
220
	private void resolveDuplicateInReferences(INonViralName name, MatchMatrix matchMatrix) {
221
		Reference reference = (Reference) HibernateProxyHelper.deproxy(name.getNomenclaturalReference());
224
 	private void resolveDuplicateInReferences(INonViralName name, MatchMatrix matchMatrix) {
225
		Reference reference = HibernateProxyHelper.deproxy(name.getNomenclaturalReference());
222 226

  
223 227
		if(matchMatrix.duplicateInReferences.size() > 0){
224 228
			Reference inReference = (Reference) matchMatrix.duplicateInReferences.iterator().next();
......
237 241

  
238 242
		if(matchMatrix.duplicateCombinationAuthorships.size() > 0){
239 243
			name.setCombinationAuthorship(matchMatrix.duplicateCombinationAuthorships.iterator().next());
240
			Reference reference = (Reference) name.getNomenclaturalReference();
244
			Reference reference = name.getNomenclaturalReference();
241 245
			if(reference != null){
242 246
				reference.setAuthorship(matchMatrix.duplicateCombinationAuthorships.iterator().next());
243 247
			}

Also available in: Unified diff