for (String role : from.getRoles()) {
HAccountRole hAccountRole = accountRoleDAO.findByName(role);
if (hAccountRole == null) {
// generate error for missing role
log.debug("Invalid role '{}'", role);
throw new NoLogWebApplicationException(Response
.status(Status.BAD_REQUEST)
.entity("Invalid role '" + role + "'").build());
}
to.getRoles().add(hAccountRole);
}
hPerson.getLanguageMemberships().clear();
for (String tribe : from.getTribes()) {
HLocale hTribe = localeDAO.findByLocaleId(new LocaleId(tribe));
if (hTribe == null)
// generate error for missing tribe
throw new NoLogWebApplicationException(Response
.status(Status.BAD_REQUEST)
.entity("Invalid tribe '" + tribe + "'").build());
hPerson.getLanguageMemberships().add(hTribe);
}