Re: [dspace-tech] Creating Submission Workflows

2023-02-24 Thread Mark H. Wood
On Thu, Feb 23, 2023 at 08:30:46PM +, 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,  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 +, 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((Colle

RE: [dspace-tech] Creating Submission Workflows

2023-02-23 Thread Cameron, Jacob
Does this also apply to a community, not just an item?  We have some 
communities that are also added for some reason.

Jake

--
Jake Cameron, BCS(UNB)
Systems Support Specialist III
Information Systems and Technical Services University of Lethbridge Library
Phone:(403)329-2756
This e-mail, including any and all attachments, is only for the use of the 
intended recipient(s) and may contain information that is confidential or 
privileged. If you are not the intended recipient, you are advised that any 
dissemination, copying or other use of this e-mail is prohibited. Please notify 
the sender of the error in communication by return e-mail and destroy all 
copies of this e-mail. Thank you.

-Original Message-
From: Mark H. Wood,UL 0115A,+1 317 274 0749,  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 +, 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 fro

Re: [dspace-tech] Creating Submission Workflows

2023-02-23 Thread Mark H. Wood
On Thu, Feb 23, 2023 at 08:29:49AM -0500, Mark H. Wood wrote:
> On Wed, Feb 22, 2023 at 05:55:05PM +, 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_id=8975item_id=d1cc3391-444a-4b8e-a022-3ea108640ebbcollection_id=349347e2-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/SubmissionConfigReader.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.


signature.asc
Description: PGP signature


Re: [dspace-tech] Creating Submission Workflows

2023-02-23 Thread Mark H. Wood
On Wed, Feb 22, 2023 at 05:55:05PM +, 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_id=8975item_id=d1cc3391-444a-4b8e-a022-3ea108640ebbcollection_id=349347e2-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'.

-- 
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/dqTcg6Mg1mGn2/%40IUPUI.Edu.


signature.asc
Description: PGP signature


[dspace-tech] Creating Submission Workflows

2023-02-22 Thread Cameron, Jacob
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_id=8975item_id=d1cc3391-444a-4b8e-a022-3ea108640ebbcollection_id=349347e2-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)
at 
org.dspace.app.util.SubmissionConfigReader.getCollectionsBySubmissionConfig(SubmissionConfigReader.java:631)
 ~[dspace-api-7.4.jar:7.4]
at 
org.dspace.app.rest.converter.SubmissionDefinitionConverter.convert(SubmissionDefinitionConverter.java:84)
 ~[classes/:7.4]
at 
org.dspace.app.rest.converter.SubmissionDefinitionConverter.convert(SubmissionDefinitionConverter.java:39)
 ~[classes/:7.4]
at 
org.dspace.app.rest.converter.ConverterService.toRest(ConverterService.java:112)
 ~[classes/:7.4]
at 
org.dspace.app.rest.converter.ConverterService$$FastClassBySpringCGLIB$$41367eae.invoke()
 ~[classes/:7.4]
at 
org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) 
~[spring-core-5.3.20.jar:5.3.20]
at 
org.springframework.aop.framework.CglibAopProxy.invokeMethod(CglibAopProxy.java:386)
 ~[spring-aop-5.3.20.jar:5.3.20]
at 
org.springframework.aop.framework.CglibAopProxy.access$000(CglibAopProxy.java:85)
 ~[spring-aop-5.3.20.jar:5.3.20]
at 
org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:704)
 ~[spring-aop-5.3.20.jar:5.3.20]
at 
org.dspace.app.rest.converter.ConverterService$$EnhancerBySpringCGLIB$$1ac8ce7b.toRest()
 ~[classes/:7.4]
at 
org.dspace.app.rest.converter.AInprogressItemConverter.fillFromModel(AInprogressItemConverter.java:83)
 ~[classes/:7.4]
at 
org.dspace.app.rest.converter.WorkspaceItemConverter.convert(WorkspaceItemConverter.java:35)
 ~[classes/:7.4]
at 
org.dspace.app.rest.converter.WorkspaceItemConverter.convert(WorkspaceItemConverter.java:23)
 ~[classes/:7.4]
at 
org.dspace.app.rest.converter.ConverterService.toRest(ConverterService.java:112)
 ~[classes/:7.4]
at 
org.dspace.app.rest.converter.ConverterService$$FastClassBySpringCGLIB$$41367eae.invoke()
 ~[classes/:7.4]
at 
org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) 
~[spring-core-5.3.20.jar:5.3.20]
at 
org.springframework.aop.framework.CglibAopProxy.invokeMethod(CglibAopProxy.java:386)
 ~[spring-aop-5.3.20.jar:5.3.20]
at 
org.springframework.aop.framework.CglibAopProxy.access$000(CglibAopProxy.java:85)
 ~[spring-aop-5.3.20.jar:5.3.20]
at 
org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:704)
 ~[spring-aop-5.3.20.jar:5.3.20]
at 
org.dspace.app.rest.converter.ConverterService$$EnhancerBySpringCGLIB$$1ac8ce7b.toRest()
 ~[classes/:7.4]
at 
org.dspace.app.rest.repository.WorkspaceItemRestRepository.createAndReturn(WorkspaceItemRestRepository.java:172)
 ~[classes/:7.4]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
~[?:?]
at 
jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 ~[?:?]
at 
jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at 
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
 ~[spring-aop-5.3.20.jar:5.3.20]
at 
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
 ~[spring-aop-5.3.20.jar:5.3.20]
at 
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:799)
 ~[spring-aop-5.3.20.jar:5.3.20]
at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)