This use case is for cleaning of the assets from the author which are unreferenced and we want to have the same use case for workflow deactivation of the page
Below is the use case:
Step 1: Create page A and use image component with image A authored and publish the page A.(NOTE : Image A is newly uploaded asset and is referenced only in page A. Also it is published.)
Step 2: go to damadmin and open image A - if we see under the references tab - it will list only one reference i.e. page A
Step 3: Now update the image component with image B in page A and do not publish the page A.
Step 4: In Author - Page A has image B referenced and in Publish - Page A has image A referenced.
Assuming we want to clean up unreferenced assets then Image A is orphan as it is not having any references. If we deactivate this asset then at the publisher end - page will break as asset will not be found.
We are looking for some APIs which will provide asset reference go through previous versions of the page A and check if the asset is really orphan or not.
* Leverages the AssetReferenceSearch OSGi service to find all usages on AEM Author
* Makes HTTP GET to the OOTB Reference servlet (see above) on AEM Publish to collect usage there
* Collate the usages to determinate what's used
2b. Build a tool that runs outside of AEM
* Export list of assets to input into tool (or even, provide root path like /content/dam)
* Have tool call OOTB Reference servlet on AEM Author (w/ credentials)
* Have tool call OOTB reference servlet on AEM Publish
Obviously, there's alot of implementation details that can't be enumerated here, but I think there are your 3 best approaches based on how you want to perform the validations, and what infrastructure you have to run these jobs.
Notes: * if you use pass in folders with many assets, you may need to adjust the ReferenceSearchServlet's referencesearchservlet.maxPages and referencesearchservlet.maxReferencesPerPage OSGi config properties.
* If you have protected (non anonymous) pages on AEM Publish, youll need to authenticate the calls to the Reference servlet appropriately so it can "see" all the pages.