@Path(value="/collections") public class CollectionsResource extends Resource
| Modifier and Type | Field and Description |
|---|---|
protected AuthorizeService |
authorizeService |
protected CollectionService |
collectionService |
protected ItemService |
itemService |
protected WorkflowService |
workflowService |
protected WorkspaceItemService |
workspaceItemService |
servletContext| Constructor and Description |
|---|
CollectionsResource() |
| Modifier and Type | Method and Description |
|---|---|
Item |
addCollectionItem(String collectionId,
Item item,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Create item in collection.
|
javax.ws.rs.core.Response |
deleteCollection(String collectionId,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Delete collection.
|
javax.ws.rs.core.Response |
deleteCollectionItem(String collectionId,
String itemId,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Delete item in collection.
|
Collection |
findCollectionByName(String name,
javax.ws.rs.core.HttpHeaders headers)
Search for first collection with passed name.
|
Collection |
getCollection(String collectionId,
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 instance of collection with passed id.
|
Item[] |
getCollectionItems(String collectionId,
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 array of items in collection.
|
Collection[] |
getCollections(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 array of all collections in DSpace.
|
javax.ws.rs.core.Response |
updateCollection(String collectionId,
Collection collection,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request)
Update collection.
|
createContext, getActionString, mySplit, processException, processFinally, writeStatsprotected CollectionService collectionService
protected ItemService itemService
protected AuthorizeService authorizeService
protected WorkspaceItemService workspaceItemService
protected WorkflowService workflowService
@GET
@Path(value="/{collection_id}")
@Produces(value={"application/json","application/xml"})
public Collection getCollection(@PathParam(value="collection_id")
String collectionId,
@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
collectionId - Id of collection 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 - Limit value for items in list in collection. Default value is
100.offset - Offset of start index in list of items of collection. 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 collection 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
(SQLException) or problem with creating
context(ContextException). It is thrown by NOT_FOUND and
UNATHORIZED status codes, too.@GET
@Produces(value={"application/json","application/xml"})
public Collection[] getCollections(@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 collection. Options are: "all", "parentCommunityList",
"parentCommunity", "items", "license" and "logo". If you want
to use multiple options, it must be separated by commas.limit - Limit value for items in list in collection. Default value is
100.offset - Offset of start index in list of items of collection. 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 collections 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
(SQLException) or problem with creating
context(ContextException).@GET
@Path(value="/{collection_id}/items")
@Produces(value={"application/json","application/xml"})
public Item[] getCollectionItems(@PathParam(value="collection_id")
String collectionId,
@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
collectionId - Id of collection in DSpace.expand - String which define, what additional properties will be in
returned item. Options are separeted by commas and are: "all",
"metadata", "parentCollection", "parentCollectionList",
"parentCommunityList" and "bitstreams".limit - Limit value for items in array. Default value is 100.offset - Offset of start index in array of items of collection. 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 collection 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
(SQLException) or problem with creating
context(ContextException). It is thrown by NOT_FOUND and
UNATHORIZED status codes, too.@POST
@Path(value="/{collection_id}/items")
@Consumes(value={"application/json","application/xml"})
public Item addCollectionItem(@PathParam(value="collection_id")
String collectionId,
Item item,
@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
collectionId - Id of collection in which will be item created.item - Item filled only with metadata, other variables are ignored.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 collection 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 (SQLException) or problem with creating
context(ContextException) or problem with authorization to
collection or IOException or problem with index item into
browse index. It is thrown by NOT_FOUND and UNATHORIZED
status codes, too.@PUT
@Path(value="/{collection_id}")
@Consumes(value={"application/json","application/xml"})
public javax.ws.rs.core.Response updateCollection(@PathParam(value="collection_id")
String collectionId,
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
collectionId - Id of collection in DSpace.collection - Collection which will replace properties of actual collection.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 collection 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 collection. Or
problem with creating context.@DELETE
@Path(value="/{collection_id}")
@Consumes(value={"application/json","application/xml"})
public javax.ws.rs.core.Response deleteCollection(@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
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 collection 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 deleting
collection caused by IOException or authorization.@DELETE
@Path(value="/{collection_id}/items/{item_id}")
@Consumes(value={"application/json","application/xml"})
public javax.ws.rs.core.Response deleteCollectionItem(@PathParam(value="collection_id")
String collectionId,
@PathParam(value="item_id")
String itemId,
@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
collectionId - Id of collection which will be deleted.itemId - Id of item in colletion.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 collection 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, when was problem with
database reading or writting. AuthorizeException, when was
problem with authorization to item or collection.
IOException, when was problem with removing item.
ContextException, when was problem with creating context of
DSpace.@POST
@Path(value="/find-collection")
@Consumes(value={"application/json","application/xml"})
@Produces(value={"application/json","application/xml"})
public Collection findCollectionByName(String name,
@Context
javax.ws.rs.core.HttpHeaders headers)
throws javax.ws.rs.WebApplicationException
name - Name of collection.headers - If you want to access the collection 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.javax.ws.rs.WebApplicationException - A general exception a servlet can throw when it encounters difficulty.Copyright © 2019 DuraSpace. All rights reserved.