Revision 58a9c0ab
Added by Andreas Müller over 3 years ago
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/AgentServiceImpl.java | ||
---|---|---|
219 | 219 |
|
220 | 220 |
@Override |
221 | 221 |
public UpdateResult convertPerson2Team(Person person) throws MergeException, IllegalArgumentException { |
222 |
if (person == null){ |
|
223 |
throw new IllegalArgumentException("Person does not exist."); |
|
224 |
} |
|
222 | 225 |
UpdateResult result = new UpdateResult(); |
223 | 226 |
Team team = Team.NewInstance(); |
224 | 227 |
ConvertMergeStrategy strategy = ConvertMergeStrategy.NewInstance(TeamOrPersonBase.class); |
... | ... | |
228 | 231 |
strategy.setMergeMode("protectedTitleCache", MergeMode.FIRST); //as we do not add team members, the titleCache of the new team should be always protected |
229 | 232 |
strategy.setDeleteSecondObject(true); |
230 | 233 |
|
231 |
if (! genericDao.isMergeable(team, person, strategy)){
|
|
234 |
if (! genericDao.isMergeable(team, person, strategy)){
|
|
232 | 235 |
throw new MergeException("Person can not be transformed into team."); |
233 | 236 |
} |
234 | 237 |
try { |
Also available in: Unified diff
ref #4770, ref #4908 handle person is null in person2Team converter