AnsweredAssumed Answered

repository structure

Question asked by kbryd on Jan 29, 2008
Hi

Here is what I want to achieve, I have a folder structure:

Project
    -> Case (can be up to N cases in a project)
        -> Folder 1
        -> Folder 2
        -> …
        -> Folder N
    -> Case 1
    -> Case N

And now, how do I navigate programatically around this structure? At the moment I am using NodeService and FileFolderServices but this is soooo difficult, for example, I am able to create that structure:

        List<String> folders = new ArrayList<String>();
        folders.add("Project");
        folders.add("Case 112-5");
        folders.add("Reference 1");
       
        fileFolderService.makeFolders(companyHome, folders, ContentModel.TYPE_FOLDER);

but how can I now add content to for example Reference 1 folder? I have some experience in Documentum, so there I do:

IDfFolder folder = session.getFolderByPath("/Project/Case 112-5/Reference 1")
IDfDocument document = session.newObject("dm_document");
document.link(folder.getFolderPath(0));
document.save();

and that's all, I have a new document which is linked to my Reference Folder. How to do the same in Alfresco Foundation API? Or in other words, how do I convert Path (/Project/Case 112-5") to NodeRef because I know how to create some content?

I have a feeling that Foundation API is too low level for me but on the other hand I have looked into WebService API and OMG! it's even more complex :) Why such simple operations are so difficult in Alfresco API, haven't you thought about simplifying it?

Thanks

Outcomes