My intake after investing for almost a year in 2021

This year due to pandemic many things has changed including the way people invest in money. There are a lot of ways of investment. From a YouTube channel, I just heard different stocks that gain big…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Way to restrict Digital Assets type in AEM Touch UI pathbrowser

Recently one AEM implementation query came to my notice and it really excited me to explore following JCR property named: predicate and AbstractNodePredicate class and of course it helped me to learn their usages also.

Let’s get started with query and implementation steps.

The query was how can we filter/restrict digital assets based on certain types during selection via touch ui pathbrowser.

Inside DAM under a specific folder we can have different types assets like .pdf, .jpg, .jpeg, .png, .mp4 but the ask is only .jpg, .jpeg, .png, .mp4 will be available for content authors while content authoring via pathbrowser field.

Now we have two choice in terms of implementation -

Choice 1. Client side validation

Choice 2. Server side validation

Yes, you are correct I will talk about Server side validation here.

The business logic i.e. filtering logic has been defined in below implementation class -

if you take a closer look in above class I have defined property = { “predicate.name=my-imagevideopredicate” } and we need to use this value later -

Now the component dialog part has been given below -

Predicate property with relevant value

Steps to validate -

Below we could see that I have kept different types of assets under /content/dam/demo -

But as per the logic only .jpg, .jpeg, .png, .mp4 are available for content authors as shown below -

Before writing this sample logic I did some analysis to understand the property: predicate and AbstractNodePredicate class.

I am sharing that details also here -

If we execute below SQL2 query, it will give us list of nodes with predicate property and coral3 pathbrowser -

SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([/libs]) and predicate is not null and [sling:resourceType] = ‘granite/ui/components/coral/foundation/form/pathbrowser’

one of the result is /libs/screens/core/components/content/app/cq:dialog/content/items/column/items/app-path and it is also using predicate property(allowing only AEM pages).

OSGi component and bundle details associated with OOTB Application component has been given below -

Out of the OSGi component and bundle details

I am really thankful to AEM experience league community that gave me opportunity to explore this feature.

Please refer the below useful link -

Please review and share your valuable thoughts.

Add a comment

Related posts:

Here Is a Rundown of 5 Major Tech Trends We Will See In 2022

Every year we see technology developments grow to enormous lengths as the rate of innovation increases YoY. A couple of years ago, I started to keep track of the major tech trends that have developed…

Drama

Acho que essa minha mania de contar meus “causos” vem do meu bisavô. Uma das histórias dele que eu adorava era de como ele conheceu minha bisavó — ele tocando com sua banda, ela na platéia. Na…

Mirror Protocol Partners With Band Protocol to Secure Issuance of Synthetic Stocks and ETFs

Mirror has strategically partnered with cross-chain data oracle Band Protocol, successfully integrating price feeds for an initial set of assets, covering blue chip stocks, commodities and ETFs. To…