use of fi.otavanopisto.muikku.schooldata.SchoolDataBridgeInternalException in project muikku by otavanopisto.
the class LocalUserSchoolDataBridge method listUserEmailsByUserIdentifier.
/**
* {@inheritDoc}
*/
@Override
public List<UserEmail> listUserEmailsByUserIdentifier(String userIdentifier) {
if (!StringUtils.isNumeric(userIdentifier)) {
throw new SchoolDataBridgeInternalException("userIdentifier is invalid");
}
List<UserEmail> result = new ArrayList<>();
List<LocalUserEmail> emails = localUserSchoolDataController.listUserEmailsByUserIdentifier(userIdentifier);
for (LocalUserEmail email : emails) {
UserEmail emailImpl = toLocalUserEmailImpl(email);
if (emailImpl != null) {
result.add(emailImpl);
} else {
throw new SchoolDataBridgeInternalException("Unexpected error occured while listing LocalUserEmails");
}
}
return result;
}
Aggregations