cancel
Showing results for 
Search instead for 
Did you mean: 

FileFolderService sort problem

beslan
Champ in-the-making
Champ in-the-making
Hi,

Following error is occurring when I call FileFolderService.list() with folderOnly and sort enabled.


   NodeRef testNode = new NodeRef(spacesStoreRef, objectId);

   List<Pair<QName, Boolean>> sortProps = new ArrayList<Pair<QName, Boolean>>();
   sortProps.add(new Pair<QName, Boolean>(ContentModel.PROP_NAME, true));

   PagingRequest pageRequest = new PagingRequest(skipCount, itemLimit, null);
   pageRequest.setRequestTotalCountMax(itemLimit);

   PagingResults<FileInfo> fileInfoList = this.getServiceRegistry().getFileFolderService().list(testNode, false, true, null, null, pageRequest);



org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only
org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:717)
org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
$Proxy111.list(Unknown Source)
com.universal.alfresco.api.ContentManagerApiImpl.getOnlyFolders(ContentManagerApiImpl.java:366)


Problem is occurring only in repositories that upgraded from 3.4c to 4.2b. File sorting with name is also ok.

Thanks,

Beslan.
4 REPLIES 4

mrogers
Star Contributor
Star Contributor
If you can isolate a test case then please raise problems in JIRA (issues.alfresco.com).    However the exception is logged from com.universal.alfresco.api.ContentManagerApiImpl.getOnlyFolders() so there's some code that's not shown above.

beslan
Champ in-the-making
Champ in-the-making
Like I said the problem is in my upgraded repository. So I cant upload all data (200 GB). There is code for getOnlyFolders in my previous message.

Exception thrown by this line

PagingResults<FileInfo> fileInfoList = this.getServiceRegistry().getFileFolderService().list(testNode, false, true, null, null, pageRequest);


Thanks,

Beslan

beslan
Champ in-the-making
Champ in-the-making
Hi,

When I added a sort parameter to fileFolderService list method, it is selecting all folders and filtering after. HiddenAspect.getVisibility method if(nodeService.hasAspect(nodeRef, ContentModel.ASPECT_HIDDEN)) line throws AccessDeniedException because there is nodes on result list that user not permitted to show.


    public Visibility getVisibility(Client client, NodeRef nodeRef)
    {
        Visibility ret = Visibility.Visible;

        if(nodeService.hasAspect(nodeRef, ContentModel.ASPECT_HIDDEN))
        {
            Integer visibilityMask = (Integer)nodeService.getProperty(nodeRef, ContentModel.PROP_VISIBILITY_MASK);
            if(visibilityMask != null)
            {
                if(visibilityMask.intValue() == 0)
                {
                    ret = Visibility.NotVisible;
                }
                else if(client == null)
                {
                    ret = Visibility.NotVisible;
                }
                else
                {
                    ret = getVisibility(visibilityMask.intValue(), client);
                }
            }
            else
            {
                // no visibility mask property, so retain backwards compatibility with 3.4 hidden aspect behaviour
                if(client == Client.cifs)
                {
                    ret = Visibility.HiddenAttribute;
                }
                else if(client == Client.webdav || client == Client.nfs || client == Client.imap)
                {
                    ret = Visibility.Visible;
                }
                else
                {
                    ret = Visibility.NotVisible;
                }
            }
        }

        return ret;
    }


Thanks,
Beslan

beslan
Champ in-the-making
Champ in-the-making
User transaction was not used for this method. I added my code to FirstFoundationClient sample and it worked.
But AccessDeniedException is not gone. I can raise an issue but I don't know is this normal behavior?

Thanks,
Beslan