personDAO.getAllLanguageTeamMemberships(obsoletePerson);
List<HLocaleMember> activeMemberships =
personDAO.getAllLanguageTeamMemberships(activePerson);
for (HLocaleMember obsoleteMembership : obsoleteMemberships) {
HLocaleMember activeMembership = null;
for (HLocaleMember m : activeMemberships) {
if (m.getPerson().getId()
.equals(obsoleteMembership.getPerson().getId())
&& m.getSupportedLanguage()
.getLocaleId()
.equals(obsoleteMembership
.getSupportedLanguage()
.getLocaleId())) {
activeMembership = m;
break;
}
}
if (activeMembership == null) {
activeMembership =
new HLocaleMember(activePerson,
obsoleteMembership.getSupportedLanguage(),
obsoleteMembership.isTranslator(),
obsoleteMembership.isReviewer(),
obsoleteMembership.isCoordinator());
}
activeMembership.setCoordinator(activeMembership
.isCoordinator() || obsoleteMembership.isCoordinator());
entityManager.remove(obsoleteMembership);
}
// Link all merged accounts