Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSpace7 does not sort the bitstreams presented through the UI. #9466

Open
ebalnaves opened this issue Apr 11, 2024 · 1 comment
Open

DSpace7 does not sort the bitstreams presented through the UI. #9466

ebalnaves opened this issue Apr 11, 2024 · 1 comment
Labels
bug help wanted Needs a volunteer to claim to move forward

Comments

@ebalnaves
Copy link

Describe the bug
The author of an item in DSpace change define the specific sequence of bitstreams in the administrative interface. However the API to retrieve bitstreams for the UI does not do an ORDER on the retrieved bitstreams. The display of the resulting items in the UI does not honour the sequence defined by the user. This is a standard feature of DSpace6.

To Reproduce
Steps to reproduce the behavior:

  1. Submit an item in DSpace.
  2. Update item in Administrative view/Bitstreams
  3. Resequence the items

Expected behavior
In the UI, the list of bitstreams should be in the sequence_id defined by the author/administrator

Related work
Am submitting a pull request on this with minor API change.

@ebalnaves ebalnaves added bug needs triage New issue needs triage and/or scheduling labels Apr 11, 2024
@tdonohue
Copy link
Member

I'm able to reproduce this on the Demo Site (https://demo.dspace.org) which is running the latest dspace-7_x code:

  • Open DevTools in browser & look at the Network tab
  • Login as and Admin and visit an Item with multiple bitstreams
  • Edit that Item, go to "Bitstreams" tab and drag & drop bitstreams to give them a new order,
  • A PATCH request will be sent, but the response will be a 500 error.

