Change REST ID's to string, we can look them up with findByIdOrLegacyId

This commit is contained in:
Peter Dietz
2015-09-18 00:25:13 -04:00
parent 140fad8051
commit dc4b91effd
4 changed files with 53 additions and 53 deletions

View File

@@ -98,7 +98,7 @@ public class BitstreamResource extends Resource
@GET
@Path("/{bitstream_id}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Bitstream getBitstream(@PathParam("bitstream_id") Integer bitstreamId, @QueryParam("expand") String expand,
public Bitstream getBitstream(@PathParam("bitstream_id") String bitstreamId, @QueryParam("expand") String expand,
@QueryParam("userIP") String user_ip, @QueryParam("userAgent") String user_agent,
@QueryParam("xforwardedfor") String xforwardedfor, @Context HttpHeaders headers, @Context HttpServletRequest request)
throws WebApplicationException
@@ -154,7 +154,7 @@ public class BitstreamResource extends Resource
@GET
@Path("/{bitstream_id}/policy")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public ResourcePolicy[] getBitstreamPolicies(@PathParam("bitstream_id") Integer bitstreamId, @Context HttpHeaders headers)
public ResourcePolicy[] getBitstreamPolicies(@PathParam("bitstream_id") String bitstreamId, @Context HttpHeaders headers)
{
log.info("Reading bitstream(id=" + bitstreamId + ") policies.");
@@ -294,7 +294,7 @@ public class BitstreamResource extends Resource
*/
@GET
@Path("/{bitstream_id}/retrieve")
public javax.ws.rs.core.Response getBitstreamData(@PathParam("bitstream_id") Integer bitstreamId,
public javax.ws.rs.core.Response getBitstreamData(@PathParam("bitstream_id") String bitstreamId,
@QueryParam("userIP") String user_ip, @QueryParam("userAgent") String user_agent,
@QueryParam("xforwardedfor") String xforwardedfor, @Context HttpHeaders headers, @Context HttpServletRequest request)
throws WebApplicationException
@@ -364,7 +364,7 @@ public class BitstreamResource extends Resource
@POST
@Path("/{bitstream_id}/policy")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public javax.ws.rs.core.Response addBitstreamPolicy(@PathParam("bitstream_id") Integer bitstreamId, ResourcePolicy policy,
public javax.ws.rs.core.Response addBitstreamPolicy(@PathParam("bitstream_id") String bitstreamId, ResourcePolicy policy,
@QueryParam("userIP") String user_ip, @QueryParam("userAgent") String user_agent,
@QueryParam("xforwardedfor") String xforwardedfor, @Context HttpHeaders headers, @Context HttpServletRequest request)
throws WebApplicationException
@@ -435,7 +435,7 @@ public class BitstreamResource extends Resource
@PUT
@Path("/{bitstream_id}")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response updateBitstream(@PathParam("bitstream_id") Integer bitstreamId, Bitstream bitstream,
public Response updateBitstream(@PathParam("bitstream_id") String bitstreamId, Bitstream bitstream,
@QueryParam("userIP") String user_ip, @QueryParam("userAgent") String user_agent,
@QueryParam("xforwardedfor") String xforwardedfor, @Context HttpHeaders headers, @Context HttpServletRequest request)
throws WebApplicationException
@@ -540,7 +540,7 @@ public class BitstreamResource extends Resource
// TODO Change to better logic, without editing database.
@PUT
@Path("/{bitstream_id}/data")
public Response updateBitstreamData(@PathParam("bitstream_id") Integer bitstreamId, InputStream is,
public Response updateBitstreamData(@PathParam("bitstream_id") String bitstreamId, InputStream is,
@QueryParam("userIP") String user_ip, @QueryParam("userAgent") String user_agent,
@QueryParam("xforwardedfor") String xforwardedfor, @Context HttpHeaders headers, @Context HttpServletRequest request)
throws WebApplicationException
@@ -610,7 +610,7 @@ public class BitstreamResource extends Resource
*/
@DELETE
@Path("/{bitstream_id}")
public Response deleteBitstream(@PathParam("bitstream_id") Integer bitstreamId, @QueryParam("userIP") String user_ip,
public Response deleteBitstream(@PathParam("bitstream_id") String bitstreamId, @QueryParam("userIP") String user_ip,
@QueryParam("userAgent") String user_agent, @QueryParam("xforwardedfor") String xforwardedfor,
@Context HttpHeaders headers, @Context HttpServletRequest request) throws WebApplicationException
{
@@ -670,7 +670,7 @@ public class BitstreamResource extends Resource
*/
@DELETE
@Path("/{bitstream_id}/policy/{policy_id}")
public javax.ws.rs.core.Response deleteBitstreamPolicy(@PathParam("bitstream_id") Integer bitstreamId,
public javax.ws.rs.core.Response deleteBitstreamPolicy(@PathParam("bitstream_id") String bitstreamId,
@PathParam("policy_id") Integer policyId, @QueryParam("userIP") String user_ip, @QueryParam("userAgent") String user_agent,
@QueryParam("xforwardedfor") String xforwardedfor, @Context HttpHeaders headers, @Context HttpServletRequest request)
throws WebApplicationException
@@ -687,7 +687,7 @@ public class BitstreamResource extends Resource
request, context);
org.dspace.authorize.ResourcePolicy resourcePolicy = resourcePolicyService.find(context, policyId);
if(resourcePolicy.getdSpaceObject() == dspaceBitstream && authorizeService.authorizeActionBoolean(context, dspaceBitstream, org.dspace.core.Constants.REMOVE)) {
if(resourcePolicy.getdSpaceObject().getID() == dspaceBitstream.getID() && authorizeService.authorizeActionBoolean(context, dspaceBitstream, org.dspace.core.Constants.REMOVE)) {
try {
resourcePolicyService.delete(context, resourcePolicy);
@@ -766,13 +766,13 @@ public class BitstreamResource extends Resource
* Is thrown when item with passed id is not exists and if user
* has no permission to do passed action.
*/
private org.dspace.content.Bitstream findBitstream(org.dspace.core.Context context, int id, int action)
private org.dspace.content.Bitstream findBitstream(org.dspace.core.Context context, String id, int action)
throws WebApplicationException
{
org.dspace.content.Bitstream bitstream = null;
try
{
bitstream = bitstreamService.findByIdOrLegacyId(context, Integer.toString(id));
bitstream = bitstreamService.findByIdOrLegacyId(context, id);
if ((bitstream == null) || (bitstreamService.getParentObject(context, bitstream) == null))
{

View File

@@ -96,7 +96,7 @@ public class CollectionsResource extends Resource
@GET
@Path("/{collection_id}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public org.dspace.rest.common.Collection getCollection(@PathParam("collection_id") Integer collectionId,
public org.dspace.rest.common.Collection getCollection(@PathParam("collection_id") String collectionId,
@QueryParam("expand") String expand, @QueryParam("limit") @DefaultValue("100") Integer limit,
@QueryParam("offset") @DefaultValue("0") Integer offset, @QueryParam("userIP") String user_ip,
@QueryParam("userAgent") String user_agent, @QueryParam("xforwardedfor") String xforwardedfor,
@@ -251,7 +251,7 @@ public class CollectionsResource extends Resource
@GET
@Path("/{collection_id}/items")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public org.dspace.rest.common.Item[] getCollectionItems(@PathParam("collection_id") Integer collectionId,
public org.dspace.rest.common.Item[] getCollectionItems(@PathParam("collection_id") String collectionId,
@QueryParam("expand") String expand, @QueryParam("limit") @DefaultValue("100") Integer limit,
@QueryParam("offset") @DefaultValue("0") Integer offset, @QueryParam("userIP") String user_ip,
@QueryParam("userAgent") String user_agent, @QueryParam("xforwardedfor") String xforwardedfor,
@@ -332,7 +332,7 @@ public class CollectionsResource extends Resource
@POST
@Path("/{collection_id}/items")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Item addCollectionItem(@PathParam("collection_id") Integer collectionId, Item item,
public Item addCollectionItem(@PathParam("collection_id") String collectionId, Item item,
@QueryParam("userIP") String user_ip, @QueryParam("userAgent") String user_agent,
@QueryParam("xforwardedfor") String xforwardedfor, @Context HttpHeaders headers, @Context HttpServletRequest request)
throws WebApplicationException
@@ -427,7 +427,7 @@ public class CollectionsResource extends Resource
@PUT
@Path("/{collection_id}")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response updateCollection(@PathParam("collection_id") Integer collectionId,
public Response updateCollection(@PathParam("collection_id") String collectionId,
org.dspace.rest.common.Collection collection, @QueryParam("userIP") String user_ip,
@QueryParam("userAgent") String user_agent, @QueryParam("xforwardedfor") String xforwardedfor,
@Context HttpHeaders headers, @Context HttpServletRequest request) throws WebApplicationException
@@ -496,7 +496,7 @@ public class CollectionsResource extends Resource
@DELETE
@Path("/{collection_id}")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response deleteCollection(@PathParam("collection_id") Integer collectionId, @QueryParam("userIP") String user_ip,
public Response deleteCollection(@PathParam("collection_id") String collectionId, @QueryParam("userIP") String user_ip,
@QueryParam("userAgent") String user_agent, @QueryParam("xforwardedfor") String xforwardedfor,
@Context HttpHeaders headers, @Context HttpServletRequest request) throws WebApplicationException
{
@@ -563,7 +563,7 @@ public class CollectionsResource extends Resource
@DELETE
@Path("/{collection_id}/items/{item_id}")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response deleteCollectionItem(@PathParam("collection_id") Integer collectionId, @PathParam("item_id") Integer itemId,
public Response deleteCollectionItem(@PathParam("collection_id") String collectionId, @PathParam("item_id") String itemId,
@QueryParam("userIP") String user_ip, @QueryParam("userAgent") String user_agent,
@QueryParam("xforwardedfor") String xforwardedfor, @Context HttpHeaders headers, @Context HttpServletRequest request)
throws WebApplicationException
@@ -576,8 +576,8 @@ public class CollectionsResource extends Resource
{
context = createContext(getUser(headers));
org.dspace.content.Collection dspaceCollection = collectionService.findByLegacyId(context, collectionId);
org.dspace.content.Item item = itemService.findByLegacyId(context, itemId);
org.dspace.content.Collection dspaceCollection = collectionService.findByIdOrLegacyId(context, collectionId);
org.dspace.content.Item item = itemService.findByIdOrLegacyId(context, itemId);
if(dspaceCollection == null) {
@@ -731,13 +731,13 @@ public class CollectionsResource extends Resource
* Is thrown when item with passed id is not exists and if user
* has no permission to do passed action.
*/
private org.dspace.content.Collection findCollection(org.dspace.core.Context context, int id, int action)
private org.dspace.content.Collection findCollection(org.dspace.core.Context context, String id, int action)
throws WebApplicationException
{
org.dspace.content.Collection collection = null;
try
{
collection = collectionService.findByLegacyId(context, id);
collection = collectionService.findByIdOrLegacyId(context, id);
if (collection == null)
{

View File

@@ -70,7 +70,7 @@ public class CommunitiesResource extends Resource
@GET
@Path("/{community_id}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Community getCommunity(@PathParam("community_id") Integer communityId, @QueryParam("expand") String expand,
public Community getCommunity(@PathParam("community_id") String communityId, @QueryParam("expand") String expand,
@QueryParam("userIP") String user_ip, @QueryParam("userAgent") String user_agent,
@QueryParam("xforwardedfor") String xforwardedfor, @Context HttpHeaders headers, @Context HttpServletRequest request)
throws WebApplicationException
@@ -299,7 +299,7 @@ public class CommunitiesResource extends Resource
@GET
@Path("/{community_id}/collections")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Collection[] getCommunityCollections(@PathParam("community_id") Integer communityId,
public Collection[] getCommunityCollections(@PathParam("community_id") String communityId,
@QueryParam("expand") String expand, @QueryParam("limit") @DefaultValue("100") Integer limit,
@QueryParam("offset") @DefaultValue("0") Integer offset, @QueryParam("userIP") String user_ip,
@QueryParam("userAgent") String user_agent, @QueryParam("xforwardedfor") String xforwardedfor,
@@ -385,7 +385,7 @@ public class CommunitiesResource extends Resource
@GET
@Path("/{community_id}/communities")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Community[] getCommunityCommunities(@PathParam("community_id") Integer communityId,
public Community[] getCommunityCommunities(@PathParam("community_id") String communityId,
@QueryParam("expand") String expand, @QueryParam("limit") @DefaultValue("20") Integer limit,
@QueryParam("offset") @DefaultValue("0") Integer offset, @QueryParam("userIP") String user_ip,
@QueryParam("userAgent") String user_agent, @QueryParam("xforwardedfor") String xforwardedfor,
@@ -544,7 +544,7 @@ public class CommunitiesResource extends Resource
@POST
@Path("/{community_id}/collections")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Collection addCommunityCollection(@PathParam("community_id") Integer communityId, Collection collection,
public Collection addCommunityCollection(@PathParam("community_id") String communityId, Collection collection,
@QueryParam("userIP") String user_ip, @QueryParam("userAgent") String user_agent,
@QueryParam("xforwardedfor") String xforwardedfor, @Context HttpHeaders headers, @Context HttpServletRequest request)
throws WebApplicationException
@@ -626,7 +626,7 @@ public class CommunitiesResource extends Resource
@POST
@Path("/{community_id}/communities")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Community addCommunityCommunity(@PathParam("community_id") Integer communityId, Community community,
public Community addCommunityCommunity(@PathParam("community_id") String communityId, Community community,
@QueryParam("userIP") String user_ip, @QueryParam("userAgent") String user_agent,
@QueryParam("xforwardedfor") String xforwardedfor, @Context HttpHeaders headers, @Context HttpServletRequest request)
throws WebApplicationException
@@ -704,7 +704,7 @@ public class CommunitiesResource extends Resource
@PUT
@Path("/{community_id}")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response updateCommunity(@PathParam("community_id") Integer communityId, Community community,
public Response updateCommunity(@PathParam("community_id") String communityId, Community community,
@QueryParam("userIP") String user_ip, @QueryParam("userAgent") String user_agent,
@QueryParam("xforwardedfor") String xforwardedfor, @Context HttpHeaders headers, @Context HttpServletRequest request)
throws WebApplicationException
@@ -767,7 +767,7 @@ public class CommunitiesResource extends Resource
*/
@DELETE
@Path("/{community_id}")
public Response deleteCommunity(@PathParam("community_id") Integer communityId, @QueryParam("userIP") String user_ip,
public Response deleteCommunity(@PathParam("community_id") String communityId, @QueryParam("userIP") String user_ip,
@QueryParam("userAgent") String user_agent, @QueryParam("xforwardedfor") String xforwardedfor,
@Context HttpHeaders headers, @Context HttpServletRequest request) throws WebApplicationException
{
@@ -836,8 +836,8 @@ public class CommunitiesResource extends Resource
*/
@DELETE
@Path("/{community_id}/collections/{collection_id}")
public Response deleteCommunityCollection(@PathParam("community_id") Integer communityId,
@PathParam("collection_id") Integer collectionId, @QueryParam("userIP") String user_ip,
public Response deleteCommunityCollection(@PathParam("community_id") String communityId,
@PathParam("collection_id") String collectionId, @QueryParam("userIP") String user_ip,
@QueryParam("userAgent") String user_agent, @QueryParam("xforwardedfor") String xforwardedfor,
@Context HttpHeaders headers, @Context HttpServletRequest request) throws WebApplicationException
{
@@ -850,7 +850,7 @@ public class CommunitiesResource extends Resource
context = createContext(getUser(headers));
org.dspace.content.Community community = findCommunity(context, communityId, org.dspace.core.Constants.WRITE);
org.dspace.content.Collection collection = collectionService.findByLegacyId(context, collectionId);
org.dspace.content.Collection collection = collectionService.findByIdOrLegacyId(context, collectionId);
if (collection == null)
{
@@ -934,8 +934,8 @@ public class CommunitiesResource extends Resource
*/
@DELETE
@Path("/{community_id}/communities/{community_id2}")
public Response deleteCommunityCommunity(@PathParam("community_id") Integer parentCommunityId,
@PathParam("community_id2") Integer subcommunityId, @QueryParam("userIP") String user_ip,
public Response deleteCommunityCommunity(@PathParam("community_id") String parentCommunityId,
@PathParam("community_id2") String subcommunityId, @QueryParam("userIP") String user_ip,
@QueryParam("userAgent") String user_agent, @QueryParam("xforwardedfor") String xforwardedfor,
@Context HttpHeaders headers, @Context HttpServletRequest request) throws WebApplicationException
{
@@ -949,7 +949,7 @@ public class CommunitiesResource extends Resource
org.dspace.content.Community parentCommunity = findCommunity(context, parentCommunityId,
org.dspace.core.Constants.WRITE);
org.dspace.content.Community subcommunity = communityService.findByLegacyId(context, subcommunityId);
org.dspace.content.Community subcommunity = communityService.findByIdOrLegacyId(context, subcommunityId);
if (subcommunity == null)
{
@@ -999,7 +999,7 @@ public class CommunitiesResource extends Resource
catch (ContextException e)
{
processException("Could not delete subcommunity(id=" + subcommunityId + ") in community(id=" + parentCommunityId
+ "), ContextExcpetion. Message:" + e.getMessage(), context);
+ "), ContextException. Message:" + e.getMessage(), context);
}
finally
{
@@ -1027,13 +1027,13 @@ public class CommunitiesResource extends Resource
* Is thrown when item with passed id is not exists and if user
* has no permission to do passed action.
*/
private org.dspace.content.Community findCommunity(org.dspace.core.Context context, int id, int action)
private org.dspace.content.Community findCommunity(org.dspace.core.Context context, String id, int action)
throws WebApplicationException
{
org.dspace.content.Community community = null;
try
{
community = communityService.findByLegacyId(context, id);
community = communityService.findByIdOrLegacyId(context, id);
if (community == null)
{

View File

@@ -88,7 +88,7 @@ public class ItemsResource extends Resource
@GET
@Path("/{item_id}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Item getItem(@PathParam("item_id") Integer itemId, @QueryParam("expand") String expand,
public Item getItem(@PathParam("item_id") String itemId, @QueryParam("expand") String expand,
@QueryParam("userIP") String user_ip, @QueryParam("userAgent") String user_agent,
@QueryParam("xforwardedfor") String xforwardedfor, @Context HttpHeaders headers, @Context HttpServletRequest request)
throws WebApplicationException
@@ -225,7 +225,7 @@ public class ItemsResource extends Resource
@GET
@Path("/{item_id}/metadata")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public MetadataEntry[] getItemMetadata(@PathParam("item_id") Integer itemId, @QueryParam("userIP") String user_ip,
public MetadataEntry[] getItemMetadata(@PathParam("item_id") String itemId, @QueryParam("userIP") String user_ip,
@QueryParam("userAgent") String user_agent, @QueryParam("xforwardedfor") String xforwardedfor,
@Context HttpHeaders headers, @Context HttpServletRequest request) throws WebApplicationException
{
@@ -283,7 +283,7 @@ public class ItemsResource extends Resource
@GET
@Path("/{item_id}/bitstreams")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Bitstream[] getItemBitstreams(@PathParam("item_id") Integer itemId,
public Bitstream[] getItemBitstreams(@PathParam("item_id") String itemId,
@QueryParam("limit") @DefaultValue("20") Integer limit, @QueryParam("offset") @DefaultValue("0") Integer offset,
@QueryParam("userIP") String user_ip, @QueryParam("userAgent") String user_agent,
@QueryParam("xforwardedfor") String xforwardedfor, @Context HttpHeaders headers, @Context HttpServletRequest request)
@@ -355,7 +355,7 @@ public class ItemsResource extends Resource
@POST
@Path("/{item_id}/metadata")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response addItemMetadata(@PathParam("item_id") Integer itemId, List<org.dspace.rest.common.MetadataEntry> metadata,
public Response addItemMetadata(@PathParam("item_id") String itemId, List<org.dspace.rest.common.MetadataEntry> metadata,
@QueryParam("userIP") String user_ip, @QueryParam("userAgent") String user_agent,
@QueryParam("xforwardedfor") String xforwardedfor, @Context HttpHeaders headers, @Context HttpServletRequest request)
throws WebApplicationException
@@ -427,9 +427,9 @@ public class ItemsResource extends Resource
// TODO Add option to add bitstream by URI.(for very big files)
@POST
@Path("/{item_id}/bitstreams")
public Bitstream addItemBitstream(@PathParam("item_id") Integer itemId, InputStream inputStream,
public Bitstream addItemBitstream(@PathParam("item_id") String itemId, InputStream inputStream,
@QueryParam("name") String name, @QueryParam("description") String description,
@QueryParam("groupId") Integer groupId, @QueryParam("year") Integer year, @QueryParam("month") Integer month,
@QueryParam("groupId") String groupId, @QueryParam("year") Integer year, @QueryParam("month") Integer month,
@QueryParam("day") Integer day, @QueryParam("userIP") String user_ip, @QueryParam("userAgent") String user_agent,
@QueryParam("xforwardedfor") String xforwardedfor, @Context HttpHeaders headers, @Context HttpServletRequest request)
throws WebApplicationException
@@ -511,7 +511,7 @@ public class ItemsResource extends Resource
org.dspace.authorize.ResourcePolicy dspacePolicy = resourcePolicyService.create(context);
dspacePolicy.setAction(org.dspace.core.Constants.READ);
dspacePolicy.setGroup(groupService.findByLegacyId(context, groupId));
dspacePolicy.setGroup(groupService.findByIdOrLegacyId(context, groupId));
dspacePolicy.setdSpaceObject(dspaceBitstream);
if ((year != null) || (month != null) || (day != null))
{
@@ -538,7 +538,7 @@ public class ItemsResource extends Resource
}
}
dspaceBitstream = bitstreamService.findByLegacyId(context, dspaceBitstream.getLegacyId());
dspaceBitstream = bitstreamService.find(context, dspaceBitstream.getID());
bitstream = new Bitstream(dspaceBitstream, "", context);
context.complete();
@@ -594,7 +594,7 @@ public class ItemsResource extends Resource
@PUT
@Path("/{item_id}/metadata")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response updateItemMetadata(@PathParam("item_id") Integer itemId, MetadataEntry[] metadata,
public Response updateItemMetadata(@PathParam("item_id") String itemId, MetadataEntry[] metadata,
@QueryParam("userIP") String user_ip, @QueryParam("userAgent") String user_agent,
@QueryParam("xforwardedfor") String xforwardedfor, @Context HttpHeaders headers, @Context HttpServletRequest request)
throws WebApplicationException
@@ -672,7 +672,7 @@ public class ItemsResource extends Resource
*/
@DELETE
@Path("/{item_id}")
public Response deleteItem(@PathParam("item_id") Integer itemId, @QueryParam("userIP") String user_ip,
public Response deleteItem(@PathParam("item_id") String itemId, @QueryParam("userIP") String user_ip,
@QueryParam("userAgent") String user_agent, @QueryParam("xforwardedfor") String xforwardedfor,
@Context HttpHeaders headers, @Context HttpServletRequest request) throws WebApplicationException
{
@@ -688,7 +688,7 @@ public class ItemsResource extends Resource
writeStats(dspaceItem, UsageEvent.Action.REMOVE, user_ip, user_agent, xforwardedfor, headers, request, context);
log.trace("Deleting item.");
org.dspace.content.Collection collection = collectionService.findByLegacyId(context, dspaceItem.getCollections().get(0).getLegacyId());
org.dspace.content.Collection collection = collectionService.find(context, dspaceItem.getCollections().get(0).getID());
collectionService.removeItem(context, collection, dspaceItem);
context.complete();
@@ -740,7 +740,7 @@ public class ItemsResource extends Resource
*/
@DELETE
@Path("/{item_id}/metadata")
public Response deleteItemMetadata(@PathParam("item_id") Integer itemId, @QueryParam("userIP") String user_ip,
public Response deleteItemMetadata(@PathParam("item_id") String itemId, @QueryParam("userIP") String user_ip,
@QueryParam("userAgent") String user_agent, @QueryParam("xforwardedfor") String xforwardedfor,
@Context HttpHeaders headers, @Context HttpServletRequest request) throws WebApplicationException
{
@@ -814,7 +814,7 @@ public class ItemsResource extends Resource
*/
@DELETE
@Path("/{item_id}/bitstreams/{bitstream_id}")
public Response deleteItemBitstream(@PathParam("item_id") Integer itemId, @PathParam("bitstream_id") Integer bitstreamId,
public Response deleteItemBitstream(@PathParam("item_id") String itemId, @PathParam("bitstream_id") String bitstreamId,
@QueryParam("userIP") String user_ip, @QueryParam("userAgent") String user_agent,
@QueryParam("xforwardedfor") String xforwardedfor, @Context HttpHeaders headers, @Context HttpServletRequest request)
throws WebApplicationException
@@ -828,7 +828,7 @@ public class ItemsResource extends Resource
context = createContext(getUser(headers));
org.dspace.content.Item item = findItem(context, itemId, org.dspace.core.Constants.WRITE);
org.dspace.content.Bitstream bitstream = bitstreamService.findByLegacyId(context, bitstreamId);
org.dspace.content.Bitstream bitstream = bitstreamService.findByIdOrLegacyId(context, bitstreamId);
if (bitstream == null)
{
context.abort();
@@ -989,12 +989,12 @@ public class ItemsResource extends Resource
* Is thrown when item with passed id is not exists and if user
* has no permission to do passed action.
*/
private org.dspace.content.Item findItem(org.dspace.core.Context context, int id, int action) throws WebApplicationException
private org.dspace.content.Item findItem(org.dspace.core.Context context, String id, int action) throws WebApplicationException
{
org.dspace.content.Item item = null;
try
{
item = itemService.findByLegacyId(context, id);
item = itemService.findByIdOrLegacyId(context, id);
if (item == null)
{