cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a root folder

jzaruba
Champ in-the-making
Champ in-the-making
I'm trying to 'hide' text file that is linked to my PDF in a different store, hoping it would not get listed in search results together with the PDF it is linked to. (I.e. I only want the PDF to be listed; currently I get listed both.)
I hope it is possible in the first place…

My intention has been to keep the txt-files stored in the other store in a folder structure reflecting the one my PDF files are in. The problem is I get following error when trying to create the hierarchy…

The association source type is incorrect:
   Source Node: workspace://IndexesStore/3f8e4d82-2be9-4f55-9dcc-71d9eda431b8
   Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/content/1.0}folder], name={http://www.alfresco.org/model/content/1.0}contains, target class={http://www.alfresco.org/model/system/1.0}base, source role=null, target role=null]
   Required Source Type: {http://www.alfresco.org/model/content/1.0}folder
   Actual Source Type: {http://www.alfresco.org/model/system/1.0}store_root
I believe it is because I'm trying to create a folder in a storeRef, in other words I don't know how to create a root folder.

This is how I'm creating the folders, including the root one.
NodeRef parentNodeRef = nodeService.getRootNode(targetStore);

while(…)
{
  …
  folderRef = nodeService.createNode(parentNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.APP_MODEL_1_0_URI, newFolderName), ContentModel.TYPE_FOLDER)
}
(I went through some Wiki examples but they usually create a folder within another folder.)

Any ideas on what I am doing wrong, please? (Is it possible to hide content from search by placing it into alternate store?)
5 REPLIES 5

derek
Star Contributor
Star Contributor
Hi,
You are trying to create a folder within the root of your new store using an association that requires the source to be a folder (cm:contains.  Clearly the root node of a store is not a folder.  You should rather, up front, create a folder within your shadow store using a generic child (cm:children) association.  Call your top-level folder something like "Shadow Root" or whatever.  Then you can use your existing code to create folders using the folder-specific association.  Take a look in the Node Browser at the link between the Workspace://SpacesStore root and the "Company Home" folder and its children.

jzaruba
Champ in-the-making
Champ in-the-making
Oops, few moments ago there was a reply from msrogers dittoing what derek has said and also suggesting two ways of hiding a document from search. Either to change a search-query or to set permissions to given document. The later sounds like the solution for me, and I was trying to go that way earlier, but I wasn't able to get anywhere… The only post I found was this one. I will try further, at least I know now that is the only way. Smiley Happy

Thank you both guys.

derek
Star Contributor
Star Contributor
You can change your search query, change permissions on the node to hide it, or you can put the nodes in a separate store and hence they will not be visible via the normal search of browsing.

jzaruba
Champ in-the-making
Champ in-the-making
Thank you, derek Smiley Happy

You can change your search query, change permissions on the node to hide it, or you can put the nodes in a separate store and hence they will not be visible via the normal search of browsing.

I'm currently looking at the PermissionService.

I'm glad to hear though the alternate store could work too. Having the text documents in a mirrored structure without having to alter permissions on every single document is more appealing to me. That way I could just revoke (I guess) _ReadChildren permission from the root folder of the alternate store…

jzaruba
Champ in-the-making
Champ in-the-making
It seems that setting the property like this…
getNodeService().setProperty(pdfNodeRef, ComtesysModel.CONTENT_PROPERTY, new ContentData("store://???.bin", "text/plain", size, "UTF-8"));
…does not assign the reference but the actual value; i.e. deleting or modifying the referenced file does not affect the property.

Therefore I don't have to hide the text files at all.