/
Group Service (java)
NOTE: Trivore ID Documentation has moved to https://trivoreid.com
The content on this site IS OUT OF DATE!
This space has been archived!
Please go ahead to the new site!
Group Service (java)
Wrapper for the '/group' API.
List of all options:
Get all
Create/get one/update/delete a group
Get list of IDs by namespace code and name
Initialize service
TrivoreID sdk = TrivoreID.mgmtApiClient();
GroupServiceImpl groupService = new GroupServiceImpl(sdk.groupService());
Group management
// get all groups that belong to the namespace with the code "example"
Filter filter = Filter.equal("nsCode", "example");
groupService.getAll(new Criteria(filter));
// create new group
Group group = new Group();
group.setNsCode("example");
group.setName("gr003");
// this will return new group with the newly generated ID
group = groupService.create(group);
// update group
group.setDescription("Example group for the TrivoreID SDK");
groupService.update(group);
// get one group by ID
groupService.get(group.getId());
// get group by its name and nsCode
Group group2 = groupService.getByNameAndCode("exampleName", "nsCode");
// delete group
groupService.delete(group2.getId());
// return list of group IDs by the namespace code and list of names.
// NB! The length of the returned list may differ from the list with
// the group names if the group with default name and nsCode was
// not found. Then the warning message will be logged.
List<String> groupNames = Arrays.asList("gr001", "gr002", "gr003");
List<String> groupIDs = groupService.checkGroupIds("nsCode", groupNames);