cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot rename node (exception Unexpected type...)

hbf
Champ on-the-rise
Champ on-the-rise
Hi,

In the Web Client I change the name of a node and obtain the following exception:


10:23:43,003 User:admin ERROR [ui.common.Utils] A system error happened during the operation: Unexpected type ({http://www.my.org/foo}content) for target parent: workspace://SpacesStore/c2e83803-ac72-11dc-86f6-b5cebe90f338
org.alfresco.repo.model.filefolder.FileFolderServiceImpl$InvalidTypeException: Unexpected type ({http://www.my.org/foo}content) for target parent: workspace://SpacesStore/c2e83803-ac72-11dc-86f6-b5cebe90f338
   at org.alfresco.repo.model.filefolder.FileFolderServiceImpl.moveOrCopy(FileFolderServiceImpl.java:617)
   at org.alfresco.repo.model.filefolder.FileFolderServiceImpl.rename(FileFolderServiceImpl.java:539)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
   at org.alfresco.repo.model.filefolder.TempFileMarkerInterceptor.invoke(TempFileMarkerInterceptor.java:83)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   at org.alfresco.repo.model.ml.MLContentInterceptor.invoke(MLContentInterceptor.java:131)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   at org.alfresco.repo.model.filefolder.MLTranslationInterceptor.invoke(MLTranslationInterceptor.java:210)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:80)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:241)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
   at $Proxy40.rename(Unknown Source)
   at org.alfresco.web.bean.content.EditContentPropertiesDialog.finishImpl(EditContentPropertiesDialog.java:103)
   at org.alfresco.web.bean.dialog.BaseDialogBean$1.execute(BaseDialogBean.java:119)
   at org.alfresco.web.bean.dialog.BaseDialogBean$1.execute(BaseDialogBean.java:116)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:236)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:166)
   at org.alfresco.web.bean.dialog.BaseDialogBean.finish(BaseDialogBean.java:125)
   at org.alfresco.web.bean.dialog.DialogManager.finish(DialogManager.java:531)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:132)
   at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:61)
   at javax.faces.component.UICommand.broadcast(UICommand.java:109)
   at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
   at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
   at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
   at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
   at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
   at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:81)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
   at java.lang.Thread.run(Thread.java:613)

My node is the child of a custom child-association. After some debugging, I see in file FileFolderServiceImpl.java (revision 1398), method moveOrCopy():


        // Fix AWC-1517
        QName assocTypeQname = null;
        if (dictionaryService.isSubClass(targetParentType, ContentModel.TYPE_FOLDER))
        {
           assocTypeQname = ContentModel.ASSOC_CONTAINS; // cm:folder -> cm:contains
        }
        else if (dictionaryService.isSubClass(targetParentType, ContentModel.TYPE_CONTAINER))
        {
           assocTypeQname = ContentModel.ASSOC_CHILDREN; // sys:container -> sys:children
        }
        else
        {
           throw new InvalidTypeException("Unexpected type (" + targetParentType + ") for target parent: " + targetParentRef);
        }

It seems that Alfresco requires the parent of the node to be a subtype of either cm:folder or sys:container. In my case, the parent is a subtype of cm:content, hence the exception.

This looks like an Alfresco bug to me, or did I miss something?

Kaspar
3 REPLIES 3

hbf
Champ on-the-rise
Champ on-the-rise
(I've created a JIRA issue, http://issues.alfresco.com/browse/AR-1961 for this.)

derek
Star Contributor
Star Contributor
The FileFolderService only supports the File/Folder model.  It is one of the few model-specific service implementations, i.e. services that restrict themselves to a certain part of the DD.  In this part of the model, files cannot contain files.

You can subclass the implementation and provide your own version of the "fileFolderService" bean (recommended) or use the lower-level NodeService if required.

hbf
Champ on-the-rise
Champ on-the-rise
Thanks for the explanation, Derek!

Maybe in a future version an option could be added that allows renames of arbitrary nodes (i.e., switches to a less strict implementation of fileFolderService)?

It would make the Web Client much more useful for custom models – one of the particularly nice plus's of Alfresco in my opinion!