April 16, 2020
Estimated Post Reading Time ~

Comprehensive Guide on Collections AEM

AEM Collections are a set of assets bundled together, which can include different types of assets like images, pdf, and videos from different locations. Many times we face the requirement where a customer wants to share a group of multiple types of assets with either internal or external clients, this can be achieved using aem collections. These collections can be shared with various users with edit level, owner level, and viewer level privileges. A special thanks to Vernica Gupta for helping with this article.

There are two types of collection available in aem, based on how they collate assets:-
Collection – that contains a static reference list of assets, folders, and other collections.
Smart collection – that dynamically includes assets based on search criteria.

After completing this tutorial, you will have a clear understanding of:
How to create a collection ( static collection ) in aem.
How to add assets to a collection.
How Collections data is stored in JCR.
How to create a smart collection (dynamic collection ) in aem.
How Smart Collections data is stored in JCR.
How to Edit Smart Collection.
Different Collection groups created while creating a collection.

Create Collection in AEM:
Follow the below steps to create aem collections:-
Click on the AEM logo on the top left and select Assets.
On navigating to Assets select Collections.
Click on the Create button on the top right side of the Collection Console.
Enter title and description on Create Collection page.
The User creating the collection will be the owner by default.
You can add users with which you want to Share the Collection depending on different roles. (Editor, Viewer, Owner).



Click Create and then click OK to close the dialog. A collection will be opened in the Collections console.

Note: If public collection checkbox is checked the Collection becomes public and need not be shared with any other user. This collection will be available to all the DAM Users group with the Viewer role.

Note: To enable the members to share collections with other users, provide the dam-users group read permissions at the path home/users.

Below flow chart will help you to understand the life cycle of aem collections:-

AEM Collections Flow Chart

Adding Assets to Collection:
The assets can be explicitly added to a Collection at any point in time. Follow the below steps to add assets to a collection.
Navigate to Assets and select Files.
Navigate to a specified folder, select any asset and click on To Collection icon.



It will navigate to the Collections console, select the collection to which you want to add the asset.



Click Add. The Asset gets added to the Collection.

How Collections data is stored in JCR:
When we create a collection a node gets created in crx/de under /content/dam/collections, by the title specified while creating a collection.



When a collection gets created in JCR, sling:members node gets created which has a property sling:resources that have a reference of all the assets added to the collection.



A node demonstrating the asset added to the collection also gets created which again has the asset reference.



Create Smart Collection in AEM:
Smart Collections are the dynamic collections that use search criteria to dynamically populate assets.

Navigate to the Assets console, Assets –> Files and click the Search icon on the top right corner.
Enter the search keyword and press Enter.
From the top left window select filter to expand left rail.
Select the filter criteria, if it is based on keywords. else leave it blank.



Select one or more options you configured for the search facets. For example, select Images for File Types to search for images.
To create a Smart Collection from the search performed click on the Smart Collection button.

Enter the Collection Name and select Public to add the DAM Users group with the Viewer role to the smart collection.



Clicking on Save will create a Smart Collection. The Smart Collection gets added to the Saved Search List. Any of the smart collections can be edited by selecting it from the Saved Searches list.

Now let's see how it stores the data.

How Smart Collections data is stored in JCR:
Smart collection also store data under /content/dam/collections. Every smart collection when stored in JCR has a dam:query property which has the search query stored in it.

The assets of the smart collection are a result of this query execution. This is the reason why it is known as dynamic collection, as the results are dynamic depending on the data in AEM.



Modify Smart Collection in AEM:
Follow the below steps to modify an existing smart collection:
Navigate to Assets –> Files ( http://localhost:4502/assets.html/content/dam ).
Click on the search icon on the top right corner and press Enter.
Click on the Filter icon on the top left of the page.



From the Saved search dropdown. Select the smart collection that you want to modify. (ex- dynamic collection)
Change the filter criteria as per your requirements. For ex:- Let's add multimedia file type also to our smart collection.
Select the Multimedia checkbox under File Type.



Click on Edit Smart Collection on the bottom of the page.
Click on the Save button to save the changes.
Edit Smart Collection pop up will open.
Select overwrite if you want to overwrite the collection.
Select Save as a checkbox, if you want to save these changes as part of the new smart collection, keeping older smart collection as it is. Enter the name of the new smart collection once you select the checkbox.



Smart Collection success pop up gets displayed.

That’s it you have successfully modified an existing smart collection.

Collection Groups in AEM:
Whenever a collection is created there are three groups that get created for each collection in AEM.
mac-default-{name of collection}
mac-default-{name of collection}-owner
mac-default-{name of collection}-editor

mac-default-{name of collection} – group is like a parent group with all the users that are assigned different levels of privileges on the collection.

mac-default-{name of collection}-owner – is the owner group with all the users that are assigned owner level privileges on the collection.

mac-default-{name of collection}-editor – is the editor group with all the users that are assigned editor level privileges on the collection.

I hope you get a fair understanding of what AEM collections are and how we can use them in AEM. Please drop a comment below, if you want me to add more info about any particular topic related to AEM collections here.



By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.