Thursday 25 October 2018

Modern AEM Component Implementation Patterns

AEM Core Components follow modern implementation patterns. There are two types of component patterns in AEM, General Component Pattern & Reusable Component Pattern




 1. General Component Patterns
 This set of patterns are recommended for any type of components(regardless whether the component is specific to a single project, or reused across multiple sites or projects).

 a. Configurable Components
 There are cases where we have a requirement of components which are having variation of similar elements. In such cases, it is recommended to have configurable components having dialogs with various options instead of creating multiple components.

 b. Separation of Concerns
 This patterns recommends the usage of separation of logic from markup.

 - HTL can be used for markup which is more secure.
 - SlingModels are the recommended option for Logic implementation 

2. Reusable Component Patterns
 These patterns are used for any kind of component, which are most suitable for components that are intended to be reused across multiple sites or projects(For eg. Core Components)

 a. Pre-Configurable Capabilities
 It is recommended to define the components/templates flexible as much as possible. Some examples could be using edit dialog (For Page authors), Design Dialog (For Template authors) and all these options are availabe under 'Policies' as part of editable templates.

 b. Proxy Component Pattern
 Here component inheritance is used as a proxy. Create second level components by referring the resourceSuperType property from core components.
Which offers more flexibility and avoid content refactoring if one site needs a different behavior for a component.

 c. Component Versioning
 Always introduce component versioning by adding a number in their resource type path, and in the fully qualified Java class names of their implementations, which will help keeping the components compatible over time. Useful when upgrade happens.

 d. Model Interfaces
 This pattern recommends the usage of  HTL's data-sly-use instruction to point to a Java interface, while the Sling Model implementation is also registering itself to the resource type of the component.

When there is a requirement to redefine the implementation of a Sling Model or  HTL markup of a component, this avoids complexity. Because they are loosely coupled.

Read More

Modern AEM Component Implementation Patterns

AEM Core Components

Proxy Components in AEM 6.4



Below video gives an overview of AEM Component Patterns

Proxy Components in AEM 6.4

What are proxy components?

Proxy Components are site-specific components which are inherited from core components, which define the desired component name and group to display for page authoring.
  • Proxy Components refer to a Core Component as their super-type.
  • Proxy Components follow the path  : /apps/my-site/components (Where core components path : core/wcm/components)
These site-specific components are called proxy components, for the reason they don't need to contain anything; they just serve mostly to define the version of a component to use for the site. Infact, when customizing the Core Components, these proxy components play an essential role for markup and logic customization.
[Click on image to see it big]

Advantages of creating Proxy Components
  • Proxy components helps categorization of components in a reusable way.
  • Better seggregation: It is a good practice to have 'sling:resourceType' property pointing to site-specific components, instead of pointing to components that are shared by multiple sites.
  • This provide more flexibility and avoid content refactoring if one site needs a different behavior for a component.
  • Customization can then be achieved on the site-specific component and won't affect the other sites.
  • Proxy components can be entirely empty if they fully inherit the functionality, or they can redefine some aspects of the component.
 Read More

Modern AEM Component Implementation Patterns

AEM Core Components

Proxy Components in AEM 6.4


See below video to understand more about Proxy Components. 

AEM Core Components

 AEM Core components are available from AEM 6.2. AEM 6.3 onwards Core Components were getting more stabilized. Now we have AEM 6.4 which has the more advanced Core components.



  Core Components were introduced to provide robust and extensible base components, built on the latest technology and best practices, and adhering to accessibility guidelines.

 Core Components leverage the latest technology to enable the creation of flexible, extensible, and feature-rich components to enable authors to easily create content.

 AEM Core components are with HTML Template Language, or HTL, Touch UI dialogs and Sling Models, Secure, robust, version-able

 There are 16 Core Components in AEM 6.4 at present (This count keep getting increased based on developer contrbutions in GitHub), which can be divided into two categories .

 Page authorable components

-Breadcrumb
-Content Fragment
-List
-Navigation
-Page
-Quick Search
-Social Media Sharing
-Text
-Title
-Language Navigation
-Image

Form specific core components
-Form Hidden
-Form Options
-Form Text
-Form Button
-Form Container

When to Use the Core Components?

New Projects - New projects should always attempt to use Core Components.

Existing Projects - Recommendation is keep using the foundation components, unless a site or component refactoring is planned.

New Custom Components - Assess if an existing Core Component may be customized. If not, recommendation is to build a new custom component following the Component Guidelines.

Existing Custom Components - If your components work as expected, then keep them as they are.
If not, refer to "New Custom Components" above.

Foundation Component Support
Since the foundation components have served as a basis of so much project development over many versions, they will continue to be supported into the foreseeable future.

