07-10-2019 02:47 AM
Hello
Is there a way to create a directory structure depending dynamically on a property values?
For example I have a property called "City" and different type of content files with this property. I would like to create a folder (smart or not?) "Cities" with a list of sub folders having names depending on the values the property have on the different files; each subfolder listing the files with the right property value.
I've been looking to smart folders and it seems to me I have to create a node with a specific search for each city which is so lame. There must be a way to do this!
Any info much appreciated
Thank you
07-10-2019 04:11 AM
Sounds what you want is to have dynamic smart folders based on facet values. There technically is a way to achieve something like this, but it would require writing Java code for event-based processing (behaviours when new documents are created / metadata is changed) to dynamically alter a smart folder template for any new values in the properties on which you want to base your navigation.
Or you could implement a virtual navigation UI using the supposedly flexible/reusable widget set of Application Development Framework (ADF) and the Alfresco Public ReST API, which already provides access to features like faceting.
07-12-2019 07:47 AM
Hi
I see but how can I access programmaticaly the smart folder json file to modify it? Are the modification dynamically taken into account?
Thank you
07-13-2019 11:38 AM
Any changes to the smart folder template JSON are taken into account immediately after commit. Modification can be done by using the Alfresco APIs (ReST or in-process Java) to work with the template node. Of course modification is only possible with custom smart folder templates stored as nodes - templates stored as JSON files in the classpath obviously cannot be modified at runtime.
07-11-2019 08:30 AM
That's exacly what our commercial filing and policy scripting modules do. Instead of relying on search like smart folders we register policies to do stuff an admin defined in the filing plan which may create e.g. symlinks (secondary assocs) in another folder which could be created on the fly once a node gets specific types, aspects, metadata. All you need to do is to define the filing plan using templates for paths and metadata with conditions which will apply without deployment / restarts.
You could code something like this on your own by defining a custom spring bean executing a java script fired by specific policies (similar to triggers): Behaviors/Policies | Alfresco Documentation but this is not very flexible and hard to maintain. We started this way years ago but implemented our filing module to avoid coding for every filing requirement / change.
Explore our Alfresco products with the links below. Use labels to filter content by product module.