On Thu, Feb 23, 2023 at 08:30:46PM +0000, Cameron, Jacob wrote: > Does this also apply to a community, not just an item? We have some > communities that are also added for some reason.
The code in SubmissionConfigReader looks up a DSpaceObject by Handle and specifically casts it to Collection. The Handle of a Community should cause another ClassCastException. Neither Item nor Community is a kind of Collection -- that is what ClassCastException is saying. I can see that it would be handy if collections could inherit submission mappings from their enclosing communities -- we have 89 collections mapped to 14 submission flows -- but it doesn't work that way. The 'name-map' element's attribute is named 'collection-handle' for a reason: the code only accepts the Handle of a Collection here. It will throw an exception if any other Handle is given (or ignore the faulty mapping if you apply the patch). > -----Original Message----- > From: Mark H. Wood,UL 0115A,+1 317 274 0749, <mw...@iupui.edu> On Behalf Of > Mark H. Wood > Sent: February 23, 2023 6:41 AM > To: dspace-tech@googlegroups.com > Subject: Re: [dspace-tech] Creating Submission Workflows > > On Thu, Feb 23, 2023 at 08:29:49AM -0500, Mark H. Wood wrote: > > On Wed, Feb 22, 2023 at 05:55:05PM +0000, Cameron, Jacob wrote: > > > Hello, > > > > > > DSpace 7.4, Tomcat 9.6, Postgres 13. > > > > > > I've created 5 new workflows. 4 of the 5 work fine. The 5th one seems > > > to throw an error in the DSpace log. It's setup the same as the other > > > new workflows. > > > > > > It gives me a "You have not the privilege to make a new submission." > > > error. However, everything is named properly and showing up the way I > > > would expect. I've verified things, checked things over, and even tried > > > using the traditional input form with no changes and it still throws the > > > error. > > > > > > The error in the dspace.log is: > > > > > > 2023-02-22 09:45:17,632 INFO 586a38e2-042e-4f50-b051-1c80b6adff77 > > > e1fe0995-92e8-4ab3-a934-ae60dea3bb91 > > > org.dspace.content.WorkspaceItemServiceImpl @ > > > library.ireposit...@uleth.ca::create_workspace_item:workspace_item_i > > > d=8975item_id=d1cc3391-444a-4b8e-a022-3ea108640ebbcollection_id=3493 > > > 47e2-4e50-43f1-9bec-df5f77b1972f > > > 2023-02-22 09:45:17,883 ERROR 586a38e2-042e-4f50-b051-1c80b6adff77 > > > e1fe0995-92e8-4ab3-a934-ae60dea3bb91 > > > org.dspace.app.rest.exception.DSpaceApiExceptionControllerAdvice @ > > > An exception has occurred (status:500) > > > java.lang.ClassCastException: class org.dspace.content.Item cannot > > > be cast to class org.dspace.content.Collection > > > (org.dspace.content.Item and org.dspace.content.Collection are in > > > unnamed module of loader > > > org.apache.catalina.loader.ParallelWebappClassLoader @25cc7470) > > > > This happened to me as well. You have mapped that submission-name to > > the Handle of an Item, not a Collection, in 'config/item-submission.xml'. > > A patch that causes SubmissionConfigReader to reject the unusable mapping > with a log message, instead of crashing: > > diff --git > a/dspace-api/src/main/java/org/dspace/app/util/SubmissionConfigReader.java > b/dspace-api/src/main/java/org/dspace/app/util/SubmissionConfigReader.java > index 2120848358..35399fba4e 100644 > --- a/dspace-api/src/main/java/org/dspace/app/util/SubmissionConfigReader.java > +++ b/dspace-api/src/main/java/org/dspace/app/util/SubmissionConfigReade > +++ r.java > @@ -22,6 +22,7 @@ import org.apache.commons.lang3.StringUtils; > import org.apache.logging.log4j.Logger; import > org.dspace.content.Collection; import org.dspace.content.DSpaceObject; > +import org.dspace.core.Constants; > import org.dspace.core.Context; > import org.dspace.handle.factory.HandleServiceFactory; > import org.dspace.services.factory.DSpaceServicesFactory; > @@ -628,7 +629,12 @@ public class SubmissionConfigReader { > DSpaceObject result = > HandleServiceFactory.getInstance().getHandleService() > > .resolveToObject(context, handle); > if (result != null) { > - results.add((Collection) result); > + if (!(result instanceof Collection)) { > + log.error("{} is a {}, not a Collection", > + handle, > Constants.typeText[result.getType()]); > + } else { > + results.add((Collection) result); > + } > } > } > } > > -- > Mark H. Wood > Lead Technology Analyst > > University Library > Indiana University - Purdue University Indianapolis > 755 W. Michigan Street > Indianapolis, IN 46202 > 317-274-0749 > www.ulib.iupui.edu > > -- > All messages to this mailing list should adhere to the Code of Conduct: > https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx > --- > You received this message because you are subscribed to the Google Groups > "DSpace Technical Support" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to dspace-tech+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/dspace-tech/Y/ds85yhkkcKiVl7%40IUPUI.Edu. -- Mark H. Wood Lead Technology Analyst University Library Indiana University - Purdue University Indianapolis 755 W. Michigan Street Indianapolis, IN 46202 317-274-0749 www.ulib.iupui.edu -- All messages to this mailing list should adhere to the Code of Conduct: https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx --- You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group. To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/Y/i/TPz/b/U0iQQJ%40IUPUI.Edu.
signature.asc
Description: PGP signature