cancel
Showing results for 
Search instead for 
Did you mean: 

Why is FileFolderService#makeFolders deprecated?

gyro_gearless
Champ in-the-making
Champ in-the-making
Hi folks,

just wondered why method makeFolders() in interface org.alfresco.repo.model.filefolder.FileFolderService is marked as deprecated?  :?
Instead, a static method makeFolders() is provided in FileFolderServiceImpl, which is also used by the deprectated method:

public class FileFolderServiceImpl implements FileFolderService
{
   …
    public static FileInfo makeFolders(FileFolderService service, NodeRef parentNodeRef, List<String> pathElements, QName folderTypeQName)
    {
       …..
    }

    public FileInfo makeFolders(NodeRef parentNodeRef, List<String> pathElements, QName folderTypeQName)
    {
        return FileFolderServiceImpl.makeFolders(this, parentNodeRef, pathElements, folderTypeQName);
    }
}

This doesnt seem to make sense for me for several reasons:

- The static method makeFolders() should be rather called "pseudo-static", as it gets an artificial this reference passed! There is no reason why it shouldn't be a method of FileFolderServiceImpl as it was before!

- By forcing users to call a method in the implementation class, the usual separation between interfaces and implementation classes is broken for no reason.

Maybe  there is some reason why this method exists as static, but at least the @deprecated annotation should be removed, IMHO

Cheers
Gyro
2 REPLIES 2

mrogers
Star Contributor
Star Contributor
I think I agree with you.   I'll talk to my collegues to see if anyone remembers changing it.

mrogers
Star Contributor
Star Contributor
There was a good reason which was that it was due to to security and auditing requirements as the makeFolders method walked down the path.

So I'm not going to un-deprecate makeFolders on FileFolderService.  In fact I'm going to remove this long deprecated method entirely from the FileFolders interface.

Since I agree that its bad form to have to directly access an implementation class I'm also going to deprecate FileFolderServiceImpl.makeFolders and move the code to a separate utility class.