However, Adobe's development emphasis has shifted to the core components and new features will be added to them whereas only bug fixes will be made to the foundation components

Core Components Advantages
  • 100% written in HTL.
  • Apache 2.0 License.
  • Allow versioning of components.
  • GitHub
  • latest features are supported, plus backward compatibility is also available.
  • Unit test coverage > 80%

Steps to create a sample core components:
  • Download and Install
  • Create Proxy Components
  • Load the Core Styles
  • Enable the Components
Read More

Modern AEM Component Implementation Patterns

AEM Core Components

Proxy Components in AEM 6.4



See below video to understand more about creation of Core Components. 



See below video of Core Components walk-through. 

Wednesday 19 September 2018

Content Approval workflows in AEM 6.4

I have given a step by step demo of content approval process in AEM 6.4 in the video. Here I will explains the steps involved in detail.

[Click on images to see them big]



There are 3 major steps involved in AEM content approval,
  1. Creating a simple workflow model
  2. Creating a content approval workflow based on the model created
  3. Verify the workflow
User Creation

Before we start, we need a set of users to understand our Workflow process. For this , we will create 3 users called author, editor, legal.

Go to tools> Security > Users and create 3 users author, editor, legal. This is quite simple and direct step.

Steps for workflow creation

1) Creating a simple workflow model

- Go to Tools, Workflow, Models

- Select 'Create', then 'Create Model'.

- Then Add Workflow Model dialog appears. Enter the Title and Name, then select Done.

Newly created model is listed in the Workflow Models console.

- Select your new workflow, then click on Edit to open it for modification:

The new workflow will contain:
  • Flow Start
  • Step 1
  • Flow End
- Delete Step 1

- From the Workflow selection of the steps browser, drag a Participant Step onto the workflow and position it between Flow Start and Flow End.

- Open the properties by clicking on configure option

- In the Common tab enter Validate Content - for both the Title and Description.

- Open the User/Group tab:

- Select Editor for the User/Group field.

- Confirm the updates by selecting the tick mark.

- Drag an Or Split onto the workflow and position it between Validate Content and Flow End.

- Open the Or Split for configuration.

Configure:
  • Common: select 2 Branches
  • Branch 1: select Default Route. - This option will be selected by default when the user reviews the content.
  • Branch 2: ensure Default Route is not selected.
  • Confirm your updates to the OR Split.
- Drag a Participant Step to the left hand branch, open the properties, specify the following values, then confirm the changes:

Title: Reject Publish Request
User/Group: Author - (Editor will reject the publish and notify the author).

Now,

- Drag a Participant Step to the right hand branch,
- In the properties section, specify the following values, then confirm the changes:

Title: Approve for Legal review
User/Group: legal - (If editor is fine with the content, he asks the legal person to review for legal adherence).

- Drag an Or Split onto the workflow and position it between Validate Content and Flow End.

- Open the Or Split and make configurations as below.
  • Common: select 2 Branches
  • Branch 1: select Default Route.
  • Branch 2: ensure Default Route is not selected.
  • Confirm your updates to the OR Split.
- Drag a Participant Step to the left-hand branch, open the properties, specify the following values, then confirm the changes:

Title: Reject Publish Request
User/Group: Author - We will reject the publish and notify the author.

- Drag a Participant Step to the right-hand branch, open the properties, specify the following values, then confirm the changes:

Title: Publish Page as Requested
Process: select Activate Page. This process publishes the selected page to the publisher instances.

Now the workflow model looks like this.




Note: Remember to sync the workflow so that the latest changes will be always updated in run time.

2) Creating a content approval workflow based on the model created

- Now login as user 'author'

We have two options to trigger the content approval workflow.

a) Go to workflow model (http://localhost:(port)/libs/cq/workflow/admin/console/content/models.html) select, click on start workflow and specify the payload.

b) Go to sites> a project specific page. Select the page and click on 'Create workflow' from top left menu. Then in new window select the workflow model and provide a title. In next window click on 'create' so that the workflow will start.

3) Verify the workflow

- Now login as user 'editor' and go to inbox and open the message and complete the workflow. Editor will have options Approve for Legal review , Reject Publish Request

 Now the workflow will be moved to legal person as per our workflow model definition,

- Login as legal, and from inbox he will have options like 'Reject Publish Request', 'Publish Page as Requested'. Complete the review and approve it. So that the page gets activated.

If any of the editor or legal person rejects, the payload goes back to author and asks for re-verification.

Below given a video recording of the above mentioned activity. Let me know if you face any issues through the comments section.

        

Thursday 23 August 2018

AEM 6.4 Assets - Walkthrough