In the DSpace logs, this error occurs:

 2024-04-12 15:40:33,630 INFO  3cca5810-c195-4693-b709-7fd2466d07e4 9d850b26-df49-45d4-ba84-c5f437ed2054 org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl @ HHH000010: On release of batch it still contained JDBC statements
 2024-04-12 15:40:33,631 ERROR 3cca5810-c195-4693-b709-7fd2466d07e4 9d850b26-df49-45d4-ba84-c5f437ed2054 org.hibernate.engine.jdbc.batch.internal.BatchingBatch @ HHH000315: Exception executing batch [java.sql.BatchUpdateException: Batch entry 1 update public.bundle2bitstream set bitstream_id=('8b530aab-54a1-4c21-ab83-0ba0dd41bcce'::uuid) where bundle_id=('4d25649f-8fee-4449-ae6f-2ff5ce414251'::uuid) and bitstream_order=('1'::int4) was aborted: ERROR: duplicate key value violates unique constraint "bundle2bitstream_pkey"
   Detail: Key (bitstream_id, bundle_id, bitstream_order)=(8b530aab-54a1-4c21-ab83-0ba0dd41bcce, 4d25649f-8fee-4449-ae6f-2ff5ce414251, 1) already exists.  Call getNextException to see other errors in the batch.], SQL: update public.bundle2bitstream set bitstream_id=? where bundle_id=? and bitstream_order=?
 2024-04-12 15:40:33,631 WARN  3cca5810-c195-4693-b709-7fd2466d07e4 9d850b26-df49-45d4-ba84-c5f437ed2054 org.hibernate.engine.jdbc.spi.SqlExceptionHelper @ SQL Error: 0, SQLState: 23505
 2024-04-12 15:40:33,631 ERROR 3cca5810-c195-4693-b709-7fd2466d07e4 9d850b26-df49-45d4-ba84-c5f437ed2054 org.hibernate.engine.jdbc.spi.SqlExceptionHelper @ Batch entry 1 update public.bundle2bitstream set bitstream_id=('8b530aab-54a1-4c21-ab83-0ba0dd41bcce'::uuid) where bundle_id=('4d25649f-8fee-4449-ae6f-2ff5ce414251'::uuid) and bitstream_order=('1'::int4) was aborted: ERROR: duplicate key value violates unique constraint "bundle2bitstream_pkey"
   Detail: Key (bitstream_id, bundle_id, bitstream_order)=(8b530aab-54a1-4c21-ab83-0ba0dd41bcce, 4d25649f-8fee-4449-ae6f-2ff5ce414251, 1) already exists.  Call getNextException to see other errors in the batch.
 2024-04-12 15:40:33,631 ERROR 3cca5810-c195-4693-b709-7fd2466d07e4 9d850b26-df49-45d4-ba84-c5f437ed2054 org.hibernate.engine.jdbc.spi.SqlExceptionHelper @ ERROR: duplicate key value violates unique constraint "bundle2bitstream_pkey"
   Detail: Key (bitstream_id, bundle_id, bitstream_order)=(8b530aab-54a1-4c21-ab83-0ba0dd41bcce, 4d25649f-8fee-4449-ae6f-2ff5ce414251, 1) already exists.
 2024-04-12 15:40:33,631 ERROR 3cca5810-c195-4693-b709-7fd2466d07e4 9d850b26-df49-45d4-ba84-c5f437ed2054 org.dspace.app.rest.exception.DSpaceApiExceptionControllerAdvice @ An exception has occurred (status:500)
 javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute batch
   at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154) ~[hibernate-core-5.6.15.Final.jar:5.6.15.Final]
   at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1626) ~[hibernate-core-5.6.15.Final.jar:5.6.15.Final]
   at org.hibernate.query.Query.getResultList(Query.java:165) ~[hibernate-core-5.6.15.Final.jar:5.6.15.Final]
   at org.dspace.core.AbstractHibernateDAO.list(AbstractHibernateDAO.java:202) ~[dspace-api-7.6.2-SNAPSHOT.jar:7.6.2-SNAPSHOT]
   at org.dspace.core.AbstractHibernateDAO.singleResult(AbstractHibernateDAO.java:272) ~[dspace-api-7.6.2-SNAPSHOT.jar:7.6.2-SNAPSHOT]
   at org.dspace.eperson.dao.impl.GroupDAOImpl.findByName(GroupDAOImpl.java:111) ~[dspace-api-7.6.2-SNAPSHOT.jar:7.6.2-SNAPSHOT]
   at org.dspace.eperson.GroupServiceImpl.findByName(GroupServiceImpl.java:431) ~[dspace-api-7.6.2-SNAPSHOT.jar:7.6.2-SNAPSHOT]
   at org.dspace.core.Context.getAdminGroup(Context.java:977) ~[dspace-api-7.6.2-SNAPSHOT.jar:7.6.2-SNAPSHOT]
   at org.dspace.authorize.AuthorizeServiceImpl.isAdmin(AuthorizeServiceImpl.java:454) ~[dspace-api-7.6.2-SNAPSHOT.jar:7.6.2-SNAPSHOT]
   at org.dspace.authorize.AuthorizeServiceImpl.authorize(AuthorizeServiceImpl.java:260) ~[dspace-api-7.6.2-SNAPSHOT.jar:7.6.2-SNAPSHOT]
   at org.dspace.authorize.AuthorizeServiceImpl.authorizeAction(AuthorizeServiceImpl.java:149) ~[dspace-api-7.6.2-SNAPSHOT.jar:7.6.2-SNAPSHOT]
   at org.dspace.authorize.AuthorizeServiceImpl.authorizeAction(AuthorizeServiceImpl.java:120) ~[dspace-api-7.6.2-SNAPSHOT.jar:7.6.2-SNAPSHOT]
   at org.dspace.authorize.AuthorizeServiceImpl.authorizeActionBoolean(AuthorizeServiceImpl.java:193) ~[dspace-api-7.6.2-SNAPSHOT.jar:7.6.2-SNAPSHOT]
   at org.dspace.authorize.AuthorizeServiceImpl.authorizeActionBoolean(AuthorizeServiceImpl.java:180) ~[dspace-api-7.6.2-SNAPSHOT.jar:7.6.2-SNAPSHOT]
   at org.dspace.content.ItemServiceImpl.canEdit(ItemServiceImpl.java:1175) ~[dspace-api-7.6.2-SNAPSHOT.jar:7.6.2-SNAPSHOT]
   at org.dspace.content.ItemServiceImpl.update(ItemServiceImpl.java:582) ~[dspace-api-7.6.2-SNAPSHOT.jar:7.6.2-SNAPSHOT]
   at org.dspace.content.ItemServiceImpl.updateLastModified(ItemServiceImpl.java:372) ~[dspace-api-7.6.2-SNAPSHOT.jar:7.6.2-SNAPSHOT]
   at org.dspace.content.ItemServiceImpl.updateLastModified(ItemServiceImpl.java:93) ~[dspace-api-7.6.2-SNAPSHOT.jar:7.6.2-SNAPSHOT]
   at org.dspace.content.BundleServiceImpl.setOrder(BundleServiceImpl.java:445) ~[dspace-api-7.6.2-SNAPSHOT.jar:7.6.2-SNAPSHOT]
   at org.dspace.content.BundleServiceImpl.updateBitstreamOrder(BundleServiceImpl.java:335) ~[dspace-api-7.6.2-SNAPSHOT.jar:7.6.2-SNAPSHOT]
   at org.dspace.app.rest.repository.patch.operation.BundleMoveOperation.perform(BundleMoveOperation.java:78) ~[classes/:7.6.2-SNAPSHOT]
   at org.dspace.app.rest.repository.patch.operation.BundleMoveOperation.perform(BundleMoveOperation.java:32) ~[classes/:7.6.2-SNAPSHOT]
   at org.dspace.app.rest.repository.patch.ResourcePatch.performPatchOperation(ResourcePatch.java:58) ~[classes/:7.6.2-SNAPSHOT]
   at org.dspace.app.rest.repository.patch.ResourcePatch.patch(ResourcePatch.java:42) ~[classes/:7.6.2-SNAPSHOT]
   at org.dspace.app.rest.repository.DSpaceObjectRestRepository.patchDSpaceObject(DSpaceObjectRestRepository.java:64) ~[classes/:7.6.2-SNAPSHOT]
   at org.dspace.app.rest.repository.BundleRestRepository.patch(BundleRestRepository.java:111) ~[classes/:7.6.2-SNAPSHOT]

This is NOT reproducible on the Sandbox site (https://sandbox.dspace.org) running pre-8.0. So, it's been fixed somehow, but I'm uncertain where the fix was applied to the pre-8.0 codebase. It needs to be backported or a similar fix applied to 7.x

For now, this needs a volunteer.

@tdonohue tdonohue added help wanted Needs a volunteer to claim to move forward and removed needs triage New issue needs triage and/or scheduling labels Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help wanted Needs a volunteer to claim to move forward
Projects
Status: 📋 To Do
Development

No branches or pull requests

2 participants