How to manage public content in Alfresco with the help of virtual folders
In the last versions of Alfresco 5.1 EE and Alfresco 201602GA (5.1.e)
CE, they were introduced the very promising so-called «smart
folders». Smart Folders organize your content in a logical view
via custom Alfresco FTS queries. Stored searches are shown in a folder
tree, so that when a user opens a folder, a query is run and the
results are displayed in a list. Files are also automatically
classified when they are uploaded.
So let’s start with a little example of using smart folders. There
exists many smart-related variables in
alfresco-global.properties, but in practice I only
needed to change this property:
smart.folders.enabled=true
In share-config-custom.xml, two aspects are enabled
by default for configuring smart folders. These can be applied
in different folders or sites resulting in different logical views of
the repository, through JSON templates deployed in /Data
Dictionary/Smart Folder Templates folder. The JSON format
is not truly for final users, but the possibilities are huge and files
can be changed/edited/applied directly without restarting. In our
experience, some system for customizing queries was always necessary
in Alfresco in the past, for example custom document library filters,
customs dashlet for saved searches or customizations of the advanced search.
I want to share my first virtual folders example, for managing custom
public shared documents in Alfresco >4.2. I did some previous post
about this, based on a client conversation:
https://www.zylk.net/actualidad/how-to-control-public-shared-content-in-alfresco/
So this can be considered as the second part of the post. First, I
applied the smf:customConfigSmartFolder aspect for
example to /Shared folder (Compartido in Spanish) and editing the
properties of the folder, I select the
qsharedFolder.json template uploaded in /Data
Dictionary/Smart Folder Templates
Then, the resulting virtual folder structure looks this way, with
folders for the corresponding queries shown below.
The qsharedFolder.json can be downloaded from here:
https://services.zylk.net/share/s/uWJD_2FLR36_sv8_lLyjCw
{ "name" : "My logical views", "nodes" : [ { "id" : "100", "name" : "Shared - Public", "description" : "Files with aspect qshare:shared", "nodes" : [ { "id" : "101", "name" : "Shared - Public documents", "description" : "ASPECT:'qshare:shared'", "search" : { "language" : "fts-alfresco", "query" : "(PATH:'%ACTUAL_PATH%//*') AND ASPECT:'qshare:shared'" } },{ "id" : "102", "name" : "Shared - Public documents by ccl001", "description" : "ASPECT:'qshare:shared' AND @qshare:sharedBy:ccl001", "search" : { "language" : "fts-alfresco", "query" : "(PATH:'%ACTUAL_PATH%//*') AND ASPECT:'qshare:shared' AND @qshare:sharedBy:ccl001" } },{ "id" : "103", "name" : "Shared - Public documents with effectivity properties", "description" : "ASPECT:'qshare:shared' AND ASPECT:'cm:effectivity'", "search" : { "language" : "fts-alfresco", "query" : "(PATH:'%ACTUAL_PATH%//*') AND ASPECT:'qshare:shared' AND ASPECT:'cm:effectivity'" } },{ "id" : "104", "name" : "Shared - Public documents after 2016", "description" : "ASPECT:'qshare:shared' AND @cm:modified:['2016-01-01' TO NOW]", "search" : { "language" : "fts-alfresco", "query" : "(PATH:'%ACTUAL_PATH%//*') AND ASPECT:'qshare:shared' AND @cm:modified:['2016-01-01' TO NOW]" } },{ "id" : "105", "name" : "Shared - Public documents before 2016", "description" : "ASPECT:'qshare:shared' AND @cm:modified:[MIN TO '2016-01-01']", "search" : { "language" : "fts-alfresco", "query" : "(PATH:'%ACTUAL_PATH%//*') AND ASPECT:'qshare:shared' AND @cm:modified:[MIN TO '2016-01-01']" } }] } ] }
Links: