use of org.broadinstitute.consent.http.service.UserService.SimplifiedUser in project consent by DataBiosphere.
the class InstitutionWithUsersReducer method accumulate.
@Override
public void accumulate(Map<Integer, Institution> map, RowView rowView) {
Institution institution = map.computeIfAbsent(rowView.getColumn("institution_id", Integer.class), id -> rowView.getRow(Institution.class));
User create_user = new User();
if (Objects.nonNull(rowView.getColumn("u_dacuserid", Integer.class))) {
create_user = rowView.getRow(User.class);
}
User update_user = new User();
update_user.setDacUserId(rowView.getColumn("u2_dacuserid", Integer.class));
update_user.setEmail(rowView.getColumn("u2_email", String.class));
update_user.setDisplayName(rowView.getColumn("u2_displayname", String.class));
update_user.setCreateDate(rowView.getColumn("u2_createdate", Timestamp.class));
update_user.setAdditionalEmail(rowView.getColumn("u2_additional_email", String.class));
update_user.setEmailPreference(rowView.getColumn("u2_email_preference", Boolean.class));
update_user.setEraCommonsId(rowView.getColumn("u2_era_commons_id", String.class));
institution.setCreateUser(create_user);
institution.setUpdateUser(update_user);
if (Objects.nonNull(rowView.getColumn("so_dacuserid", Integer.class))) {
SimplifiedUser so_user = new SimplifiedUser();
so_user = rowView.getRow(SimplifiedUser.class);
institution.addSigningOfficial(so_user);
}
}
use of org.broadinstitute.consent.http.service.UserService.SimplifiedUser in project consent by DataBiosphere.
the class UserServiceTest method testFindSOsByInstitutionId.
@Test
public void testFindSOsByInstitutionId() {
User u = generateUser();
Integer institutionId = u.getInstitutionId();
when(userDAO.getSOsByInstitution(any())).thenReturn(List.of(u, u, u));
initService();
List<SimplifiedUser> users = service.findSOsByInstitutionId(institutionId);
assertEquals(3, users.size());
assertEquals(u.getDisplayName(), users.get(0).displayName);
assertEquals(u.getEmail(), users.get(0).email);
}
Aggregations