<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sady Rifat on Medium]]></title>
        <description><![CDATA[Stories by Sady Rifat on Medium]]></description>
        <link>https://medium.com/@sadyrifat?source=rss-9d815c86cc87------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*D_pR60DyPViX48Fo</url>
            <title>Stories by Sady Rifat on Medium</title>
            <link>https://medium.com/@sadyrifat?source=rss-9d815c86cc87------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 22:03:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sadyrifat/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Maven Magic in AEM: Build & Share Artifacts with Nexus]]></title>
            <link>https://sadyrifat.medium.com/maven-magic-in-aem-build-share-artifacts-with-nexus-4624aa06f1cd?source=rss-9d815c86cc87------2</link>
            <guid isPermaLink="false">https://medium.com/p/4624aa06f1cd</guid>
            <category><![CDATA[nexus]]></category>
            <category><![CDATA[build]]></category>
            <category><![CDATA[aem]]></category>
            <category><![CDATA[maven]]></category>
            <category><![CDATA[import-export]]></category>
            <dc:creator><![CDATA[Sady Rifat]]></dc:creator>
            <pubDate>Mon, 29 Apr 2024 12:34:32 GMT</pubDate>
            <atom:updated>2024-04-29T12:36:25.945Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ao-w_rl4TLVGSHIAMsdMdw.png" /></figure><p>In the dynamic AEM (Adobe Experience Manager) development world, harnessing the power of Maven and Sonatype Nexus can be the key to unlocking seamless project builds and efficient artifact sharing. We’ll delve into the intricacies of incorporating Maven into your AEM projects and leveraging Sonatype Nexus for enhanced build processes and simplified artifact sharing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*Ddf9HLzpRJrCTEnNg5P2sA.jpeg" /></figure><h3>Setup Nexus Repository</h3><p>Nexus is a self-managed repository manager that centralizes the storage and distribution of software artifacts, offering organizations control over their infrastructure for efficient management and retrieval of dependencies in the development process.</p><blockquote><strong><em>Install:</em></strong></blockquote><p>Follow this documentation to install the Nexus repo. <a href="https://help.sonatype.com/en/installation-methods.html"><em>https://help.sonatype.com/en/installation-methods.html</em></a><br>For quick setup I used docker.</p><pre>docker run -d -p 8081:8081 --name nexus sonatype/nexus3</pre><p>After successfully installing we will see something like this screen. (<a href="http://localhost:8081/#browse/browse"><em>http://localhost:8081/#browse/browse</em></a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hq8J2M3k-tEU7x3BhqgPxg.png" /></figure><p>Login to the Nexus repo. For 1st time login, we need to get the admin password from <strong>sonatype-work/nexus3/admin.password. </strong>Copy the password and logged in with:<br>Username: admin<br>Password: Retrieved password</p><blockquote><strong><em>Setup</em></strong></blockquote><blockquote><strong>Create Nexus Role</strong></blockquote><p>Create a custom role first, for example, ‘<strong>nexus-access,</strong>’ and apply privileges based on your access requirements. In my case, I added <strong>nx-repository-view-*-*-*</strong> where CRUD operations can be performed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QkhtXiP0mIdD-NyRuni74Q.png" /></figure><blockquote><strong>Create Nexus User</strong></blockquote><p>Create a new user and Grant the previously created Role. Took the user ID and password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*54Pr2hqVcvrl6AP1RVzlxg.png" /></figure><p>Make sure you disallow the anonymous access. Otherwise, anyone can access your repository. If you are planning to make a public repo then you can enable it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*NLRbZat8rke6phKXMHpIxQ.png" /></figure><h3>Part 1: Maven Deploy</h3><p>In your project mail <strong>pom.xml</strong> file add the following XML.</p><pre>    &lt;distributionManagement&gt;<br>        &lt;repository&gt;<br>            &lt;id&gt;nexus-repo&lt;/id&gt;<br>            &lt;name&gt;releases&lt;/name&gt;<br>            &lt;url&gt;http://localhost:8081/repository/maven-releases/&lt;/url&gt;<br>        &lt;/repository&gt;<br>        &lt;snapshotRepository&gt;<br>            &lt;id&gt;nexus-repo&lt;/id&gt;<br>            &lt;name&gt;snapshots&lt;/name&gt;<br>            &lt;url&gt;http://localhost:8081/repository/maven-snapshots/&lt;/url&gt;<br>        &lt;/snapshotRepository&gt;<br>    &lt;/distributionManagement&gt;</pre><p>Also in your <strong>.m2/setting.xml</strong> file</p><pre><br>    &lt;server&gt;<br>        &lt;id&gt;nexus-repo&lt;/id&gt;<br>        &lt;username&gt;nexus-repo&lt;/username&gt;<br>        &lt;password&gt;root&lt;/password&gt;<br>    &lt;/server&gt;</pre><pre>&lt;profile&gt;<br>    &lt;id&gt;nexus-central&lt;/id&gt;<br>    &lt;repositories&gt;<br>        &lt;repository&gt;<br>            &lt;id&gt;nexus-repo&lt;/id&gt;<br>            &lt;url&gt;http://localhost:8081/repository/maven-releases/&lt;/url&gt;<br>            &lt;releases&gt;<br>                &lt;enabled&gt;true&lt;/enabled&gt;<br>            &lt;/releases&gt;<br>            &lt;snapshots&gt;<br>                &lt;enabled&gt;false&lt;/enabled&gt;<br>            &lt;/snapshots&gt;<br>        &lt;/repository&gt;<br>    &lt;/repositories&gt;<br>    &lt;pluginRepositories&gt;<br>        &lt;pluginRepository&gt;<br>            &lt;id&gt;nexus-repo&lt;/id&gt;<br>            &lt;url&gt;http://localhost:8081/repository/maven-snapshots/&lt;/url&gt;<br>            &lt;releases&gt;<br>                &lt;enabled&gt;false&lt;/enabled&gt;<br>            &lt;/releases&gt;<br>            &lt;snapshots&gt;<br>                &lt;enabled&gt;true&lt;/enabled&gt;<br>            &lt;/snapshots&gt;<br>        &lt;/pluginRepository&gt;<br>    &lt;/pluginRepositories&gt;<br>&lt;/profile&gt;</pre><pre>&lt;activeProfiles&gt;<br>    &lt;activeProfile&gt;adobe-public&lt;/activeProfile&gt;<br>    &lt;activeProfile&gt;nexus-central&lt;/activeProfile&gt;<br>    &lt;activeProfile&gt;maven-central&lt;/activeProfile&gt;<br>&lt;/activeProfiles&gt;</pre><p>You will get the related changes here: <a href="https://github.com/Sady-Rifat/aem-demo/commit/0a86d8e3006f9f727e6d8f9e67968234af1f2f4c">https://github.com/Sady-Rifat/aem-demo/commit/0a86d8e3006f9f727e6d8f9e67968234af1f2f4c</a></p><p>Now from your terminal run this command: <strong>mvn clean deploy</strong></p><p>Based on your project version it will be in either maven-releases or maven-snapshots.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7SpqggFa60WMhI2j0brR1g.png" /></figure><h3>Part 2: Maven Import</h3><p>Now consider another AEM project where I intend to import a Maven dependency deployed on the Nexus Repository. The concept revolves around installing our primary project, wherein, during build time, it downloads the dependent project from Nexus and installs it into CRX.</p><p>For this import this into the project main pom.xml file,</p><pre>      &lt;dependency&gt;<br>        &lt;groupId&gt;com.aem.demo&lt;/groupId&gt;<br>        &lt;artifactId&gt;aem-demo.all&lt;/artifactId&gt;<br>        &lt;type&gt;zip&lt;/type&gt;<br>        &lt;version&gt;1.0.0&lt;/version&gt;<br>      &lt;/dependency&gt;<br>      &lt;dependency&gt;<br>        &lt;groupId&gt;com.aem.demo&lt;/groupId&gt;<br>        &lt;artifactId&gt;aem-demo.core&lt;/artifactId&gt;<br>        &lt;version&gt;1.0.0&lt;/version&gt;<br>      &lt;/dependency&gt;</pre><p>In ui.apps &gt; pom.xml</p><pre>        &lt;dependency&gt;<br>            &lt;groupId&gt;com.aem.demo&lt;/groupId&gt;<br>            &lt;artifactId&gt;aem-demo.all&lt;/artifactId&gt;<br>            &lt;type&gt;zip&lt;/type&gt;<br>        &lt;/dependency&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;com.aem.demo&lt;/groupId&gt;<br>            &lt;artifactId&gt;aem-demo.core&lt;/artifactId&gt;<br>            &lt;type&gt;jar&lt;/type&gt;<br>        &lt;/dependency&gt;</pre><p>In core &gt; pom.xml</p><pre>        &lt;dependency&gt;<br>            &lt;groupId&gt;com.aem.demo&lt;/groupId&gt;<br>            &lt;artifactId&gt;aem-demo.core&lt;/artifactId&gt;<br>        &lt;/dependency&gt;</pre><p>In all &gt; pom.xml</p><pre>&lt;embedded&gt;<br>    &lt;groupId&gt;com.aem.demo&lt;/groupId&gt;<br>    &lt;artifactId&gt;aem-demo.all&lt;/artifactId&gt;<br>    &lt;target&gt;/apps/my-project-vendor-packages/application/install&lt;/target&gt;<br>&lt;/embedded&gt;</pre><blockquote><strong><em>Usages</em></strong></blockquote><p><strong>Component Level:</strong></p><p>Extend the HelloWorld component from aem-project-demo and see the result. All the related data are coming from the imported bundle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*n4MECE85397BWyjw7idFDQ.png" /></figure><p><strong>Service Level:</strong></p><p>Also, Create a Service in AEM Demo Project and use these codes from different bundles.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*YkEjcKkGliE8JyzhtGUzHQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*PUV_SKZp5NFoqWv8ugnwwA.png" /></figure><p>The related changes can be found here: <a href="https://github.com/Sady-Rifat/my-project/commit/95c07f90feac9cddfd90b10069a01883af830cf0">https://github.com/Sady-Rifat/my-project/commit/95c07f90feac9cddfd90b10069a01883af830cf0</a></p><p>Integrating Sonatype Nexus into your AEM development workflow offers a streamlined approach to managing project builds and dependencies. By leveraging Nexus as a centralized repository manager, you can efficiently store, share, and retrieve artifacts, facilitating collaboration and enhancing the reliability of your AEM projects. With the ability to import Maven dependencies directly from Nexus, you can ensure seamless integration of external components into your AEM applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4624aa06f1cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Effective Global Exception Handling in AEM: A Comprehensive Guide]]></title>
            <link>https://sadyrifat.medium.com/effective-global-exception-handling-in-aem-a-comprehensive-guide-acd4fd18a5c6?source=rss-9d815c86cc87------2</link>
            <guid isPermaLink="false">https://medium.com/p/acd4fd18a5c6</guid>
            <category><![CDATA[osgi]]></category>
            <category><![CDATA[exception-handling]]></category>
            <category><![CDATA[global-exception]]></category>
            <category><![CDATA[aem]]></category>
            <category><![CDATA[aop]]></category>
            <dc:creator><![CDATA[Sady Rifat]]></dc:creator>
            <pubDate>Wed, 11 Oct 2023 07:55:17 GMT</pubDate>
            <atom:updated>2023-10-11T07:55:17.504Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ma_foXgStKwh3eT4rm3SQA.jpeg" /></figure><p>Exception handling in AEM projects is a vital aspect of building robust and reliable web applications. As developers, we understand that effective exception handling is not just a safety net; it’s the foundation for creating resilient software. In this blog, we’ll delve into two key methodologies for handling exceptions in AEM:</p><ol><li>The traditional global approach operates based on package paths.</li><li>Innovative custom annotation-based technique allows developers to define the exception of both the method and class levels.</li></ol><p>These methods are essential in our journey towards crafting resilient AEM applications. Let’s explore how mastering exception handling can significantly affect your AEM development projects.</p><p>Before delving into the code setup, let’s establish the environment. To capture exceptions in your code, we’ll leverage the popular library, <strong>AspectJ</strong>. AspectJ, a powerful library for <strong>Aspect-Oriented Programming (AOP)</strong>, allows developers to define cross-cutting concerns and intercept method invocations, enhancing modularity and maintainability in AEM projects.</p><h3>Environment Setup:</h3><p>When running an AspectJ program, we need to add the <strong>AspectJ</strong> runtime library and its runtime dependency.</p><p>In <strong>project/pom.xml</strong>,</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;org.aspectj&lt;/groupId&gt;<br>    &lt;artifactId&gt;aspectjrt&lt;/artifactId&gt;<br>    &lt;version&gt;1.9.20.1&lt;/version&gt;<br>&lt;/dependency&gt;<br>&lt;dependency&gt;<br>    &lt;groupId&gt;org.aspectj&lt;/groupId&gt;<br>    &lt;artifactId&gt;aspectjweaver&lt;/artifactId&gt;<br>    &lt;version&gt;1.9.20.1&lt;/version&gt;<br>&lt;/dependency&gt;</pre><p>Add the dependency in core/pom.xml also.<br>This should be sufficient if we don’t use Lombok in the project. However, most of us prefer using Lombok to maintain clean code. After all, who wouldn’t want it?</p><p>But for using Lombok, we need to add a compile-time weaving plugin. <br>In the <strong>core/pom.xml</strong></p><pre>&lt;plugin&gt;<br>    &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;<br>    &lt;artifactId&gt;aspectj-maven-plugin&lt;/artifactId&gt;<br>    &lt;version&gt;1.14.0&lt;/version&gt;<br>    &lt;configuration&gt;<br>        &lt;complianceLevel&gt;1.8&lt;/complianceLevel&gt;<br>        &lt;source&gt;1.8&lt;/source&gt;<br>        &lt;target&gt;1.8&lt;/target&gt;<br>        &lt;showWeaveInfo&gt;true&lt;/showWeaveInfo&gt;<br>        &lt;verbose&gt;true&lt;/verbose&gt;<br>        &lt;Xlint&gt;ignore&lt;/Xlint&gt;<br>        &lt;encoding&gt;UTF-8 &lt;/encoding&gt;<br>        &lt;!-- IMPORTANT--&gt;<br>        &lt;excludes&gt;<br>            &lt;exclude&gt;**/*.java&lt;/exclude&gt;<br>        &lt;/excludes&gt;<br>        &lt;forceAjcCompile&gt;true&lt;/forceAjcCompile&gt;<br>        &lt;sources/&gt;<br>        &lt;weaveDirectories&gt;<br>            &lt;weaveDirectory&gt;${project.build.directory}/classes&lt;/weaveDirectory&gt;<br>        &lt;/weaveDirectories&gt;<br>        &lt;!-- IMPORTANT--&gt;<br>        &lt;aspectLibraries&gt;<br>            &lt;aspectLibrary&gt;<br>                &lt;groupId&gt;org.aspectj&lt;/groupId&gt;<br>                &lt;artifactId&gt;aspectjrt&lt;/artifactId&gt;<br>            &lt;/aspectLibrary&gt;<br>            &lt;aspectLibrary&gt;<br>                &lt;groupId&gt;org.aspectj&lt;/groupId&gt;<br>                &lt;artifactId&gt;aspectjweaver&lt;/artifactId&gt;<br>            &lt;/aspectLibrary&gt;<br>        &lt;/aspectLibraries&gt;<br>    &lt;/configuration&gt;<br>    &lt;executions&gt;<br>        &lt;execution&gt;<br>            &lt;goals&gt;<br>                &lt;goal&gt;compile&lt;/goal&gt;<br>                &lt;goal&gt;test-compile&lt;/goal&gt;<br>            &lt;/goals&gt;<br>        &lt;/execution&gt;<br>    &lt;/executions&gt;<br>&lt;/plugin&gt;</pre><p><em>Note: If your project doesn’t have Lombok and you encounter errors during the build process, you may need to add the Lombok plugin.</em></p><p>Sometimes, these jars might not be resolved. for that, you can follow this documentation. <br><a href="https://myaemlearnings.blogspot.com/2021/08/embedding-third-party-dependencyosgi.html"><em>Third-Party Dependency Resolve</em></a><em><br></em><a href="https://github.com/Sady-Rifat/aem-demo/commit/65f8ce112744134728bf2f85d7bc5f131a2ef290"><em>Third-Party Dependency Resolve: Code Example and Changes</em></a></p><h3>Methodology 1: Global Exception Handling by Package Path</h3><p>Global exception handling based on package paths is a conventional approach in AEM. It involves defining rules to catch exceptions across specific packages or classes. When an exception occurs within those predefined paths, the designated error-handling mechanism is triggered.</p><p>Create a package called exception and under that create a Java Class called GlobalExceptionHandler.</p><pre>package com.aem.demo.core.exception;<br><br>import lombok.extern.slf4j.Slf4j;<br>import org.aspectj.lang.annotation.AfterThrowing;<br>import org.aspectj.lang.annotation.Aspect;<br><br>@Slf4j<br>@Aspect<br>public class GlobalExceptionHandler {<br>    @AfterThrowing(<br>            pointcut = &quot;execution(* com.aem.demo.core..*.*(..)) &amp;&amp; &quot; +<br>                    &quot;!execution(* com.aem.demo.core.filters..*.*(..)) &amp;&amp;&quot; +<br>                    &quot;!execution(* com.aem.demo.core.exception..*.*(..))&quot;,<br>            throwing = &quot;exception&quot;<br>    )<br>    public void handleException(Exception exception) {<br>        // Handle or log the exception here<br>        log.error(&quot;Exception Caught: {}&quot;, exception.getMessage(), exception);<br>    }<br>}</pre><p>In the pointcut 1st statement defines the main target. It specifies that the advice should be applied to methods that are executed within classes in the com.aem.demo.core package and its subpackages. The *.*(..) denotes any method (*) with any parameters ((..)).</p><p>The next two statements indicate that the advice should exclude methods executed within classes in the <em>com.aem.demo.core.filters </em>and<em> com.aem.demo.core.exception</em> package and its subpackages. In other words, it skips any methods within this package hierarchy. You can skip based on your requirements.</p><h4>Pros:</h4><p><strong>Broad Scope:</strong> This method catches exceptions at the package or class level, providing a comprehensive approach to exception handling across the application.</p><p><strong>Centralized Control:</strong> It allows for centralizing exception handling logic, making it easier to manage and maintain.</p><h4>Cons:</h4><p><strong>Lack of Granularity:</strong> While it covers a wide range of exceptions, it lacks granularity. It treats all exceptions within the defined paths in a similar manner.</p><p><strong>Limited Flexibility:</strong> Global handling may not suit scenarios where you need more tailored exception handling for specific methods or classes.\</p><h3>Methodology 2: Custom Annotation-Based Exception Handling</h3><p>Unlike traditional methods, this approach provides granular control, ensuring that exception handling is applied only where it’s necessary — be it at the class level or specific methods. By leveraging annotations, developers can enhance the readability and maintainability of their code while tailoring exception handling to meet specific application requirements.</p><p>Create an annotation called FaultTolerant under the annotation package.</p><pre>package com.aem.demo.core.annotation;<br><br>import java.lang.annotation.ElementType;<br>import java.lang.annotation.Retention;<br>import java.lang.annotation.RetentionPolicy;<br>import java.lang.annotation.Target;<br><br>@Target({ElementType.TYPE, ElementType.METHOD})<br>@Retention(RetentionPolicy.RUNTIME)<br>public @interface FaultTolerant {<br>    Class&lt;? extends Throwable&gt;[] exceptions() default {};<br>}</pre><p>Also, an aspect of this annotation,</p><pre>package com.aem.demo.core.annotation;<br><br>import lombok.extern.slf4j.Slf4j;<br>import org.aspectj.lang.annotation.AfterThrowing;<br>import org.aspectj.lang.annotation.Aspect;<br><br>@Slf4j<br>@Aspect<br>public class FaultTolerantHandlingAspect {<br>    @AfterThrowing(pointcut=&quot;execution(* *(..)) &amp;&amp; &quot; +<br>            &quot;(@within(com.aem.demo.core.annotation.FaultTolerant) || &quot; +<br>            &quot;@annotation(com.aem.demo.core.annotation.FaultTolerant))&quot;, throwing=&quot;exception&quot;)<br>    public void handleException(Exception exception) {<br>        log.error(&quot;Exception Caught: {}&quot;, exception.getMessage(), exception);<br>    }<br>}</pre><h4><strong>Usages:</strong></h4><pre>// Class Level, will coverage for all methods under this class<br>// With Specific Exception<br>@FaultTolerant(exceptions = {DemoException.class})<br>@Model(adaptables = Resource.class)<br>public class HelloWorldModel<br><br>// Without Specific Exception, default will be generic Exception<br>@FaultTolerant<br>@Model(adaptables = Resource.class)<br>public class HelloWorldModel<br><br>// Method level, handle exception only for this function<br>// Without Specific Exception<br>@FaultTolerant<br>@PostConstruct<br>protected void init() throws DemoException{}<br><br>// With Specific Exception<br>@FaultTolerant(exceptions = {DemoException.class})<br>@PostConstruct<br>protected void init() throws DemoException{}</pre><h4>Pros:</h4><p><strong>Granular Control:</strong> Custom annotation-based exception handling provides fine-grained control over where and how exception-handling logic is applied. You can specify whether the handling should occur at the class or method level by using annotations.</p><p><strong>Scalability:</strong> This approach scales well with larger projects. As the codebase grows, custom annotations make it easier to manage and maintain exception-handling logic.</p><h4>Cons:</h4><p><strong>Annotation Overhead:</strong> While annotations enhance code readability, excessive use of annotations can clutter the code, making it harder to read and understand.</p><p><strong>Annotation Conflicts:</strong> In cases where multiple annotations with exception handling logic are applied to the same class or method, conflicts and unexpected behavior may arise. Proper annotation management is required to avoid conflicts.</p><p>While both methodologies have their merits, the choice ultimately depends on the project’s specific requirements and developer preferences. Whether implementing a project-wide safety net or crafting custom-tailored solutions using annotations, the pursuit of exceptional exception handling in AEM projects is crucial for maintaining application integrity.</p><p>In conclusion, the quest for effective exception handling in AEM projects offers a myriad of paths. With the right approach and methodologies at hand, developers can ensure that their applications remain robust, resilient, and error-free in the ever-evolving world of software development.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=acd4fd18a5c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Seamless Integration of Vue.js in AEM Project: A Step-by-Step Guide for AEM Developers — Part 4]]></title>
            <link>https://sadyrifat.medium.com/seamless-integration-of-vue-js-in-aem-project-a-step-by-step-guide-for-aem-developers-8783cdbcbfa7?source=rss-9d815c86cc87------2</link>
            <guid isPermaLink="false">https://medium.com/p/8783cdbcbfa7</guid>
            <category><![CDATA[vuex-modules]]></category>
            <category><![CDATA[aem]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[vuex]]></category>
            <category><![CDATA[vue-3]]></category>
            <dc:creator><![CDATA[Sady Rifat]]></dc:creator>
            <pubDate>Mon, 28 Aug 2023 11:23:10 GMT</pubDate>
            <atom:updated>2023-08-30T05:53:46.649Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 4: State Management</h3><blockquote>Missed Part 3: Follow This -&gt; <a href="https://medium.com/@sadyrifat/seamless-integration-of-vue-js-in-aem-project-a-step-by-step-guide-for-aem-developers-5872a7ba343">Part 3: Create a Component</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vZdKRZ6_AzslrycOkB4UkQ.jpeg" /></figure><p>Each of the AEM components is independent and defined with its own purpose. However, there are situations where a business case requires the management and sharing of data between two components. This is when the concept of state management becomes crucial. In this article, we will explore various methods to effectively manage and share data between these independent components.</p><h3>A state Object and Observe by Vuex</h3><p>In our management approach, we will use watchfor state observe. The watch functionality in Vue and Vuex provides a way to observe changes in reactive data, including <strong>Vuex</strong> state properties. It allows you to track specific properties or expressions and react when their values change.</p><pre>.<br>└── ui.frontend/<br>    └── src/<br>        └── main/<br>            └── aem-vue/<br>                ├── components/<br>                │   ├── helloworld<br>                │   └── login<br>                └── store/<br>                    ├── module/<br>                    │   ├── action.js<br>                    │   ├── getter.js<br>                    │   ├── mutation.js<br>                    │   └── state.js<br>                    └── index.js</pre><p><strong>Step 1:</strong> Create the following folder structure, where the store folder is very new.</p><p><strong>Step 2:</strong> In the <strong>state.js</strong> file create a state object.</p><pre>export default {<br>    count: 1<br>}</pre><p>In <strong>mutation.js</strong></p><pre>export const INCREMENT = (state) =&gt; {<br>    state.count++;<br>}</pre><p>In <strong>action.js</strong></p><pre>export const incrementCounter = ({commit}) =&gt; {<br>    commit(&#39;INCREMENT&#39;)<br>}</pre><p>In<strong> getter.js</strong></p><pre>export const getCount = (state) =&gt; {<br>    return state.count;<br>}</pre><p><strong>Step 3:</strong> In index.js register the Counter module,</p><pre>const {createStore} = Vuex;<br>import state from &#39;./module/state&#39;<br>import * as getters from &#39;./module/getter&#39;<br>import * as mutations from &#39;./module/mutation&#39;<br>import * as actions from &#39;./module/action&#39;<br><br>const AppStore = createStore({<br>    state,<br>    getters,<br>    mutations,<br>    actions<br>});<br><br>export default AppStore;</pre><p><strong>Step 4:</strong> In app.source.js register the newly created store,</p><pre>const {createApp} = Vue;<br>const {createStore} = Vuex;<br><br>import HelloWorld from  &quot;../../components/helloworld/main&quot;;<br>import Login from &quot;../../components/login/main&quot;;<br>import AppStore from &quot;../../store/index&quot;<br><br>// Create the Vue app<br>const app = createApp({<br>    components: {<br>        HelloWorld,<br>        Login<br>    }<br>});<br><br>const store = createStore(AppStore);<br>app.use(store);<br><br>// Mount the app to the element with the ID &quot;app&quot;<br>app.mount(&#39;#app&#39;);</pre><h3>Usages:</h3><p><strong>Step 5:</strong> Form the login component lets update the state value, in login/main.js</p><pre>AppStore.dispatch(&#39;Counter/incrementCounter&#39;);</pre><p><strong>Step 6:</strong> Let’s create an observable for the state update, in <strong>helloworld/main.js</strong></p><pre>import HelloTemplate from &#39;./template&#39;<br>import AppStore from &quot;../../store&quot;;<br><br>const { defineComponent } = Vue;<br><br>export default defineComponent({<br>    template: HelloTemplate.template,<br>    props: {<br>        modelData: String<br>    },<br>    setup() {<br><br>    },<br>    computed: {<br>        countNow() {<br>            return AppStore.getters.getCount;<br>        }<br>    }<br>});</pre><p>In <strong>helloworld/template.js</strong></p><pre>&lt;div&gt;State Counter {{countNow}}&lt;/div&gt;</pre><h3>Output:</h3><p>Now build the ui.frontend module,</p><pre>npm run build</pre><p>Install the AEM application and check the output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*XItPB6TjRiBA7MNO0NLJPw.gif" /><figcaption>Object share between 2 components by Vuex</figcaption></figure><blockquote><strong><em>You will get the specific changes in this Github commit:</em></strong><em> </em><a href="https://github.com/SadyRifat/aem-vue/commit/757a12a245a983bec241656d98f5737ae7ee5a8a">https://github.com/SadyRifat/aem-vue/commit/757a12a245a983bec241656d98f5737ae7ee5a8a</a></blockquote><blockquote><strong><em>Github Repo:</em></strong><em> </em><a href="https://github.com/SadyRifat/aem-vue"><em>https://github.com/SadyRifat/aem-vue</em></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8783cdbcbfa7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Seamless Integration of Vue.js in AEM Project: A Step-by-Step Guide for AEM Developers — Part 3]]></title>
            <link>https://sadyrifat.medium.com/seamless-integration-of-vue-js-in-aem-project-a-step-by-step-guide-for-aem-developers-5872a7ba343?source=rss-9d815c86cc87------2</link>
            <guid isPermaLink="false">https://medium.com/p/5872a7ba343</guid>
            <category><![CDATA[components]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[aem]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[aem-developer]]></category>
            <dc:creator><![CDATA[Sady Rifat]]></dc:creator>
            <pubDate>Wed, 23 Aug 2023 13:58:19 GMT</pubDate>
            <atom:updated>2023-08-28T11:26:22.715Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 3: Create a Component</h3><blockquote>Missed Part 2: Follow This -&gt; <a href="https://medium.com/@sadyrifat/seamless-integration-of-vue-js-in-aem-project-a-step-by-step-guide-for-aem-developers-527f8575f9c2">Part 2: VUE 3 Setup</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vZdKRZ6_AzslrycOkB4UkQ.jpeg" /></figure><p>Let’s get started by making our first component. This component will look like the usual AEM component and have just a few minimal parts: <strong>cq-dialog, .content.xml, component.html</strong></p><p>Now, the big change comes in how we handle the code. We’ll use something called ‘<strong>props</strong>’ that comes from Sling Model JSON data. Think of props as messages with information. These messages will travel through an HTML tag created by VueJs. When the server prepares the page, the Sling Model will create the JSON and set the value for our props.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*CsIjcwebRGOwNlTWQY_kag.jpeg" /></figure><p>When the webpage loads in the browser, the VueJs HTML tag will come to action. This template will use the information from the JSON file to fill in the placeholders. So, in the end, all these steps will come together, and you’ll see our finished component.</p><h3>Create a Component:</h3><blockquote><strong>Simple Component:</strong></blockquote><p>Let&#39;s start by creating a simple component.</p><p>Create a folder under components, let&#39;s name it helloworld. Inside this folder, create two files: main.js and template.js. In template.js, add the following markup:</p><pre>export default {<br>    template: `&lt;div class=&quot;cmp-helloworld__item&quot;&gt;<br>                    &lt;p class=&quot;cmp-helloworld__item-label&quot;&gt;Model message:&lt;/p&gt;<br>                    &lt;pre class=&quot;cmp-helloworld__item-output&quot; data-cmp-hook-helloworld=&quot;model&quot;&gt;Resource Path: {{ modelData.resourceType }}&lt;/pre&gt;<br>                    &lt;pre class=&quot;cmp-helloworld__item-output&quot; data-cmp-hook-helloworld=&quot;model&quot;&gt;Current Page Path: {{ modelData.currentPagePath }}&lt;/pre&gt;<br>                &lt;/div&gt;`,<br>    props: [&#39;modelData&#39;]<br>};</pre><p>In the main.js,</p><pre>import HelloTemplate from &#39;./template&#39;<br>const {defineComponent} = Vue;<br><br>export default defineComponent({<br>    template: HelloTemplate.template,<br>    props: {<br>        modelData: String<br>    },<br>    setup() {<br><br>    },<br>});</pre><p>Finally, register this component in the app.source.js</p><pre>const {createApp} = Vue;<br><br>import HelloWorld from  &quot;../../components/helloworld/main&quot;;<br><br>// Create the Vue app<br>const app = createApp({<br>    components: {<br>        HelloWorld<br>    }<br>});<br><br>// Mount the app to the element with the ID &quot;app&quot;<br>app.mount(&#39;#app&#39;);</pre><p>In the ui.apps/components helloworld.html add this custom Vue tag,</p><pre>    &lt;sly data-sly-use.model=&quot;com.aem.vue.core.models.HelloWorldModel&quot;&gt;<br>        &lt;hello-world :model-data=&quot;${model.getJsonData}&quot;&gt;&lt;/hello-world&gt;<br>    &lt;/sly&gt;</pre><p>Now run the build command from your ui.frontend folder.</p><pre>npm run build</pre><p>The sling model will provide the proper data.</p><pre>    public String getJsonData() {<br>        return &quot;{ \&quot;resourceType\&quot;: \&quot;&quot; + resourceType + &quot;\&quot;, \&quot;currentPagePath\&quot;: \&quot;&quot; + currentPagePath + &quot;\&quot; }&quot;;<br>    }</pre><p>For the demo, I used hardcoded JSON. When implemented create this JSON with a standard practice.</p><p>Now install the project. This time we will see the changes in the HelloWorld component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n3P_ynBCXRy_e83KvShnVA.png" /><figcaption>Output</figcaption></figure><p><strong>You will get the specific changes on this commit:</strong> <a href="https://github.com/SadyRifat/aem-vue/commit/abba7e0928bc9c62f732603078f7504f86690ff0">https://github.com/SadyRifat/aem-vue/commit/abba7e0928bc9c62f732603078f7504f86690ff0</a></p><blockquote><strong>Form Component:</strong></blockquote><p>Let’s create another component that has some functionality and user interaction. With the same procedure create another component called Login.</p><p>In login/template.js,</p><pre>const LoginTemplate = {<br>    template : `&lt;div&gt;<br>                    &lt;form @submit.prevent=&quot;doLogin&quot;&gt;<br>                        &lt;label for=&quot;email&quot;&gt;{{ modelData.email }}&lt;/label&gt;<br>                        &lt;input type=&quot;email&quot; v-model=&quot;email&quot; required&gt;<br>                        &lt;br&gt;<br>                        &lt;label for=&quot;password&quot;&gt;{{ modelData.password }}&lt;/label&gt;<br>                        &lt;input type=&quot;password&quot; v-model=&quot;password&quot; required&gt;<br>                        &lt;br&gt;<br>                        &lt;button type=&quot;submit&quot;&gt;{{ modelData.submitLabel }}&lt;/button&gt;<br>                    &lt;/form&gt;<br>                    &lt;p v-if=&quot;message&quot;&gt;{{ message }}&lt;/p&gt;<br>                &lt;/div&gt;`,<br>    props: [&#39;modelData&#39;]<br>}<br><br>export default LoginTemplate;</pre><p>In login/main.js,</p><pre>import LoginTemplate from &quot;./template&quot;;<br>const { ref, defineComponent } = Vue;<br><br>const Login = defineComponent({<br>    template: LoginTemplate.template,<br>    props: {<br>        modelData: Object<br>    },<br>    setup() {<br>        const email = ref(&#39;&#39;);<br>        const password = ref(&#39;&#39;);<br>        const message = ref(&#39;&#39;);<br><br>        const doLogin = async () =&gt; {<br>            console.log(&quot;Email: &quot; + email.value);<br>            console.log(&quot;Password: &quot; + password.value);<br><br>            // Update the message<br>            message.value = &quot;Form Submitted&quot;;<br>        };<br>        return { email, password, message, doLogin };<br>    },<br>});<br><br>export default Login;</pre><p>Again register the component in app.source.js</p><pre>import Login from &quot;../../components/login/main&quot;;<br><br>// Create the Vue app<br>const app = createApp({<br>    components: {<br>        HelloWorld,<br>        Login<br>    }<br>});</pre><p>Build the module,</p><pre>npm run build</pre><p>In ui.apps create a Login component,</p><pre>&lt;sly data-sly-test=&quot;${wcmmode.edit}&quot;&gt;<br>    &lt;div class=&quot;component-header&quot;&gt;&lt;span&gt;${component.title}&lt;/span&gt;&lt;/div&gt;<br>&lt;/sly&gt;<br><br>&lt;sly data-sly-use.model=&quot;com.aem.vue.core.models.LoginModel&quot;/&gt;<br>&lt;login :model-data=&quot;${model.getJsonData}&quot;&gt;&lt;/login&gt;</pre><p>The model will be com.aem.vue.core.models.LoginModel,</p><pre>@Model(adaptables = {Resource.class, SlingHttpServletRequest.class}, adapters = {LoginModel.class},<br>        resourceType = LoginModel.RESOURCE_TYPE, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)<br>@Exporter(name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, extensions = ExporterConstants.SLING_MODEL_EXTENSION, selector = ExporterConstants.SLING_MODEL_SELECTOR)<br>public class LoginModel {<br>    public static final String RESOURCE_TYPE = &quot;aem-vue/components/login&quot;;<br><br>    @ValueMapValue<br>    protected String email;<br>    @ValueMapValue<br>    protected String password;<br>    @ValueMapValue<br>    protected String submit;<br><br>    public String getEmail() {<br>        return email;<br>    }<br>    <br>    public String getPassword() {<br>        return password;<br>    }<br><br>    public String getSubmit() {<br>        return submit;<br>    }<br><br>    public String getJsonData() {<br>        return &quot;{ \&quot;email\&quot;: \&quot;&quot; + getEmail() + &quot;\&quot;, \&quot;password\&quot;: \&quot;&quot; + getPassword() + &quot;\&quot;, \&quot;submitLabel\&quot;: \&quot;&quot; + getSubmit() + &quot;\&quot; }&quot;;<br>    }<br>}</pre><blockquote>Output:</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*r3vuLsR3p6utlsztELGBOQ.png" /></figure><p>Here the expectations are fulfilled,</p><ul><li>The same component can be configured multiple times on a page</li><li>Individual data are properly maintained by Vue3 and no overlapped data</li><li>A user interaction form is created</li></ul><blockquote><strong>You will get the specific changes in this Github commit:</strong> <a href="https://github.com/SadyRifat/aem-vue/commit/beb04e8d142b4337352f11b963d346041aaddf10">https://github.com/SadyRifat/aem-vue/commit/beb04e8d142b4337352f11b963d346041aaddf10</a></blockquote><blockquote><strong>Github Repo:</strong> <a href="https://github.com/SadyRifat/aem-vue">https://github.com/SadyRifat/aem-vue</a></blockquote><blockquote><strong><em>Follow my next Article: </em></strong><a href="https://sadyrifat.medium.com/seamless-integration-of-vue-js-in-aem-project-a-step-by-step-guide-for-aem-developers-8783cdbcbfa7"><em>Part 4: State Management</em></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5872a7ba343" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Seamless Integration of Vue.js in AEM Project: A Step-by-Step Guide for AEM Developers — Part 2]]></title>
            <link>https://sadyrifat.medium.com/seamless-integration-of-vue-js-in-aem-project-a-step-by-step-guide-for-aem-developers-527f8575f9c2?source=rss-9d815c86cc87------2</link>
            <guid isPermaLink="false">https://medium.com/p/527f8575f9c2</guid>
            <category><![CDATA[vue]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[aem]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[aem-developer]]></category>
            <dc:creator><![CDATA[Sady Rifat]]></dc:creator>
            <pubDate>Wed, 23 Aug 2023 11:52:18 GMT</pubDate>
            <atom:updated>2023-08-30T10:18:09.336Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 2: VUE 3 Setup</h3><blockquote>Missed Part 1: Follow This -&gt; <a href="https://sadyrifat.medium.com/seamless-integration-of-vue-js-in-aem-project-a-step-by-step-guide-for-aem-developers-f6f4ce3dfee7">Part 1: Overview</a></blockquote><figure><img alt="AEM with Vue3" src="https://cdn-images-1.medium.com/max/1024/1*vZdKRZ6_AzslrycOkB4UkQ.jpeg" /><figcaption>AEM with VueJS</figcaption></figure><p>We are going to dive into the code within the <strong>ui.frontend</strong> module. In the diagram presented, I have outlined the high-level structure, with each item’s name indicative of its responsibilities. Once we write the code within the <strong>ui.frontend</strong> module, we will proceed to build it. Subsequently, the given structure will be generated in the ui.apps as a client library. To achieve this, we will employ a tool called <a href="https://github.com/Netcentric/fe-build"><strong>fe-build</strong></a>. Nonetheless, feel free to opt for an alternative structure or tool that aligns with your preferences.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N1KssR2AT5qWMJPJBIf0EA.jpeg" /><figcaption>UI Build architecture</figcaption></figure><h3>Setup fe-build:</h3><blockquote>Let’s do this step by step:</blockquote><p><strong>1. ui.frontend/pom.xml:</strong> <br>Remove the &lt;build&gt; section from the pom.xml file. Since we want to see the changes step-by-step.</p><p><strong>2. package.json:</strong> j<br>Modify the package.json file as follows:</p><pre>{<br>  &quot;name&quot;: &quot;fe-build-setup&quot;,<br><br>  &quot;description&quot;: &quot;FE build setup&quot;,<br>  &quot;version&quot;: &quot;1.0.0&quot;,<br>  &quot;scripts&quot;: {<br>    &quot;build&quot;: &quot;nc-fe-build&quot;,<br>    &quot;build:css&quot;: &quot;nc-fe-build --task=styles&quot;,<br>    &quot;build:js&quot;: &quot;nc-fe-build --task=webpack&quot;,<br>    &quot;build:clientlibs&quot;: &quot;nc-fe-build --task=clientlibs&quot;,<br>    &quot;watch&quot;: &quot;npm-run-all --parallel watch:js watch:css&quot;,<br>    &quot;watch:js&quot;: &quot;nc-fe-build --task=webpack --watch&quot;,<br>    &quot;watch:css&quot;: &quot;nc-fe-build --task=styles --watch&quot;,<br>    &quot;analyze&quot;: &quot;NODE_ENV=production node nc-fe-build --task=webpack&quot;,<br>    &quot;lint:css&quot;: &quot;stylelint \&quot;./**/*.scss\&quot;&quot;<br>  },<br>  &quot;dependencies&quot;: {<br>    &quot;@netcentric/fe-build&quot;: &quot;^3.0.2&quot;,<br>    &quot;npm-run-all&quot;: &quot;^4.1.5&quot;<br>  },<br>  &quot;devDependencies&quot;: {<br>    &quot;stylelint-config-prettier&quot;: &quot;^9.0.3&quot;,<br>    &quot;stylelint-config-standard&quot;: &quot;^26.0.0&quot;,<br>    &quot;stylelint-config-standard-scss&quot;: &quot;^4.0.0&quot;<br>  }<br>}</pre><p><strong>3. Configuration Files:</strong></p><p>Create and set up the necessary configuration files:</p><ul><li>.eslintrc for ESLint configuration</li><li>.stylelintrc for StyleLint configuration</li><li>.prettierrc for Prettier configuration</li></ul><p><strong>4. Folder Structure:</strong> <br>Create a folder structure similar to the following:</p><pre>.<br>└── ui.frontend/<br>    └── src/<br>        └── main/<br>            └── aem-vue/<br>                ├── clientlibs/<br>                │   └── clientlib-app/<br>                │       └── app.source.js<br>                ├── components/<br>                └── .febuild</pre><p><strong>5. .febuild Configuration:</strong> <br>Create a .febuild file with a configuration similar to the one mentioned in the link you provided.</p><pre>const path = require(&#39;path&#39;);<br>const sourcesPath = path.dirname(__filename);<br>const cwd = process.cwd();<br>const destinationPath = sourcesPath.replace(&#39;ui.frontend/src/main&#39;, &#39;ui.apps/src/main/content/jcr_root/apps&#39;);<br><br>const nodeModules = path.join(cwd, &#39;node_modules&#39;);<br>const styles = path.join(sourcesPath, &#39;theme&#39;);<br>const includePaths = [nodeModules, styles];<br><br>module.exports = {<br>    general: {<br>       projectKey: &quot;apps&quot;,<br>       sourceKey: &quot;source&quot;,<br>       bundleKey: &quot;bundle&quot;,<br>       sourcesPath: sourcesPath,<br>       destinationPath: destinationPath<br>    },<br>    optimization: {<br>        minimize: true,<br>        runtimeChunk: {<br>            name: &#39;clientlibs/clientlib-header/js/treeshaking.bundle.js&#39;<br>        }<br>    },<br>    sass: {<br>        includePaths: includePaths,<br>        outputStyle: &#39;compressed&#39;<br>    }<br>}</pre><p>The meaning and other customizations are referenced here: <a href="https://github.com/Netcentric/fe-build/blob/main/docs/configuration.md">https://github.com/Netcentric/fe-build/blob/main/docs/configuration.md</a>,</p><p><strong>6. app.source.js:</strong> <br>Now create our app initialization. In the app.source.js file, include your app initialization code.</p><pre>const {createApp} = Vue;<br><br>// Create the Vue app<br>const app = createApp({<br>    components: {<br><br>    }<br>});<br><br>// Mount the app to the element with the ID &quot;app&quot;<br>app.mount(&#39;#app&#39;);</pre><p>Now open your terminal and run the following commands</p><pre>npm i<br>npm run build</pre><p><strong>7. Clientlib Setup:</strong> <br>When the build is complete, a clientlib named clientlib-app will be generated. In that clientlib:</p><ul><li>A folder will be created and named with clientlib-appAnd a treeshaking.bundle.js file will be there.</li><li>Create thisclientlib-app folder as AEM clientlib and add Vue libraries:</li><li><strong>Vue</strong>: https://unpkg.com/vue@3.3.4/dist/vue.global.prod.js</li><li><strong>Vuex</strong>: https://unpkg.com/vuex@4.0.0/dist/vuex.global.prod.js</li></ul><p><strong>8. Page.html Customization:</strong> <br>Overwrite the page.html in the page component by adding an ID to the &lt;body&gt; tag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*knnlKizX0T69StmVqXanPg.png" /></figure><p><strong>9. Install AEM Project:<br></strong>Now install the AEM application. Open any page and in the console type Vue.You will see Vue is initiated.</p><blockquote><strong>You will get these changes in this git commit:</strong> <a href="https://github.com/SadyRifat/aem-vue/commit/d843cb2b93d112219c3f76fc5dce5f65e24e4576">https://github.com/SadyRifat/aem-vue/commit/d843cb2b93d112219c3f76fc5dce5f65e24e4576</a></blockquote><blockquote><strong>Github Repo:</strong> <a href="https://github.com/SadyRifat/aem-vue">https://github.com/SadyRifat/aem-vue</a></blockquote><blockquote><strong>Follow my next Article: </strong><a href="https://medium.com/@sadyrifat/seamless-integration-of-vue-js-in-aem-project-a-step-by-step-guide-for-aem-developers-5872a7ba343">Part 3: Create a Component</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=527f8575f9c2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Seamless Integration of Vue.js in AEM Project: A Step-by-Step Guide for AEM Developers — Part 1]]></title>
            <link>https://sadyrifat.medium.com/seamless-integration-of-vue-js-in-aem-project-a-step-by-step-guide-for-aem-developers-f6f4ce3dfee7?source=rss-9d815c86cc87------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6f4ce3dfee7</guid>
            <category><![CDATA[setup]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[vue-3]]></category>
            <category><![CDATA[aem]]></category>
            <dc:creator><![CDATA[Sady Rifat]]></dc:creator>
            <pubDate>Wed, 23 Aug 2023 11:49:13 GMT</pubDate>
            <atom:updated>2023-08-30T10:17:39.782Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 1: Overview</h3><figure><img alt="AEM with VueJs" src="https://cdn-images-1.medium.com/max/1024/1*vZdKRZ6_AzslrycOkB4UkQ.jpeg" /><figcaption>AEM with VueJs</figcaption></figure><p>In the rapidly evolving landscape of web development, technologies like <strong><em>AngularJS</em></strong> and <strong><em>jQuery</em></strong> have become outdated, urging the industry to transition towards more modern stacks. While AEM officially supports Single Page Applications (SPAs) using <strong>React</strong> and <strong>Angular</strong>, the question arises: What about projects that don’t follow the SPA paradigm? This is where the need to leverage the capabilities of HTL (Sightly) comes into play.</p><p>Enter <strong>VueJS</strong>, a cutting-edge framework that offers the best of both worlds. By seamlessly integrating VueJS into AEM projects, developers can harness the power of a modern, robust framework while continuing to benefit from the efficiency of HTL. This article serves as a comprehensive guide, demonstrating how VueJS can be integrated effectively by a <strong>non-SPA</strong> approach within AEM projects.</p><h3>Architecture Overview:</h3><ul><li>Utilizing the <strong>latest AEM archetype</strong> (version 43) as the foundation.</li><li>Employing a separate <strong>UI build</strong> to ensure modularity and maintainability.</li><li><strong>Vue 3 CDN Context API</strong> facilitates efficient data sharing between components, enhancing the project’s scalability and flexibility.</li><li>Implementing<strong> VueX</strong> for robust state management within the Vue.js application.</li></ul><h3>Component Flow:</h3><figure><img alt="component flow" src="https://cdn-images-1.medium.com/max/873/1*cIBkYghG84rgwq916-w8yg.jpeg" /><figcaption>Component Flow Diagram</figcaption></figure><h3>Starting:</h3><p>Before delving into the code implementation, let’s begin by creating a project.</p><blockquote>My Environment:</blockquote><ul><li>Java 11</li><li>Maven 3.8</li><li>AEM SP version 6.5.14</li><li>Node version 18.13.0</li><li>Ubuntu 20.04</li></ul><blockquote>Project Create:</blockquote><pre>mvn -B org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate \<br>    -D archetypeGroupId=com.adobe.aem \<br>    -D archetypeArtifactId=aem-project-archetype \<br>    -D archetypeVersion=43 \<br>    -D appTitle=&quot;AEM Vue&quot; \<br>    -D appId=&quot;aem-vue&quot; \<br>    -D groupId=&quot;com.aem.vue&quot; \<br>    -D artifactId=&quot;aem-vue&quot; \<br>    -D package=&quot;com.aem.vue&quot; \<br>    -D version=&quot;0.0.1-SNAPSHOT&quot; \<br>    -D aemVersion=&quot;6.5.14&quot;</pre><p><em>Change the uber-jar version to 6.5.13 since it&#39;s not present in the Maven repo.</em></p><p>After executing this command in your project directory, a project named “<strong>aem-vue</strong>” will be generated. Proceed to open it using your preferred IDE. In my case, I’ll be using IntelliJ.</p><blockquote><strong>You will get these changes in this git commit:</strong> <a href="https://github.com/SadyRifat/aem-vue/commit/3d745c896ead8ec9a267ce575519450c18a3d2aa">https://github.com/SadyRifat/aem-vue/commit/3d745c896ead8ec9a267ce575519450c18a3d2aa</a></blockquote><blockquote><strong>Github Repo:</strong> <a href="https://github.com/SadyRifat/aem-vue">https://github.com/SadyRifat/aem-vue</a></blockquote><blockquote><strong>Follow my next Article: </strong><a href="https://sadyrifat.medium.com/seamless-integration-of-vue-js-in-aem-project-a-step-by-step-guide-for-aem-developers-527f8575f9c2">Part 2: VUE 3 Setup</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6f4ce3dfee7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Show/Hide AEM CQ Dialog Fields Based on Select Field Selection: A Comprehensive Guide]]></title>
            <link>https://sadyrifat.medium.com/show-hide-aem-cq-dialog-fields-based-on-select-field-selection-a-comprehensive-guide-bee591abd24c?source=rss-9d815c86cc87------2</link>
            <guid isPermaLink="false">https://medium.com/p/bee591abd24c</guid>
            <category><![CDATA[select-show-hide]]></category>
            <category><![CDATA[coral-3]]></category>
            <category><![CDATA[dropdown-show-hide]]></category>
            <category><![CDATA[aem]]></category>
            <category><![CDATA[multiselect]]></category>
            <dc:creator><![CDATA[Sady Rifat]]></dc:creator>
            <pubDate>Sun, 30 Jul 2023 17:08:02 GMT</pubDate>
            <atom:updated>2023-07-31T06:57:43.091Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="AEM Dialog Dropdown Show Hide" src="https://cdn-images-1.medium.com/max/600/1*eqfuUffOyKB1prs0qFLZ3g.png" /></figure><p>In AEM, the CQ Dialog’s Select field is quite common. It is often necessary to show/hide other dialog content based on the selected value in the Select field. While there are some Out-of-the-Box (OOTB) and custom solutions available for this functionality, they come with certain limitations. This article aims to address those limitations and cover the following scenarios:</p><ul><li>Showing/hiding content based on the Select field.</li><li>Showing/hiding content under a <strong>multifield </strong>based on the Select field.</li><li>Showing/hiding content based on <strong>multi-select</strong> values in the Select field.</li><li>Showing/hiding content under a <strong>multifield based on multi-select</strong> values in the Select field.</li></ul><p><strong>Extra Features:</strong></p><ul><li>Single Content can show/hide for multiple options.</li></ul><figure><img alt="AEM dialog multiselect show hide" src="https://cdn-images-1.medium.com/max/702/1*7vY2smdc0cttSIZCPdZqow.gif" /></figure><figure><img alt="AEM dialog multifield show hide" src="https://cdn-images-1.medium.com/max/699/1*Jwmht8nMwzBtlnzAEHOUYQ.gif" /></figure><p>To achieve this, we will start by creating a custom clientlib named “dropdown-showhide.” Follow these steps to create the clientlib:</p><ul><li>Create a new folder named “dropdown-showhide.”</li><li>Within the folder, add the following files: <br>- js.txt<br>- .content.xml<br>- showhide.js</li><li>Now, let’s add the necessary content to these files. In the “<strong>js.txt</strong>” file,</li></ul><pre>showhide.js</pre><ul><li>In the “<strong>.content.xml</strong>” file, define the clientlib properties and dependencies. This ensures that the necessary JavaScript is loaded correctly.</li></ul><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;jcr:root xmlns:cq=&quot;http://www.day.com/jcr/cq/1.0&quot; xmlns:jcr=&quot;http://www.jcp.org/jcr/1.0&quot;<br>          jcr:primaryType=&quot;cq:ClientLibraryFolder&quot;<br>          categories=&quot;[cq.authoring.dialog]&quot;<br>          allowProxy=&quot;{Boolean}true&quot;/&gt;</pre><p>You have the flexibility to customize the category names as per your requirements. In such cases, you will need to include this clientlib in the dialog by adding the “extraClientlibs” property. To ensure its availability throughout the entire project, we will attach it to the global clientlib.</p><ul><li>And finally in “<strong>showhide.js</strong>” file add the following JS code,</li></ul><pre>(function (document, $) {<br>    &quot;use strict&quot;;<br><br>    $(document).on(&quot;foundation-contentloaded&quot;, function (e) {<br>        Coral.commons.ready(function () {<br>            showHideHandler($(&quot;.cq-dialog-dropdown-showhide&quot;, e.target));<br>        });<br>    });<br><br>    $(document).on(&quot;change&quot;, &quot;.cq-dialog-dropdown-showhide&quot;, function () {<br>        if ($(this).closest(&#39;.coral3-Multifield&#39;).length &gt; 0) {<br>            showHideHandler($(this));<br>        }<br>    });<br><br>    function showHideHandler(el) {<br>        el.each(function (i, element) {<br>            if ($(element).is(&quot;coral-select&quot;)) {<br>                Coral.commons.ready(element, function (component) {<br>                    multiSelectShowHide(element);<br>                    component.on(&quot;change&quot;, function () {<br>                        multiSelectShowHide(element);<br>                    });<br>                });<br>            }<br>        });<br>    }<br><br>    function multiSelectShowHide(element) {<br>        let target = $(element).data(&quot;cqDialogDropdownShowhideTarget&quot;);<br>        let $target = $(target);<br>        if (target) {<br>            $target.each(function () {<br>                $(this).not(&quot;.hide&quot;).addClass(&quot;hide&quot;);<br>                let filteredElement = [];<br>                let targetValueList = $(this).data(&#39;showhidetargetvalue&#39;);<br>                if (typeof targetValueList !== &quot;undefined&quot;) {<br>                    targetValueList.replace(/ /g, &#39;&#39;).split(&#39;,&#39;).forEach((targetValue) =&gt; {<br>                        let idfSelect = $(this).attr(&quot;class&quot;).split(&#39; &#39;).filter((item) =&gt; item !== &quot;hide&quot;)<br>                        let selectedValues = $(this).parent().find(&quot;coral-select[data-cq-dialog-dropdown-showhide-target=&#39;.&quot; + idfSelect + &quot;&#39;]&quot;)[0].values;<br>                        if (selectedValues.includes(targetValue)) {<br>                            filteredElement.push($(this));<br>                        }<br>                    });<br>                    filteredElement.forEach(element =&gt; element.removeClass(&#39;hide&#39;));<br>                }<br>            });<br>        }<br>    }<br>})(document, Granite.$);</pre><h3>Demo Code &amp; Usages:</h3><p>To achieve the show/hide functionality based on your requirements, follow these steps:</p><p>1. Add the class “<strong>cq-dialog-dropdown-showhide</strong>” to the dropdown/select element. You can do this by using the attribute [ex: granite: class=”cq-dialog-dropdown-showhide”].</p><p>2. Include the data attribute “<strong>cq-dialog-dropdown-showhide-target</strong>” in the dropdown/select element. The value of this attribute should be a selector, typically a specific class name, used to identify all possible target elements that can be shown/hidden. <br><strong><em>For example:</em></strong> [ex: cq-dialog-dropdown-showhide-target=”.connect-layout-show-hide”].</p><p>3. Apply the target class to each component that can be shown/hidden. These components will be affected by the show/hide functionality.</p><p>4. Initially, set the class “hidden” on each target component. This will ensure that they are hidden when the page loads.</p><p>5. For each target component, add the attribute “<strong>showhidetargetvalue</strong>.” The value of this attribute should correspond to the value of the select <strong>[ex: showhidetargetvalue=”val1,val2&quot;]</strong> option that will cause this element to be unhidden.</p><p>By following these steps, you can implement the desired show/hide behavior based on the selected value in the dropdown/select element. If you encounter any bugs or find any use cases that were missed, please feel free to inform me. Your feedback is valuable, and I will be more than happy to address any issues to ensure smooth functionality.</p><p><strong>Regular Show/Hide:</strong></p><figure><img alt="AEM Dialog Select Show/Hide" src="https://cdn-images-1.medium.com/max/353/1*JVctKU2udbjHBaRSoFhU1w.gif" /></figure><pre>&lt;triggerType<br>        jcr:primaryType=&quot;nt:unstructured&quot;<br>        sling:resourceType=&quot;granite/ui/components/coral/foundation/form/select&quot;<br>        granite:class=&quot;cq-dialog-dropdown-showhide&quot;<br>        fieldLabel=&quot;Select Field&quot;<br>        name=&quot;./triggerType&quot;&gt;<br>    &lt;granite:data<br>            jcr:primaryType=&quot;nt:unstructured&quot;<br>            cq-dialog-dropdown-showhide-target=&quot;.connect-layout-show-hide&quot;/&gt;<br>    &lt;items jcr:primaryType=&quot;nt:unstructured&quot;&gt;<br>        &lt;dropdown1<br>                jcr:primaryType=&quot;nt:unstructured&quot;<br>                text=&quot;DropDown 1&quot;<br>                value=&quot;dropdown1&quot;/&gt;<br>        &lt;dropdown2<br>                jcr:primaryType=&quot;nt:unstructured&quot;<br>                text=&quot;DropDown 2&quot;<br>                value=&quot;dropdown2&quot;/&gt;<br>        &lt;dropdown3<br>                jcr:primaryType=&quot;nt:unstructured&quot;<br>                text=&quot;DropDown 3&quot;<br>                value=&quot;dropdown3&quot;/&gt;<br>    &lt;/items&gt;<br>&lt;/triggerType&gt;<br>&lt;target-one-container<br>        jcr:primaryType=&quot;nt:unstructured&quot;<br>        sling:resourceType=&quot;granite/ui/components/coral/foundation/container&quot;<br>        granite:class=&quot;hide connect-layout-show-hide&quot;&gt;<br>    &lt;granite:data<br>            jcr:primaryType=&quot;nt:unstructured&quot;<br>            showhidetargetvalue=&quot;dropdown1&quot;/&gt;<br>    &lt;items jcr:primaryType=&quot;nt:unstructured&quot;&gt;<br>        &lt;targetOne<br>                sling:resourceType=&quot;granite/ui/components/coral/foundation/form/textfield&quot;<br>                fieldLabel=&quot;Target One&quot;<br>                jcr:primaryType=&quot;nt:unstructured&quot;<br>                name=&quot;./targetOne&quot;/&gt;<br>    &lt;/items&gt;<br>&lt;/target-one-container&gt;<br>&lt;target-two-container<br>        jcr:primaryType=&quot;nt:unstructured&quot;<br>        sling:resourceType=&quot;granite/ui/components/coral/foundation/container&quot;<br>        granite:class=&quot;hide connect-layout-show-hide&quot;&gt;<br>    &lt;granite:data<br>            jcr:primaryType=&quot;nt:unstructured&quot;<br>            showhidetargetvalue=&quot;dropdown2&quot;/&gt;<br>    &lt;items jcr:primaryType=&quot;nt:unstructured&quot;&gt;<br>        &lt;targetTwo<br>                sling:resourceType=&quot;granite/ui/components/coral/foundation/form/numberfield&quot;<br>                fieldLabel=&quot;Target Two&quot;<br>                jcr:primaryType=&quot;nt:unstructured&quot;<br>                name=&quot;./targetTwo&quot;/&gt;<br>    &lt;/items&gt;<br>&lt;/target-two-container&gt;</pre><p><strong>Multiselect:</strong></p><figure><img alt="AEM Dialog multiselect show hide" src="https://cdn-images-1.medium.com/max/349/1*VXnaDNBpBCbOi-8PkJYFXg.gif" /></figure><pre>&lt;triggerType<br>        jcr:primaryType=&quot;nt:unstructured&quot;<br>        sling:resourceType=&quot;granite/ui/components/coral/foundation/form/select&quot;<br>        granite:class=&quot;cq-dialog-dropdown-showhide&quot;<br>        fieldLabel=&quot;Select Field&quot;<br>        multiple=&quot;{Boolean}true&quot;<br>        name=&quot;./triggerType&quot;&gt;<br>    &lt;granite:data<br>            jcr:primaryType=&quot;nt:unstructured&quot;<br>            cq-dialog-dropdown-showhide-target=&quot;.connect-layout-show-hide&quot;/&gt;<br>    &lt;items jcr:primaryType=&quot;nt:unstructured&quot;&gt;<br>        &lt;dropdown1<br>                jcr:primaryType=&quot;nt:unstructured&quot;<br>                text=&quot;DropDown 1&quot;<br>                value=&quot;dropdown1&quot;/&gt;<br>        &lt;dropdown2<br>                jcr:primaryType=&quot;nt:unstructured&quot;<br>                text=&quot;DropDown 2&quot;<br>                value=&quot;dropdown2&quot;/&gt;<br>        &lt;dropdown3<br>                jcr:primaryType=&quot;nt:unstructured&quot;<br>                text=&quot;DropDown 3&quot;<br>                value=&quot;dropdown3&quot;/&gt;<br>    &lt;/items&gt;<br>&lt;/triggerType&gt;<br>&lt;target-one-container<br>        jcr:primaryType=&quot;nt:unstructured&quot;<br>        sling:resourceType=&quot;granite/ui/components/coral/foundation/container&quot;<br>        granite:class=&quot;hide connect-layout-show-hide&quot;&gt;<br>    &lt;granite:data<br>            jcr:primaryType=&quot;nt:unstructured&quot;<br>            showhidetargetvalue=&quot;dropdown1&quot;/&gt;<br>    &lt;items jcr:primaryType=&quot;nt:unstructured&quot;&gt;<br>        &lt;targetOne<br>                sling:resourceType=&quot;granite/ui/components/coral/foundation/form/textfield&quot;<br>                fieldLabel=&quot;Target One&quot;<br>                jcr:primaryType=&quot;nt:unstructured&quot;<br>                name=&quot;./targetOne&quot;/&gt;<br>    &lt;/items&gt;<br>&lt;/target-one-container&gt;<br>&lt;target-two-container<br>        jcr:primaryType=&quot;nt:unstructured&quot;<br>        sling:resourceType=&quot;granite/ui/components/coral/foundation/container&quot;<br>        granite:class=&quot;hide connect-layout-show-hide&quot;&gt;<br>    &lt;granite:data<br>            jcr:primaryType=&quot;nt:unstructured&quot;<br>            showhidetargetvalue=&quot;dropdown1,dropdown2&quot;/&gt;<br>    &lt;items jcr:primaryType=&quot;nt:unstructured&quot;&gt;<br>        &lt;targetTwo<br>                sling:resourceType=&quot;granite/ui/components/coral/foundation/form/numberfield&quot;<br>                fieldLabel=&quot;Target One or Two&quot;<br>                jcr:primaryType=&quot;nt:unstructured&quot;<br>                name=&quot;./targetTwo&quot;/&gt;<br>    &lt;/items&gt;<br>&lt;/target-two-container&gt;</pre><p>After summarizing the steps mentioned above, you now have a clientlib capable of showing/hiding conditional content as per your requirements. If, however, you come across any bugs or identify any missed use cases, please do not hesitate to inform me. Your feedback is valuable, and I’ll be glad to address any issues to ensure the functionality works seamlessly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bee591abd24c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AEM Unit Test Case for Sling Delegation Pattern]]></title>
            <link>https://sadyrifat.medium.com/aem-unit-test-case-for-sling-delegation-pattern-1f011b947fb3?source=rss-9d815c86cc87------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f011b947fb3</guid>
            <category><![CDATA[sling-delegation]]></category>
            <category><![CDATA[aem]]></category>
            <category><![CDATA[unit-testing]]></category>
            <category><![CDATA[sling-model]]></category>
            <dc:creator><![CDATA[Sady Rifat]]></dc:creator>
            <pubDate>Fri, 12 May 2023 07:15:15 GMT</pubDate>
            <atom:updated>2023-05-12T07:15:15.748Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RdZB8hkVWdTv9YHQYH79YQ.png" /></figure><p>In Adobe Experience Manager (AEM), a Sling Model is a Java class representing a resource in the AEM content repository. Sling Models provide a convenient way to map properties of a resource to fields or methods in the Java class, allowing you to easily access and manipulate the content of the help.</p><p>We can use the JUnit framework to write a unit test for a Sling Model class in AEM. In this article, I am going to describe the way to write the Sling model class, especially for the Sling Delegation Pattern.</p><h3>Step 1:</h3><p>Add the necessary dependencies, annotate with AemContextExtension, and create AemContext.</p><pre>AemContextExtension.@ExtendWith({AemContextExtension.class, MockitoExtension.class})<br>class MyCmpImplTest{<br>    private final AemContext context = new AemContextBuilder(ResourceResolverType.JCR_MOCK).plugin(CORE_COMPONENTS).build();<br>}</pre><h3>Step 2:</h3><ul><li>Create a component JSON and load via <strong>context.load()</strong></li><li>Attach this resource with the <strong>context current resource</strong></li><li>Then adapt to your class with <strong>context.request()</strong></li></ul><h3>Step 3:</h3><p>Write your unit test.</p><h3>Reality:</h3><p>Following these theoretical steps and writing unit tests for Sling Delegation Pattern is not that simple. Yes, it&#39;s not that much difficult or complex, we just need to follow some tricks to make it simple.<br>To make it easier for developers I am giving some examples for easy understanding.</p><h3>Code Example:</h3><p><strong>Breadcrumb Component:</strong></p><p><strong>First</strong>, create your own class to extend the core functionality.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c1a50a09a68fbba3dc9888587c778471/href">https://medium.com/media/c1a50a09a68fbba3dc9888587c778471/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e89e37b83c3fe832820b1e05af9ef02/href">https://medium.com/media/3e89e37b83c3fe832820b1e05af9ef02/href</a></iframe><p><strong>Second</strong>, Write unit tests for the implemented model class</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/27918a7373b12f95bc05dcfdf3500949/href">https://medium.com/media/27918a7373b12f95bc05dcfdf3500949/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/239c3ff67e5481233d09f7326d12a701/href">https://medium.com/media/239c3ff67e5481233d09f7326d12a701/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba343e2624baa136b7f5453c5d772c82/href">https://medium.com/media/ba343e2624baa136b7f5453c5d772c82/href</a></iframe><p>Seems, do I give a simple example? Now let’s make it complicated. Take another component and customized where multifield and list exist.</p><p><strong>Language Navigation Component:</strong></p><p>Let’s take the <strong>Language Navigation</strong> component. My custom implementation will be will filter the core list(exclude path).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/38925581b8a77efd3d4cc4ca023f7cda/href">https://medium.com/media/38925581b8a77efd3d4cc4ca023f7cda/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5974d2b6ec94c44bf852e2e4e1e1fcf6/href">https://medium.com/media/5974d2b6ec94c44bf852e2e4e1e1fcf6/href</a></iframe><h3>Now Write Unit Test</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bbf26a5f1bf6daeec1f46a66c5232249/href">https://medium.com/media/bbf26a5f1bf6daeec1f46a66c5232249/href</a></iframe><p>Another Json file page.json (<a href="https://gist.githubusercontent.com/SadyRifat/5f11a7b58a801e1957b151e209926df9/raw/97f6510e48964f500f004224f2c25f62c34f1e77/page.json">https://gist.githubusercontent.com/SadyRifat/5f11a7b58a801e1957b151e209926df9/raw/97f6510e48964f500f004224f2c25f62c34f1e77/page.json</a>)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/66126eb0bc68adfe9f001bff482c8899/href">https://medium.com/media/66126eb0bc68adfe9f001bff482c8899/href</a></iframe><p><strong>Note:</strong> <em>Writing unit test of model class the most difficult part is providing the proper json/resource. Once it is setup other things are very easy and smooth going.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f011b947fb3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AEM Authoring Dialog Component]]></title>
            <link>https://sadyrifat.medium.com/aem-authoring-dialog-component-a859d665235?source=rss-9d815c86cc87------2</link>
            <guid isPermaLink="false">https://medium.com/p/a859d665235</guid>
            <category><![CDATA[aem-dialog]]></category>
            <category><![CDATA[aem-developer]]></category>
            <category><![CDATA[aem]]></category>
            <dc:creator><![CDATA[Sady Rifat]]></dc:creator>
            <pubDate>Mon, 30 Nov 2020 10:04:14 GMT</pubDate>
            <atom:updated>2020-11-30T10:07:06.867Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*uO7OMxKTcIo4-q3l.png" /></figure><p>Basically, AEM authoring dialog components have two different versions. Authoring dialog components under <strong>/libs/granite/ui/components/foundation</strong> are based on Coral 2 and components under <strong>/libs/granite/ui/components/coral/foundation</strong> are based on Coral 3. So it prefers using the Coral 3 components.</p><p>If it’s confusing which one is suitable then there is a <strong>demo.xml</strong> where all types are there for visualization.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/14f9734615eaf8eb8abc3ca1ae44b1e8/href">https://medium.com/media/14f9734615eaf8eb8abc3ca1ae44b1e8/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a859d665235" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>