use of org.opencastproject.security.api.JaxbGroupList in project opencast by opencast.
the class JpaGroupRoleProvider method getGroupsAsXml.
@GET
@Produces(MediaType.APPLICATION_XML)
@Path("groups.xml")
@RestQuery(name = "allgroupsasxml", description = "Returns a list of groups", returnDescription = "Returns a XML representation of the list of groups available the current user's organization", restParameters = { @RestParameter(defaultValue = "100", description = "The maximum number of items to return per page.", isRequired = false, name = "limit", type = RestParameter.Type.STRING), @RestParameter(defaultValue = "0", description = "The page number.", isRequired = false, name = "offset", type = RestParameter.Type.STRING) }, reponses = { @RestResponse(responseCode = SC_OK, description = "The groups.") })
public JaxbGroupList getGroupsAsXml(@QueryParam("limit") int limit, @QueryParam("offset") int offset) throws IOException {
if (limit < 1)
limit = 100;
String orgId = securityService.getOrganization().getId();
JaxbGroupList groupList = new JaxbGroupList();
List<JpaGroup> groups = UserDirectoryPersistenceUtil.findGroups(orgId, limit, offset, emf);
for (JpaGroup group : groups) {
groupList.add(group);
}
return groupList;
}