Hi Juan,
I have found the following use cases:
Use Case 1: Deleting an asset
Whenever a user wants to delete an asset, Liferay should check if this asset is being used on a portal page directly or indirectly. If references to an asset have been found, those references (i.e. portal pages) are displayed, and the user is asked if she still wants to delete that asset.
With directly, I mean that the asset is referenced by one of the two portlets. With indirectly, I mean assets (e.g. images or documents) that are used by the directly referenced assets.
The reference check only takes into account the published version or (where applicable) the draft version of an asset. Older versions are ignored.
I would restrict this check to Web Content Display portlet and Asset Publisher portlet, since those are the standard ways to publish an asset on a portal page.
Use Case 2: Deleting a version of an asset
Whenever a user wants to delete the published version of an asset, Liferay should check if the version that will become the new published version contains references to assets that do not exist (anymore).
Use Case 3: Check if an asset is being used
In the Control Panel, the user can check for every asset if it is being used on a portal page directly or indirectly. The reference check only takes into account the published version or (where applicable) the draft version of an asset. Older versions are ignored.
This function is useful if an editor wants to clean the content pool by removing unused objects.
Use Case 4: Bulk check for unused assets
A user can check (with just one click) the references of all assets of a community. The result of this function is either a list of all assets without a direct or indirect reference, or a list of all assets, together with a reference count (direct/indirect) or a list of referenced assets.
I unserstand your issue with the indirect links. However, to us this is very important, since we heavily use structured content. I could imagine a two-step process. In a first implementation, only the direct links will be evaluated. Later on, the indirect link analysis can be added. What do you think?
Kind regards,
Holger
Hi Holger:
do you propose this to be a method in a service? Something like assetEntry.getUsageCount() so that you can check before deleting or something more informative for the administrator (just in the UI)? I mean, you want to "see" the usage statistics of each asset or you want to behave depending on that statistics?