Search in sources :

Example 1 with JaxbGroupList

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;
}
Also used : JpaGroup(org.opencastproject.security.impl.jpa.JpaGroup) JaxbGroupList(org.opencastproject.security.api.JaxbGroupList) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) RestQuery(org.opencastproject.util.doc.rest.RestQuery)

Aggregations

GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 JaxbGroupList (org.opencastproject.security.api.JaxbGroupList)1 JpaGroup (org.opencastproject.security.impl.jpa.JpaGroup)1 RestQuery (org.opencastproject.util.doc.rest.RestQuery)1