{"id":63243,"date":"2024-08-26T11:16:15","date_gmt":"2024-08-26T05:46:15","guid":{"rendered":"https:\/\/www.tothenew.com\/blog\/?p=63243"},"modified":"2024-08-26T11:48:28","modified_gmt":"2024-08-26T06:18:28","slug":"extending-acs-aem-commons-reporting","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/extending-acs-aem-commons-reporting\/","title":{"rendered":"Extending ACS AEM Commons Reporting"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">ACS AEM Commons Reporting is a collection of reporting tools and utilities designed to enhance the reporting capabilities within AEM. It offers a solid foundation for generating insightful reports, but what if you need to tailor reporting functionalities to meet specific business needs? That&#8217;s where extending ACS AEM Commons Reporting comes into play.<\/span><\/p>\n<h3><b>Problem Statement<\/b><\/h3>\n<p>The out-of-the-box\u00a0 report editor column in ACS AEM Commons allows users to redirect to the URL or page when executing the report. However, when downloading the report, there is no column for the URL or page path. To address this, we need to extend its default functionality to include a column with the page path in the downloaded report.<\/p>\n<div id=\"attachment_64448\" style=\"width: 845px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-64448\" decoding=\"async\" loading=\"lazy\" class=\" wp-image-64448\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/08\/executeReport.png\" alt=\"execute\" width=\"835\" height=\"277\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/08\/executeReport.png 1793w, \/blog\/wp-ttn-blog\/uploads\/2024\/08\/executeReport-300x100.png 300w, \/blog\/wp-ttn-blog\/uploads\/2024\/08\/executeReport-1024x340.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2024\/08\/executeReport-768x255.png 768w, \/blog\/wp-ttn-blog\/uploads\/2024\/08\/executeReport-1536x510.png 1536w, \/blog\/wp-ttn-blog\/uploads\/2024\/08\/executeReport-624x207.png 624w\" sizes=\"(max-width: 835px) 100vw, 835px\" \/><p id=\"caption-attachment-64448\" class=\"wp-caption-text\">Execute Report<\/p><\/div>\n<p>Here, you can see in the image there is no edit column in the downloaded report.<\/p>\n<div id=\"attachment_64446\" style=\"width: 841px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-64446\" decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-64446\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/08\/noedit.png\" alt=\"edit\" width=\"831\" height=\"208\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/08\/noedit.png 831w, \/blog\/wp-ttn-blog\/uploads\/2024\/08\/noedit-300x75.png 300w, \/blog\/wp-ttn-blog\/uploads\/2024\/08\/noedit-768x192.png 768w, \/blog\/wp-ttn-blog\/uploads\/2024\/08\/noedit-624x156.png 624w\" sizes=\"(max-width: 831px) 100vw, 831px\" \/><p id=\"caption-attachment-64446\" class=\"wp-caption-text\">Downloaded Report<\/p><\/div>\n<p>&nbsp;<\/p>\n<p>For reports to be truly effective and user-friendly, they need to provide direct, clickable links to each page. This limitation persists even in the latest version of ACS AEM Commons.<\/p>\n<h3><b>Solution Approach<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Extend the ACS AEM Commons Reports to include the full URL.<\/span><\/p>\n<h3><b>Steps to Achieve the Solution<\/b><\/h3>\n<h4>Step 1. Create a Custom Component:<\/h4>\n<p>Define the component with<\/p>\n<pre>sling:resourceSuperType= \"acs-commons\/components\/utilities\/report-builder\/columns\/editor\".<\/pre>\n<p><strong>Component XML Configuration:<\/strong><\/p>\n<pre>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;jcr:root xmlns:sling=\"http:\/\/sling.apache.org\/jcr\/sling\/1.0\" xmlns:cq=\"http:\/\/www.day.com\/jcr\/cq\/1.0\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0xmlns:jcr=\"http:\/\/www.jcp.org\/jcr\/1.0\"\r\n\u00a0\u00a0\u00a0\u00a0jcr:primaryType=\"cq:Component\"\r\n\u00a0\u00a0\u00a0\u00a0jcr:title=\"Custom Report Builder Editor Column\"\r\n\u00a0\u00a0\u00a0\u00a0sling:resourceSuperType=\"acs-commons\/components\/utilities\/report-builder\/columns\/editor\"\r\n\u00a0\u00a0\u00a0\u00a0componentGroup=\"ACS Commons - Report Builder Column\"\/&gt;<\/pre>\n<h4>Step 2. Configure the Dialog:<\/h4>\n<p>Add an exporter to the dialog with the value pointing to the custom model for CSV export. The exporter is responsible for adding the URL column to the CSV file.<\/p>\n<p><strong>Dialog XML Configuration:<\/strong><\/p>\n<pre>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;jcr:root xmlns:sling=\"http:\/\/sling.apache.org\/jcr\/sling\/1.0\" xmlns:cq=\"http:\/\/www.day.com\/jcr\/cq\/1.0\" xmlns:jcr=\"http:\/\/www.jcp.org\/jcr\/1.0\" xmlns:nt=\"http:\/\/www.jcp.org\/jcr\/nt\/1.0\"\r\n\u00a0\u00a0\u00a0\u00a0jcr:primaryType=\"nt:unstructured\"\r\n\u00a0\u00a0\u00a0\u00a0jcr:title=\"Report Editor Column\"\r\n\u00a0\u00a0\u00a0\u00a0sling:resourceType=\"cq\/gui\/components\/authoring\/dialog\"\r\n\u00a0\u00a0\u00a0\u00a0helpPath=\"https:\/\/adobe-consulting-services.github.io\/acs-aem-commons\/features\/reports\"&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;content\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0jcr:primaryType=\"nt:unstructured\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0sling:resourceType=\"granite\/ui\/components\/foundation\/container\"&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;layout\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0jcr:primaryType=\"nt:unstructured\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0sling:resourceType=\"granite\/ui\/components\/foundation\/layouts\/fixedcolumns\"\/&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;items jcr:primaryType=\"nt:unstructured\"&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;column\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0jcr:primaryType=\"nt:unstructured\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0sling:resourceType=\"granite\/ui\/components\/foundation\/container\"&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;items jcr:primaryType=\"nt:unstructured\"&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;exporter\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0jcr:primaryType=\"nt:unstructured\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0sling:resourceType=\"granite\/ui\/components\/foundation\/form\/hidden\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0name=\".\/exporter\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0value=\"com.mysite.core.models.CustomPathReportCellCSVExporter\" \/&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;\/items&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;\/column&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;\/items&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;\/content&gt;\r\n&lt;\/jcr:root&gt;<\/pre>\n<h4>Step 3. Model Creation<\/h4>\n<p>We will create our custom model which implements ReportCellCSVExporter and here we will write our custom logic to get a full page Url.<\/p>\n<p><strong>Java Class for Model Implementation:<\/strong><\/p>\n<pre>import com.adobe.acs.commons.reports.api.ReportCellCSVExporter;\r\nimport org.apache.sling.api.resource.Resource;\r\nimport org.apache.sling.models.annotations.Model;\r\nimport org.apache.sling.models.annotations.Optional;\r\nimport org.apache.sling.models.annotations.injectorspecific.OSGiService;\r\nimport org.apache.sling.models.annotations.injectorspecific.ValueMapValue;\r\nimport javax.annotation.PostConstruct;\r\nimport java.util.Objects;\r\n\r\n@Model(adaptables = Resource.class)\r\npublic class CustomPathReportCellCSVExporter implements ReportCellCSVExporter {\r\n\u00a0\u00a0\u00a0\u00a0@ValueMapValue\r\n\u00a0\u00a0\u00a0\u00a0private String editor;\r\n\r\n\u00a0\u00a0\u00a0\u00a0@ValueMapValue @Optional\r\n\u00a0\u00a0\u00a0\u00a0private String customEditor;\r\n\r\n\u00a0\u00a0\u00a0\u00a0@PostConstruct\r\n\u00a0\u00a0\u00a0\u00a0protected void init() {\r\n\u00a0\u00a0\u00a0\u00a0customEditor = customEditor != null ? customEditor : \"\";\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\r\n\u00a0\u00a0\u00a0\u00a0@Override\r\n\u00a0\u00a0\u00a0\u00a0public String getValue(Object result) {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Resource resource = (Resource) result;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0String url = \"http:\/\/localhost:4502\/\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if(Objects.equals(editor, \"custom\")) {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return url + customEditor + resource.getPath();\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0else{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return url + editor + resource.getPath();\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0\u00a0}\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<h3><b>Creating the Report<\/b><\/h3>\n<h4><b>Navigate to Report Creation<\/b><\/h4>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Go to AEM UI Tools =&gt; ACS AEM Commons =&gt; Reports.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Add the title and click on the &#8220;Add Report&#8221; button.<\/span><\/li>\n<\/ul>\n<h4><b>Add and Edit Report<\/b><\/h4>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Initially, the newly created report will appear in the list.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Edit the report to configure it.<\/span><\/li>\n<\/ul>\n<div id=\"attachment_63239\" style=\"width: 635px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-63239\" decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-63239\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/07\/empty-1024x433.png\" alt=\"Customized\" width=\"625\" height=\"264\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/07\/empty-1024x433.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2024\/07\/empty-300x127.png 300w, \/blog\/wp-ttn-blog\/uploads\/2024\/07\/empty-768x325.png 768w, \/blog\/wp-ttn-blog\/uploads\/2024\/07\/empty-624x264.png 624w, \/blog\/wp-ttn-blog\/uploads\/2024\/07\/empty.png 1097w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><p id=\"caption-attachment-63239\" class=\"wp-caption-text\">Customized Page Report<\/p><\/div>\n<h4><b>Configure Report Details<\/b><\/h4>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Configure the report builder as per your requirements.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Search Parameters: Set the desired parameters for your report.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Result Columns: Use your custom component (Custom Report Builder Editor Column) to show the URL.<\/span><\/li>\n<\/ul>\n<div id=\"attachment_63238\" style=\"width: 552px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-63238\" decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-63238\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/07\/result2.png\" alt=\"Report Editor\" width=\"542\" height=\"338\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/07\/result2.png 542w, \/blog\/wp-ttn-blog\/uploads\/2024\/07\/result2-300x187.png 300w\" sizes=\"(max-width: 542px) 100vw, 542px\" \/><p id=\"caption-attachment-63238\" class=\"wp-caption-text\">Report Editor Column<\/p><\/div>\n<h3><b>Download the Report<\/b><\/h3>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Select the Custom Published Pages Report.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Download your report <\/span>now, you will be able to see an Edit column with a complete page URL.<\/li>\n<\/ul>\n<p>now, you will be able to see an Edit column with a complete page URL.<\/p>\n<div id=\"attachment_64449\" style=\"width: 921px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-64449\" decoding=\"async\" loading=\"lazy\" class=\" wp-image-64449\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/08\/editadded.png\" alt=\"download\" width=\"911\" height=\"176\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/08\/editadded.png 1439w, \/blog\/wp-ttn-blog\/uploads\/2024\/08\/editadded-300x58.png 300w, \/blog\/wp-ttn-blog\/uploads\/2024\/08\/editadded-1024x198.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2024\/08\/editadded-768x148.png 768w, \/blog\/wp-ttn-blog\/uploads\/2024\/08\/editadded-624x121.png 624w\" sizes=\"(max-width: 911px) 100vw, 911px\" \/><p id=\"caption-attachment-64449\" class=\"wp-caption-text\">Download Report<\/p><\/div>\n<h3><b>Conclusion<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">ACS AEM Commons Reporting offers robust tools for AEM users to extract insights and optimize digital experiences. Developers can extend its functionalities for specific business needs, enhancing analytics efforts. This blog outlines steps to leverage ACS AEM Commons Reporting for successful digital initiatives.<\/span><\/p>\n<h3><b>References<\/b><\/h3>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"font-weight: 400;\"><a href=\"https:\/\/adobe-consulting-services.github.io\/acs-aem-commons\/features\/report-builder\/index.html\"><span style=\"font-weight: 400;\">ACS AEM Commons Reporting<\/span><\/a><\/li>\n<li style=\"font-weight: 400;\"><a href=\"https:\/\/adobe-consulting-services.github.io\/acs-aem-commons\/features\/report-builder\/extending.html\"><span style=\"font-weight: 400;\">Extending ACS AEM Commons Reporting<\/span><\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>ACS AEM Commons Reporting is a collection of reporting tools and utilities designed to enhance the reporting capabilities within AEM. It offers a solid foundation for generating insightful reports, but what if you need to tailor reporting functionalities to meet specific business needs? That&#8217;s where extending ACS AEM Commons Reporting comes into play. Problem Statement [&hellip;]<\/p>\n","protected":false},"author":1699,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":541},"categories":[5868],"tags":[6142,4847,6143,6141],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/63243"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/1699"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=63243"}],"version-history":[{"count":6,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/63243\/revisions"}],"predecessor-version":[{"id":64579,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/63243\/revisions\/64579"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=63243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=63243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=63243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}