use of com.blackducksoftware.integration.hub.api.generated.view.UserView in project hub-alert by blackducksoftware.
the class EmailGroupChannel method getEmailAddressesForGroup.
private List<String> getEmailAddressesForGroup(final HubServicesFactory hubServicesFactory, final String hubGroup) throws IntegrationException {
final UserGroupService groupService = hubServicesFactory.createUserGroupService();
final UserGroupView userGroupView = groupService.getGroupByName(hubGroup);
if (userGroupView == null) {
throw new IntegrationException("Could not find the Hub group: " + hubGroup);
}
logger.info(userGroupView.toString());
logger.info(userGroupView.json);
final List<UserView> users = hubServicesFactory.createHubService().getAllResponses(userGroupView, UserGroupView.USERS_LINK_RESPONSE);
return users.stream().map(user -> user.email).collect(Collectors.toList());
}
Aggregations