8/01/2020

AEM - Sling Models

Day # 1
AEM - Sling Models

In AEM Component development Sling Models concept has brought up a revolutionary change and it eases the component development.

Sling Models - Is Plain Old Java Objects (POJO) or a Model Class.
Business Use Case For Sling Model:

Develop a Custom Component where the Author can configure or Author Some content in a Dialog, the same content will be saved to JCR Nodes (Repository), based on the Business requirement, the authored content will be presented to Client in HTML page (using HTL and Sling Models)

The traditional use case for a Sling Model to provide a Business abstraction for a RESOURCE or a REQUEST , which provides the HTL scripts and interface for accessing the business function.

Common patterns for developing a sling model that represents an AEM component in pages using sling model object to create HTL scripts with data and END result of HTML that displayed on the browser.

Information flow in a Sling Model that starts with the HTTP Get Request to a RESOURCE in AEM , based on the Request, requested resources, sling:resourceType
appropriate script is selected.

Then the script is ADAPTS the REQUEST or RESOURCE to the desired SLING Model, the script use the Sling Model Object to generate the HTML rendition
The HTML generated by the HTL script is return in the HTTP Response.

Day # 2

Sling Models:
What we can do with the Sling Models or What Sling Models do in AEM Page development

1) Sling Models is a Frame work for component development or Simply for development
2) Sling Models allows you to use annotation driven Plain Old Java Objects (POJO s)
3) They are adaptable to multiple objects, including Resource and SlingServletRequest
4) Annotations in Sling Models will handle the Inputs
5) Out of the box (OOB), Sling Models work with
    - Sling Bindings
    - OSGi Services
    - Request Attributes

Best Practices in Sling Models

No comments:

Post a Comment