Skip to content

Commit

Permalink
Remove getAllAvailableGroups method as ExperimenterWrapper::getGroups…
Browse files Browse the repository at this point in the history
… should give the same results
  • Loading branch information
ppouchin committed Sep 22, 2023
1 parent 6570453 commit ac916df
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions src/main/java/fr/igred/omero/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -372,37 +372,6 @@ public GroupWrapper getGroup(long groupId)
}


/**
* List of all groups to which the specified user belongs
*
* @param userId The ID of the user
*
* @return the list of groups
*
* @throws ServiceException Cannot connect to OMERO.
* @throws AccessException Cannot access data.
* @throws ExecutionException A Facility can't be retrieved or instantiated.
*/
public List<GroupWrapper> getAllAvailableGroups(long userId)
throws ServiceException, AccessException, ExecutionException {
String error = String.format("Cannot retrieve available groups from user %d: ", userId);
List<ExperimenterGroup> groups = ExceptionHandler.of(getGateway(),
g -> g.getAdminService(getCtx()).containedGroups(userId))
.handleServiceOrAccess(error)
.get();

if (groups != null && !groups.isEmpty()) {
List<GroupWrapper> groupWrappers = new ArrayList<>(groups.size());
for (ExperimenterGroup group : groups) {
groupWrappers.add(getGroup(group.getName().getValue()));
}
return groupWrappers;
} else {
throw new NoSuchElementException(String.format("Groups not found for user: %d", userId));
}
}


/**
* Gets the client associated with the username in the parameters. The user calling this function needs to have
* administrator rights. All action realized with the client returned will be considered as his.
Expand Down

0 comments on commit ac916df

Please sign in to comment.