cancel
Showing results for 
Search instead for 
Did you mean: 

Get list of files in a repository for a constraint

mikepoole
Champ in-the-making
Champ in-the-making
I am trying to create a constraint class to show a drop-down box to the user of all files within the current folder

My question is - how, within my Java constraint class can I get the list of files? How do I get a handle on the current nodeRef to then use the FileFolderService? Do I need to get the nodeRef from the url and if so, how do I do that?

Many thanks for your time

Mike
5 REPLIES 5

mitpatoliya
Star Collaborator
Star Collaborator
Yes of course you can do that

Check out this post
https://forums.alfresco.com/en/viewtopic.php?f=4&t=11687

mikepoole
Champ in-the-making
Champ in-the-making
Thanks so much for the link

Excuse my ignorance, but I cannot see in that post where it refers to getting the current node/noderef to then be able to access the list of files within the folder/repository. Am I missing something?

Many thanks

Mike

mitpatoliya
Star Collaborator
Star Collaborator
Hi this is one more link
https://forums.alfresco.com/en/viewtopic.php?f=19&t=43663

There he is getting current node from the propertysheet as follow.
Node currentNode = (Node)propertySheet.getNode();

mikepoole
Champ in-the-making
Champ in-the-making
Thanks

Can I get the nodeRef from the URL from my constraint code? I don't yet understand how to use the UIPropertySheet class so I keep getting a NullPointerException

Mike

mitpatoliya
Star Collaborator
Star Collaborator
Then I guess you can get the current node from either FacesContext or from the NavigationBean.
As navigation bean keeps the track of currentnode.