@Path(value="/communities") public class CommunitiesResource extends Resource
| Modifier and Type | Field and Description |
|---|---|
protected AuthorizeService |
authorizeService |
protected CollectionService |
collectionService |
protected CommunityService |
communityService |
servletContext| Constructor and Description |
|---|
CommunitiesResource() |
| Modifier and Type | Method and Description |
|---|---|
Collection |
addCommunityCollection(String communityId,
Collection collection,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Create collection in community.
|
Community |
addCommunityCommunity(String communityId,
Community community,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Create subcommunity in community.
|
Community |
createCommunity(Community community,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Create community at top level.
|
javax.ws.rs.core.Response |
deleteCommunity(String communityId,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Delete community from DSpace.
|
javax.ws.rs.core.Response |
deleteCommunityCollection(String communityId,
String collectionId,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Delete collection in community.
|
javax.ws.rs.core.Response |
deleteCommunityCommunity(String parentCommunityId,
String subcommunityId,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Delete subcommunity in community.
|
Community[] |
getCommunities(String expand,
Integer limit,
Integer offset,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Return all communities in DSpace.
|
Community |
getCommunity(String communityId,
String expand,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Returns community with basic properties.
|
Collection[] |
getCommunityCollections(String communityId,
String expand,
Integer limit,
Integer offset,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Return all collections of community.
|
Community[] |
getCommunityCommunities(String communityId,
String expand,
Integer limit,
Integer offset,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Return all subcommunities of community.
|
Community[] |
getTopCommunities(String expand,
Integer limit,
Integer offset,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Return all top communities in DSpace.
|
javax.ws.rs.core.Response |
updateCommunity(String communityId,
Community community,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Update community.
|
createContext, getActionString, mySplit, processException, processFinally, writeStatsprotected CommunityService communityService
protected CollectionService collectionService
protected AuthorizeService authorizeService
@GET
@Path(value="/{community_id}")
@Produces(value={"application/json","application/xml"})
public Community getCommunity(@PathParam(value="community_id")
String communityId,
@QueryParam(value="expand")
String expand,
@QueryParam(value="userIP")
String user_ip,
@QueryParam(value="userAgent")
String user_agent,
@QueryParam(value="xforwardedfor")
String xforwardedfor,
@Context
javax.ws.rs.core.HttpHeaders headers,
@Context
javax.servlet.http.HttpServletRequest request)
throws javax.ws.rs.WebApplicationException
communityId - Id of community in DSpace.expand - String in which is what you want to add to returned instance
of community. Options are: "all", "parentCommunity",
"collections", "subCommunities" and "logo". If you want to use
multiple options, it must be separated by commas.user_ip - User's IP address.user_agent - User agent string (specifies browser used and its version).xforwardedfor - When accessed via a reverse proxy, the application sees the proxy's IP as the
source of the request. The proxy may be configured to add the
"X-Forwarded-For" HTTP header containing the original IP of the client
so that the reverse-proxied application can get the client's IP.headers - If you want to access the community as the user logged into the
context. The value of the "rest-dspace-token" header must be set
to the token received from the login method response.request - Servlet's HTTP request object.javax.ws.rs.WebApplicationException - Thrown if there was a problem with creating context or problem
with database reading. Also if id of community is incorrect
or logged user into context has no permission to read.@GET
@Produces(value={"application/json","application/xml"})
public Community[] getCommunities(@QueryParam(value="expand")
String expand,
@QueryParam(value="limit") @DefaultValue(value="100")
Integer limit,
@QueryParam(value="offset") @DefaultValue(value="0")
Integer offset,
@QueryParam(value="userIP")
String user_ip,
@QueryParam(value="userAgent")
String user_agent,
@QueryParam(value="xforwardedfor")
String xforwardedfor,
@Context
javax.ws.rs.core.HttpHeaders headers,
@Context
javax.servlet.http.HttpServletRequest request)
throws javax.ws.rs.WebApplicationException
expand - String in which is what you want to add to returned instance
of community. Options are: "all", "parentCommunity",
"collections", "subCommunities" and "logo". If you want to use
multiple options, it must be separated by commas.limit - Maximum communities in array. Default value is 100.offset - Index from which will start array of communities.user_ip - User's IP address.user_agent - User agent string (specifies browser used and its version).xforwardedfor - When accessed via a reverse proxy, the application sees the proxy's IP as the
source of the request. The proxy may be configured to add the
"X-Forwarded-For" HTTP header containing the original IP of the client
so that the reverse-proxied application can get the client's IP.headers - If you want to access the community as the user logged into the
context. The value of the "rest-dspace-token" header must be set
to the token received from the login method response.request - Servlet's HTTP request object.javax.ws.rs.WebApplicationException - It can be caused by creating context or while was problem
with reading community from database(SQLException).@GET
@Path(value="/top-communities")
@Produces(value={"application/json","application/xml"})
public Community[] getTopCommunities(@QueryParam(value="expand")
String expand,
@QueryParam(value="limit") @DefaultValue(value="20")
Integer limit,
@QueryParam(value="offset") @DefaultValue(value="0")
Integer offset,
@QueryParam(value="userIP")
String user_ip,
@QueryParam(value="userAgent")
String user_agent,
@QueryParam(value="xforwardedfor")
String xforwardedfor,
@Context
javax.ws.rs.core.HttpHeaders headers,
@Context
javax.servlet.http.HttpServletRequest request)
throws javax.ws.rs.WebApplicationException
expand - String in which is what you want to add to returned instance
of community. Options are: "all", "parentCommunity",
"collections", "subCommunities" and "logo". If you want to use
multiple options, it must be separated by commas.limit - Maximum communities in array. Default value is 100.offset - Index from which will start array of communities. Default
value is 0.user_ip - User's IP address.user_agent - User agent string (specifies browser used and its version).xforwardedfor - When accessed via a reverse proxy, the application sees the proxy's IP as the
source of the request. The proxy may be configured to add the
"X-Forwarded-For" HTTP header containing the original IP of the client
so that the reverse-proxied application can get the client's IP.headers - If you want to access the community as the user logged into the
context. The value of the "rest-dspace-token" header must be set
to the token received from the login method response.request - Servlet's HTTP request object.javax.ws.rs.WebApplicationException - It can be caused by creating context or while was problem
with reading community from database(SQLException).@GET
@Path(value="/{community_id}/collections")
@Produces(value={"application/json","application/xml"})
public Collection[] getCommunityCollections(@PathParam(value="community_id")
String communityId,
@QueryParam(value="expand")
String expand,
@QueryParam(value="limit") @DefaultValue(value="100")
Integer limit,
@QueryParam(value="offset") @DefaultValue(value="0")
Integer offset,
@QueryParam(value="userIP")
String user_ip,
@QueryParam(value="userAgent")
String user_agent,
@QueryParam(value="xforwardedfor")
String xforwardedfor,
@Context
javax.ws.rs.core.HttpHeaders headers,
@Context
javax.servlet.http.HttpServletRequest request)
throws javax.ws.rs.WebApplicationException
communityId - Id of community in DSpace.expand - String in which is what you want to add to returned instance
of collection. Options are: "all", "parentCommunityList",
"parentCommunity", "items", "license" and "logo". If you want
to use multiple options, it must be separated by commas.limit - Maximum collection in array. Default value is 100.offset - Index from which will start array of collections. Default
value is 0.user_ip - User's IP address.user_agent - User agent string (specifies browser used and its version).xforwardedfor - When accessed via a reverse proxy, the application sees the proxy's IP as the
source of the request. The proxy may be configured to add the
"X-Forwarded-For" HTTP header containing the original IP of the client
so that the reverse-proxied application can get the client's IP.headers - If you want to access the community as the user logged into the
context. The value of the "rest-dspace-token" header must be set
to the token received from the login method response.request - Servlet's HTTP request object.javax.ws.rs.WebApplicationException - It can be caused by creating context or while was problem
with reading community from database(SQLException).@GET
@Path(value="/{community_id}/communities")
@Produces(value={"application/json","application/xml"})
public Community[] getCommunityCommunities(@PathParam(value="community_id")
String communityId,
@QueryParam(value="expand")
String expand,
@QueryParam(value="limit") @DefaultValue(value="20")
Integer limit,
@QueryParam(value="offset") @DefaultValue(value="0")
Integer offset,
@QueryParam(value="userIP")
String user_ip,
@QueryParam(value="userAgent")
String user_agent,
@QueryParam(value="xforwardedfor")
String xforwardedfor,
@Context
javax.ws.rs.core.HttpHeaders headers,
@Context
javax.servlet.http.HttpServletRequest request)
throws javax.ws.rs.WebApplicationException
communityId - Id of community in DSpace.expand - String in which is what you want to add to returned instance
of community. Options are: "all", "parentCommunity",
"collections", "subCommunities" and "logo". If you want to use
multiple options, it must be separated by commas.limit - Maximum communities in array. Default value is 20.offset - Index from which will start array of communities. Default
value is 0.user_ip - User's IP address.user_agent - User agent string (specifies browser used and its version).xforwardedfor - When accessed via a reverse proxy, the application sees the proxy's IP as the
source of the request. The proxy may be configured to add the
"X-Forwarded-For" HTTP header containing the original IP of the client
so that the reverse-proxied application can get the client's IP.headers - If you want to access the community as the user logged into the
context. The value of the "rest-dspace-token" header must be set
to the token received from the login method response.request - Servlet's HTTP request object.javax.ws.rs.WebApplicationException - It can be caused by creating context or while was problem
with reading community from database(SQLException).@POST
@Consumes(value={"application/json","application/xml"})
public Community createCommunity(Community community,
@QueryParam(value="userIP")
String user_ip,
@QueryParam(value="userAgent")
String user_agent,
@QueryParam(value="xforwardedfor")
String xforwardedfor,
@Context
javax.ws.rs.core.HttpHeaders headers,
@Context
javax.servlet.http.HttpServletRequest request)
throws javax.ws.rs.WebApplicationException
community - Community which will be created at top level of communities.user_ip - User's IP address.user_agent - User agent string (specifies browser used and its version).xforwardedfor - When accessed via a reverse proxy, the application sees the proxy's IP as the
source of the request. The proxy may be configured to add the
"X-Forwarded-For" HTTP header containing the original IP of the client
so that the reverse-proxied application can get the client's IP.headers - If you want to access the community as the user logged into the
context. The value of the "rest-dspace-token" header must be set
to the token received from the login method response.request - Servlet's HTTP request object.javax.ws.rs.WebApplicationException - It can be thrown by SQLException, AuthorizeException and
ContextException.@POST
@Path(value="/{community_id}/collections")
@Consumes(value={"application/json","application/xml"})
public Collection addCommunityCollection(@PathParam(value="community_id")
String communityId,
Collection collection,
@QueryParam(value="userIP")
String user_ip,
@QueryParam(value="userAgent")
String user_agent,
@QueryParam(value="xforwardedfor")
String xforwardedfor,
@Context
javax.ws.rs.core.HttpHeaders headers,
@Context
javax.servlet.http.HttpServletRequest request)
throws javax.ws.rs.WebApplicationException
communityId - Id of community in DSpace.collection - Collection which will be added into community.user_ip - User's IP address.user_agent - User agent string (specifies browser used and its version).xforwardedfor - When accessed via a reverse proxy, the application sees the proxy's IP as the
source of the request. The proxy may be configured to add the
"X-Forwarded-For" HTTP header containing the original IP of the client
so that the reverse-proxied application can get the client's IP.headers - If you want to access the community as the user logged into the
context. The value of the "rest-dspace-token" header must be set
to the token received from the login method response.request - Servlet's HTTP request object.javax.ws.rs.WebApplicationException - It is thrown when was problem with database reading or
writing. Or problem with authorization to community. Or
problem with creating context.@POST
@Path(value="/{community_id}/communities")
@Consumes(value={"application/json","application/xml"})
public Community addCommunityCommunity(@PathParam(value="community_id")
String communityId,
Community community,
@QueryParam(value="userIP")
String user_ip,
@QueryParam(value="userAgent")
String user_agent,
@QueryParam(value="xforwardedfor")
String xforwardedfor,
@Context
javax.ws.rs.core.HttpHeaders headers,
@Context
javax.servlet.http.HttpServletRequest request)
throws javax.ws.rs.WebApplicationException
communityId - Id of community in DSpace, in which will be created
subcommunity.community - Community which will be added into community.user_ip - User's IP address.user_agent - User agent string (specifies browser used and its version).xforwardedfor - When accessed via a reverse proxy, the application sees the proxy's IP as the
source of the request. The proxy may be configured to add the
"X-Forwarded-For" HTTP header containing the original IP of the client
so that the reverse-proxied application can get the client's IP.headers - If you want to access the community as the user logged into the
context. The value of the "rest-dspace-token" header must be set
to the token received from the login method response.request - Servlet's HTTP request object.javax.ws.rs.WebApplicationException - It is thrown when was problem with database reading or
writing. Or problem with authorization to community. Or
problem with creating context.@PUT
@Path(value="/{community_id}")
@Consumes(value={"application/json","application/xml"})
public javax.ws.rs.core.Response updateCommunity(@PathParam(value="community_id")
String communityId,
Community community,
@QueryParam(value="userIP")
String user_ip,
@QueryParam(value="userAgent")
String user_agent,
@QueryParam(value="xforwardedfor")
String xforwardedfor,
@Context
javax.ws.rs.core.HttpHeaders headers,
@Context
javax.servlet.http.HttpServletRequest request)
throws javax.ws.rs.WebApplicationException
communityId - Id of community in DSpace.community - Instance of community which will replace actual community in
DSpace.user_ip - User's IP address.user_agent - User agent string (specifies browser used and its version).xforwardedfor - When accessed via a reverse proxy, the application sees the proxy's IP as the
source of the request. The proxy may be configured to add the
"X-Forwarded-For" HTTP header containing the original IP of the client
so that the reverse-proxied application can get the client's IP.headers - If you want to access the community as the user logged into the
context. The value of the "rest-dspace-token" header must be set
to the token received from the login method response.request - Servlet's HTTP request object.javax.ws.rs.WebApplicationException - Thrown if there was a problem with creating context or problem
with database reading or writing. Or problem with writing to
community caused by authorization.@DELETE
@Path(value="/{community_id}")
public javax.ws.rs.core.Response deleteCommunity(@PathParam(value="community_id")
String communityId,
@QueryParam(value="userIP")
String user_ip,
@QueryParam(value="userAgent")
String user_agent,
@QueryParam(value="xforwardedfor")
String xforwardedfor,
@Context
javax.ws.rs.core.HttpHeaders headers,
@Context
javax.servlet.http.HttpServletRequest request)
throws javax.ws.rs.WebApplicationException
communityId - Id of community in DSpace.user_ip - User's IP address.user_agent - User agent string (specifies browser used and its version).xforwardedfor - When accessed via a reverse proxy, the application sees the proxy's IP as the
source of the request. The proxy may be configured to add the
"X-Forwarded-For" HTTP header containing the original IP of the client
so that the reverse-proxied application can get the client's IP.headers - If you want to access the community as the user logged into the
context. The value of the "rest-dspace-token" header must be set
to the token received from the login method response.request - Servlet's HTTP request object.javax.ws.rs.WebApplicationException - Thrown if there was a problem with creating context or problem
with database reading or deleting. Or problem with deleting
community caused by IOException or authorization.@DELETE
@Path(value="/{community_id}/collections/{collection_id}")
public javax.ws.rs.core.Response deleteCommunityCollection(@PathParam(value="community_id")
String communityId,
@PathParam(value="collection_id")
String collectionId,
@QueryParam(value="userIP")
String user_ip,
@QueryParam(value="userAgent")
String user_agent,
@QueryParam(value="xforwardedfor")
String xforwardedfor,
@Context
javax.ws.rs.core.HttpHeaders headers,
@Context
javax.servlet.http.HttpServletRequest request)
throws javax.ws.rs.WebApplicationException
communityId - Id of community in DSpace.collectionId - Id of collection which will be deleted.user_ip - User's IP address.user_agent - User agent string (specifies browser used and its version).xforwardedfor - When accessed via a reverse proxy, the application sees the proxy's IP as the
source of the request. The proxy may be configured to add the
"X-Forwarded-For" HTTP header containing the original IP of the client
so that the reverse-proxied application can get the client's IP.headers - If you want to access the community as the user logged into the
context. The value of the "rest-dspace-token" header must be set
to the token received from the login method response.request - Servlet's HTTP request object.javax.ws.rs.WebApplicationException - Thrown if there was a problem with creating context or problem
with database reading or deleting. Or problem with deleting
collection caused by IOException or authorization.@DELETE
@Path(value="/{community_id}/communities/{community_id2}")
public javax.ws.rs.core.Response deleteCommunityCommunity(@PathParam(value="community_id")
String parentCommunityId,
@PathParam(value="community_id2")
String subcommunityId,
@QueryParam(value="userIP")
String user_ip,
@QueryParam(value="userAgent")
String user_agent,
@QueryParam(value="xforwardedfor")
String xforwardedfor,
@Context
javax.ws.rs.core.HttpHeaders headers,
@Context
javax.servlet.http.HttpServletRequest request)
throws javax.ws.rs.WebApplicationException
parentCommunityId - Id of community in DSpace.subcommunityId - Id of community which will be deleted.user_ip - User's IP address.user_agent - User agent string (specifies browser used and its version).xforwardedfor - When accessed via a reverse proxy, the application sees the proxy's IP as the
source of the request. The proxy may be configured to add the
"X-Forwarded-For" HTTP header containing the original IP of the client
so that the reverse-proxied application can get the client's IP.headers - If you want to access the community as the user logged into the
context. The value of the "rest-dspace-token" header must be set
to the token received from the login method response.request - Servlet's HTTP request object.javax.ws.rs.WebApplicationException - Thrown if there was a problem with creating context or problem
with database reading or deleting. Or problem with deleting
subcommunity caused by IOException or authorization.Copyright © 2019 DuraSpace. All rights reserved.