Search in sources :

Example 21 with SchoolDataBridgeInternalException

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;
}
Also used : SchoolDataBridgeInternalException(fi.otavanopisto.muikku.schooldata.SchoolDataBridgeInternalException) ArrayList(java.util.ArrayList) LocalUserEmail(fi.otavanopisto.muikku.plugins.schooldatalocal.model.LocalUserEmail) UserEmail(fi.otavanopisto.muikku.schooldata.entity.UserEmail) LocalUserEmail(fi.otavanopisto.muikku.plugins.schooldatalocal.model.LocalUserEmail)

Aggregations

SchoolDataBridgeInternalException (fi.otavanopisto.muikku.schooldata.SchoolDataBridgeInternalException)21 Student (fi.otavanopisto.pyramus.rest.model.Student)7 StudentGroupStudent (fi.otavanopisto.pyramus.rest.model.StudentGroupStudent)7 ArrayList (java.util.ArrayList)7 PyramusUserProperty (fi.otavanopisto.muikku.plugins.schooldatapyramus.entities.PyramusUserProperty)3 StaffMember (fi.otavanopisto.pyramus.rest.model.StaffMember)3 LocalUser (fi.otavanopisto.muikku.plugins.schooldatalocal.model.LocalUser)2 LocalUserEmail (fi.otavanopisto.muikku.plugins.schooldatalocal.model.LocalUserEmail)2 LocalUserImage (fi.otavanopisto.muikku.plugins.schooldatalocal.model.LocalUserImage)2 PyramusCourseIdentifier (fi.otavanopisto.muikku.plugins.schooldatapyramus.entities.PyramusCourseIdentifier)2 PyramusRestClientUnauthorizedException (fi.otavanopisto.muikku.plugins.schooldatapyramus.rest.PyramusRestClientUnauthorizedException)2 SchoolDataBridgeUnauthorizedException (fi.otavanopisto.muikku.schooldata.SchoolDataBridgeUnauthorizedException)2 UserAddress (fi.otavanopisto.muikku.schooldata.entity.UserAddress)2 Address (fi.otavanopisto.pyramus.rest.model.Address)2 ContactType (fi.otavanopisto.pyramus.rest.model.ContactType)2 Course (fi.otavanopisto.pyramus.rest.model.Course)2 EnvironmentRoleEntity (fi.otavanopisto.muikku.model.users.EnvironmentRoleEntity)1 RoleEntity (fi.otavanopisto.muikku.model.users.RoleEntity)1 WorkspaceRoleEntity (fi.otavanopisto.muikku.model.workspace.WorkspaceRoleEntity)1 CourseIdentifier (fi.otavanopisto.muikku.schooldata.entity.CourseIdentifier)1