Project

General

Profile

« Previous | Next » 

Revision 2b772077

Added by Andreas Müller over 3 years ago

ref #4770 fix handling nomenclatural title for convertPerson2Team

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/AgentServiceImpl.java
233 233
			team.setProtectedNomenclaturalTitleCache(false);
234 234
			team.setProtectedTitleCache(true);
235 235
			team.setTitleCache(person.getTitleCache(), true);
236
	        team.setNomenclaturalTitle(person.getNomenclaturalTitle(), true);
236 237
			team = this.save(team);
237 238
			genericDao.merge(team, person, strategy);
238
			//team.addTeamMember(person);
239
			//team.addTeamMember(person); it is not wanted to keep the person as member
239 240

  
240
			//this.save(team);
241
//			team.setNomenclaturalTitle(person.getNomenclaturalTitle(), true);
242 241
		} catch (Exception e) {
243 242
			throw new MergeException("Unhandled merge exception", e);
244 243
		}
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IAgentService.java
155 155
	 * <BR>
156 156
	 * If the person can not be replaced a {@link MergeException} is thrown.
157 157
	 *
158
	 * The new team is created by setting the titleCache and nomenclaturalTitle to protected
159
	 * and copy it. Also supplemental data is copied to the team.
160
	 * The old person is fully deleted, not added as member to the new team.
161
	 *
158 162
	 * @param person the {@link Person} to be converted
159 163
	 * @return the new team that replaces the given person
160 164
	 * @throws MergeException if anything else goes wrong during merge
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/AgentServiceImplTest.java
86 86
			Assert.fail("No Merge exception should be thrown");
87 87
		}
88 88
    	Assert.assertNotNull(team);
89
    	//Assert.assertEquals("Title cache must be equal", fullAuthor, team.getTitleCache());
90
    	//Assert.assertEquals("Nom. title must be equal", nomTitle, team.getNomenclaturalTitle());
89
    	Assert.assertEquals("Title cache must be equal", fullAuthor, team.getTitleCache());
90
    	Assert.assertEquals("Nom. title must be equal", nomTitle, team.getNomenclaturalTitle());
91
    	Assert.assertTrue("Members must be empty", team.getTeamMembers().isEmpty());
91 92
    	Assert.assertEquals("Annotations should be moved", 1, team.getAnnotations().size());
92 93
       	Assert.assertNotNull("Contact must be copied too", team.getContact());
93 94
    	Assert.assertEquals("Team must be combination author now", team, name.getCombinationAuthorship());

Also available in: Unified diff