Adobe Experience Manager Assets helps you to work with assets, like create, store, and deliver images, video, and other content for any screen or device.

AEM 6.4 has various asset operation on its touch UI.

Below given the image of assets UI.


Assets section has below options.

File:
File section helps to traverse to files and do various operation on an Asset

Collections:
A collection is a set of assets within Adobe Experience Manager (AEM) Assets. Collections are used  to share assets between users. A collection can include assets from different locations.

Collections can be shared with various users that are assigned different levels of privileges, including viewing, editing, and so on.

Lightbox: is a special type of collection that provides easy access to assets. We can quickly access Lightbox to add or delete assets. Every user has an exclusive Lightbox that is automatically created when the user logs in to Adobe Experience Manager (AEM) Assets.

Remember the Lightbox collection cannot be deleted.

Shared Links:

Adobe Experience Manager (AEM) Assets lets you share assets, folders, and collections as a URL with members of internal and external organizations, including partners and vendors. This makes a convenient way of making resources available to external parties without them having to first log in to AEM Assets.

Asset templates :

Adobe InDesign can be used to create and export brochures, flyers and print ads that speeds time to market while complying with brand guidelines and break digital and print silos with consistent messaging across channels leveraging AEM platform.

Catalogs:

Catalogs allows customers to leverage pre-designed InDesign templates to generate new catalogs straight from Experience Manager, target print channel, saving significant time and layout costs.

Jobs:
The Jobs page shows the progress of the asset upload. We can continue working in AEM and return to the Jobs page in Dynamic Media at any time to review an in-progress job.


AEM 6.4 Assets Supported Formats

Image Formats : PNG GIF TIFF JPEG BMP PNM PGM PBM PPM PSD EPS PICT PSB
Document:  DOC DOCX ODT PDF HTML RTF TXT XLS XLSX ODS PPT PPTX ODP INDD PS QXP EPUB Adobe Illustrator (AI)
Multimedia : AAC MIDI 3GP MP3 MPG OGA OGG RA WAV WMA DVI FLV M4V MPEG OGV MOV WMV SWF
Video : mp4 mov qt flv wmv mpg m4v f4v vob m2v mp2 avi webm ogv ogg mxf mts mkv r3d rm ram flac mj2
Archive : TGZ JAR RAR TAR ZIP
Other Supported Formats :SVG, CSS VTT XML Javascript




Video tutorial for AEM 6.4 assets:

 

Tuesday 21 August 2018

Sample components Creation in AEM 6.4


Steps to create a simple component in AEM 6.4 .

Under /apps, create a project folder(I have create 'myproj'), under which create a /components folder.

Under components, create folders /content and /structure as shown below.

Below shown the component structure in AEM 6.4.

[Click on any image to see it big & clear]

[Component structure in AEM 6.4]

Under structure create a node called 'header'., rename the header.jsp to header.html.

Add property 'componentGroup' : myGroup for the header node.

Copy pasted below html content in 'header.html'

    <div>    
        <li>         
            <p>This is a sample component</p>
            <h3>Header</h3>
            <p>This is a sample text in body pf component</p>           
        </li>
      </ul>
    </div>

Under header node, create a 'dialog' [primary type : cqDialog; xtype dialog]
Under dialog node, we will have 'items' [primary type: cq:Widget; xtype:tabPanel]
Under items, we will have 'items' node [primary type: cqWidegtCollection]
Under items, we will have  'tab1' node[primary type :cq:Panel; title: Tab 1]

The component is ready now.

Author this component on a page:
Since this is a new component, we need to make this component available for our template.
Add this component to our template created earlier by following below steps.

We had placed the component under 'myGroup'.
Now go to template policy section and modify the property to add the component as part of this template. Procedure is shown in below image.



[AEM 6.4 add policy]


Now as you see the new component is available for our template for authoring.


[New component]


Author the component on template and create a new page, so that the newly created component is visible now.


[New component authored n AEM 6.4.png]


Now activate the page (which includes template, component activation), so that the page will be visible in publish environment.

AEM 6.4 Tutorials Video Series
 

Create a page from the template in AEM 6.4



The page creation in AEM 6.4 is very much similar to other previous AEM versions.

I will be using 'we-retail' content location for my page creation to save time.

Go to site admin and reach the path '/content/we-retail/language-masters/en',(remember this is the content path where I had configured my template in my previous post).

 Click on new page and select the 'Html 5 template' we created as part of previous post as shown below and create page from it.

[Click on the image to see them big & clear]

[site creation AEM 6.4]

The new page looks like this.



[Page creation aem 6.4]

Next post we will demonstrate how to create AEM 6.4 sample components.

AEM 6.4 Tutorial Series