@Path(value="/collections") public class CollectionsResource extends Resource
| Modifier and Type | Field and Description |
|---|---|
protected AuthorizeService |
authorizeService |
protected CollectionService |
collectionService |
protected InstallItemService |
installItemService |
protected ItemService |
itemService |
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 InstallItemService installItemService
@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.headers - If you want to access to collection under logged user into
context. In headers must be set header "rest-dspace-token"
with passed token from login method.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.headers - If you want to access to collections under logged user into
context. In headers must be set header "rest-dspace-token"
with passed token from login method.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.headers - If you want to access to collection under logged user into
context. In headers must be set header "rest-dspace-token"
with passed token from login method.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.headers - If you want to access to collection under logged user into
context. In headers must be set header "rest-dspace-token"
with passed token from login method.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.headers - If you want to access to collection under logged user into
context. In headers must be set header "rest-dspace-token"
with passed token from login method.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.headers - If you want to access to collection under logged user into
context. In headers must be set header "rest-dspace-token"
with passed token from login method.javax.ws.rs.WebApplicationException - It is throw when was 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.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 to collection under logged user into
context. In headers must be set header "rest-dspace-token"
with passed token from login method.javax.ws.rs.WebApplicationExceptionCopyright © 2016 DuraSpace. All rights reserved.