I am new to AEM, where can I start?
See: https://forums.adobe.com/thread/2452057
Can I use the Sling API to adapt a SlingHttpServletRequest?
Yes, you can use the Sling API to adapt from a SlingHttpServletRequest by using a method such as modelFactory.getModelFromWrappedRequest(). To see a code example of this - see:
https://helpx.adobe.com/experience-manager/kt/sites/using/getting-started-wknd-tutorial-develop/part6.html#styles-card-component.
I am new to AEM and OSGi
If you are new to AEM and OSGi - read this article -- https://helpx.adobe.com/experience-manager/using/osgi_getting_started.html
How to integrate AEM with Adobe Target Via Adobe Launch
See - https://helpx.adobe.com/experience-manager/using/aem_adobetarget_integration.html
How can I integrate AEM with Adobe Analytics?
See - https://helpx.adobe.com/experience-manager/using/aem_launch_adobeio_integration.html.
https://helpx.adobe.com/experience-manager/kt/sites/using/getting-started-wknd-tutorial-develop/part6.html#styles-card-component.
I am new to AEM and OSGi
If you are new to AEM and OSGi - read this article -- https://helpx.adobe.com/experience-manager/using/osgi_getting_started.html
How to integrate AEM with Adobe Target Via Adobe Launch
See - https://helpx.adobe.com/experience-manager/using/aem_adobetarget_integration.html
How can I integrate AEM with Adobe Analytics?
See - https://helpx.adobe.com/experience-manager/using/aem_launch_adobeio_integration.html.
Can I see a list of events in AEM
See - http://localhost:4502/system/console/events
I want to read the Binary property of a node?
You can use the JCR API to read the binary property of a node and retrieve a Java InputStream. For details, see this article:
https://helpx.adobe.com/experience-manager/using/modify_asset_workflow.html
Can I use the AssetManager API to dynamically delete Assets?
Yes, you can, In fact, you can define conditions for application logic to read values and then depending upon the value, you can use the Asset Manager's removeAsset() to delete the asset from the AEM DAM.
See - http://localhost:4502/system/console/events
I want to read the Binary property of a node?
You can use the JCR API to read the binary property of a node and retrieve a Java InputStream. For details, see this article:
https://helpx.adobe.com/experience-manager/using/modify_asset_workflow.html
Can I use the AssetManager API to dynamically delete Assets?
Yes, you can, In fact, you can define conditions for application logic to read values and then depending upon the value, you can use the Asset Manager's removeAsset() to delete the asset from the AEM DAM.
See this article as an example: https://helpx.adobe.com/experience-manager/using/move_asset_workflow.html
I want to update my AEM project to the latest version. Are there any recommendations?
See this topic -- https://helpx.adobe.com/experience-manager/6-4/sites/deploying/using/upgrading-code-and-customizations.html
I want to update my AEM project to the latest version. Are there any recommendations?
See this topic -- https://helpx.adobe.com/experience-manager/6-4/sites/deploying/using/upgrading-code-and-customizations.html
How can I add my own template type to Experience Fragments?
It is the cq:allowedTemplates property on /content/experience-fragments node that drives the availability of XF variations:
How can I use OSGi R6 Annotations to read OSGi configuration values?
We cover this use case in these two HELPX articles:
https://helpx.adobe.com/experience-manager/using/osgi_config63.html
https://helpx.adobe.com/experience-manager/using/aem_solr64.html
It is the cq:allowedTemplates property on /content/experience-fragments node that drives the availability of XF variations:
How can I use OSGi R6 Annotations to read OSGi configuration values?
We cover this use case in these two HELPX articles:
https://helpx.adobe.com/experience-manager/using/osgi_config63.html
https://helpx.adobe.com/experience-manager/using/aem_solr64.html
When I search using QueryBuilder, only 10 items are displayed.
BY default, QueryBuilder only returns 10 results
So add this parameter p.limit=-1 to fix that. For example--
BY default, QueryBuilder only returns 10 results
So add this parameter p.limit=-1 to fix that. For example--
//set QueryBuilder search criteria
map.put("type", "cq:Page");
map.put("path", "/content/we-retail");
map.put("p.limit", "-1");
I want to understand Dispatcher better
See this community content -- https://www.axamit.com/blog/adobe/dispatcher-1
How can I view all the Node Types in AEM?
See: http://localhost:4502/crx/explorer/nodetypes/index.jsp
What's the Difference between an Experience Fragment and a Content Fragment? See - https://helpx.adobe.com/experience-manager/kt/platform-repository/using/content-fragments-experience-fragments-article-understand.html
map.put("type", "cq:Page");
map.put("path", "/content/we-retail");
map.put("p.limit", "-1");
I want to understand Dispatcher better
See this community content -- https://www.axamit.com/blog/adobe/dispatcher-1
How can I view all the Node Types in AEM?
See: http://localhost:4502/crx/explorer/nodetypes/index.jsp
What's the Difference between an Experience Fragment and a Content Fragment? See - https://helpx.adobe.com/experience-manager/kt/platform-repository/using/content-fragments-experience-fragments-article-understand.html
Does AEM Support SPA?
See these resources:
Weekend SPA Tutorial - https://helpx.adobe.com/experience-manager/kt/sites/using/getting-started-spa-wknd-tutorial-develop/angular.html
Introduction with Demo: helpx.adobe.com/experience-manager/kt/sites/using/spa-editor-framework-feature-video-use.html
Some of the documentation we have for that:
https://helpx.adobe.com/experience-manager/kt/sites/using/getting-started-spa-wknd-tutorial-develop.html
SPA Editor Walkthrough: helpx.adobe.com/experience-manager/6-4/sites/developing/using/spa-walkthrough.html
Getting Started for Developers: helpx.adobe.com/experience-manager/6-4/sites/developing/using/spa-getting-started.html
SPA Editor Architecture: helpx.adobe.com/experience-manager/6-4/sites/developing/using/spa-architecture.html
SPA Editor Overview: helpx.adobe.com/experience-manager/6-4/sites/developing/using/spa-overview.html
See these resources:
Weekend SPA Tutorial - https://helpx.adobe.com/experience-manager/kt/sites/using/getting-started-spa-wknd-tutorial-develop/angular.html
Introduction with Demo: helpx.adobe.com/experience-manager/kt/sites/using/spa-editor-framework-feature-video-use.html
Some of the documentation we have for that:
https://helpx.adobe.com/experience-manager/kt/sites/using/getting-started-spa-wknd-tutorial-develop.html
SPA Editor Walkthrough: helpx.adobe.com/experience-manager/6-4/sites/developing/using/spa-walkthrough.html
Getting Started for Developers: helpx.adobe.com/experience-manager/6-4/sites/developing/using/spa-getting-started.html
SPA Editor Architecture: helpx.adobe.com/experience-manager/6-4/sites/developing/using/spa-architecture.html
SPA Editor Overview: helpx.adobe.com/experience-manager/6-4/sites/developing/using/spa-overview.html
Can I use the Asset Manager API to get asset renditions?
Yes - you can use the Asset Manager API to read asset renditions. See this code example:
public String getAsset(){
ResourceResolver resolver = null;
Map<String, Object> param = new HashMap<String, Object>();
param.put(ResourceResolverFactory.SUBSERVICE, "datawrite");
try {
//Invoke the adaptTo method to create a Session used to create a QueryManager
resolver = resolverFactory.getServiceResourceResolver(param);
log.info("Cretae the Asset");
//Use AssetManager to place the file into the AEM DAM
AssetManager assetMgr = resolver.adaptTo(AssetManager.class);
Asset myAsset = assetMgr.getAsset("/content/dam/we-retail/en/people/womens/women_6.jpg");
Rendition myRen = myAsset.getRendition("/content/dam/we-retail/en/people/womens/women_6.jpg/jcr:content/renditions/cq5dam.thumbnail.140.100.png");
InputStream is = myRen.getStream();
//Cretae a new Asste with the Rendition
//Use AssetManager to place the file into the AEM DAM
com.day.cq.dam.api.AssetManager assetMgr2 = resolver.adaptTo(com.day.cq.dam.api.AssetManager.class);
String newFile = "/content/dam/travel/test.png" ;
assetMgr2.createAsset(newFile, is,"image/jpeg", true);
return ("New Asset Created");
}
catch(Exception e)
{
e.printStackTrace();
}
return "ERROR";
}
Yes - you can use the Asset Manager API to read asset renditions. See this code example:
public String getAsset(){
ResourceResolver resolver = null;
Map<String, Object> param = new HashMap<String, Object>();
param.put(ResourceResolverFactory.SUBSERVICE, "datawrite");
try {
//Invoke the adaptTo method to create a Session used to create a QueryManager
resolver = resolverFactory.getServiceResourceResolver(param);
log.info("Cretae the Asset");
//Use AssetManager to place the file into the AEM DAM
AssetManager assetMgr = resolver.adaptTo(AssetManager.class);
Asset myAsset = assetMgr.getAsset("/content/dam/we-retail/en/people/womens/women_6.jpg");
Rendition myRen = myAsset.getRendition("/content/dam/we-retail/en/people/womens/women_6.jpg/jcr:content/renditions/cq5dam.thumbnail.140.100.png");
InputStream is = myRen.getStream();
//Cretae a new Asste with the Rendition
//Use AssetManager to place the file into the AEM DAM
com.day.cq.dam.api.AssetManager assetMgr2 = resolver.adaptTo(com.day.cq.dam.api.AssetManager.class);
String newFile = "/content/dam/travel/test.png" ;
assetMgr2.createAsset(newFile, is,"image/jpeg", true);
return ("New Asset Created");
}
catch(Exception e)
{
e.printStackTrace();
}
return "ERROR";
}
How can I develop a custom RTE plug-in
http://experience-aem.blogspot.com/2017/06/aem-63-touch-ui-rte-rich-text-editor-color-pick er-plugin-inplace-dialog-edit.html
http://experience-aem.blogspot.com/2017/06/aem-63-touch-ui-rte-rich-text-editor-color-pick er-plugin-inplace-dialog-edit.html
How to generate a PDF from AEM content
See - https://forums.adobe.com/thread/2539800
How to Recompile JSP files in AEM
See: https://helpx.adobe.com/experience-manager/kb/How-to-force-a-recompilation-of-all-Sling-scripts-jsps-java-sightly-on-AEM-6-4.html
See - https://forums.adobe.com/thread/2539800
How to Recompile JSP files in AEM
See: https://helpx.adobe.com/experience-manager/kb/How-to-force-a-recompilation-of-all-Sling-scripts-jsps-java-sightly-on-AEM-6-4.html
How can I use the Document Services API
See: https://helpx.adobe.com/aem-forms/6/aem-document-services-programmatically.html
https://helpx.adobe.com/experience-manager/kt/forms/using/documentservices-aem-forms-tutorial-use.html
The RTE Editor plug-in are not visible until I click within the RTE. How can I fix it?
See - https://forums.adobe.com/thread/2515119
How can I use HTL syntax to include a clientlib?
use this syntax -- <sly data-sly-use.clientLib="/libs/granite/sightly/templates/clientlib.html" data-sly-call="${clientLib.js @ categories='cq.jquerycar'}" data-sly-unwrap/>
What are Design Dialogs used for?
Design Dialogs allow a user to update the Policy of a component. When working with structural components that will be re-used across templates it is advantageous to use Policies since the policy can be applied across templates. See this article for more information -- https://helpx.adobe.com/experience-manager/kt/sites/using/getting-started-wknd-tutorial-develop/part5.html
How How to access to an URL selector at a component level?
See this thread -- https://forums.adobe.com/thread/2590104
How can I define a new path for a Sling Servlet?
See https://forums.adobe.com/thread/2497079
See: https://helpx.adobe.com/aem-forms/6/aem-document-services-programmatically.html
https://helpx.adobe.com/experience-manager/kt/forms/using/documentservices-aem-forms-tutorial-use.html
The RTE Editor plug-in are not visible until I click within the RTE. How can I fix it?
See - https://forums.adobe.com/thread/2515119
How can I use HTL syntax to include a clientlib?
use this syntax -- <sly data-sly-use.clientLib="/libs/granite/sightly/templates/clientlib.html" data-sly-call="${clientLib.js @ categories='cq.jquerycar'}" data-sly-unwrap/>
What are Design Dialogs used for?
Design Dialogs allow a user to update the Policy of a component. When working with structural components that will be re-used across templates it is advantageous to use Policies since the policy can be applied across templates. See this article for more information -- https://helpx.adobe.com/experience-manager/kt/sites/using/getting-started-wknd-tutorial-develop/part5.html
How How to access to an URL selector at a component level?
See this thread -- https://forums.adobe.com/thread/2590104
How can I define a new path for a Sling Servlet?
See https://forums.adobe.com/thread/2497079
How can I read page properties from multiple pages and construct JSON?
To perform this use case, you need to query pages using QueryBuilder or JCR SQL2. Read the node properties that you want and then place them into a list. Use that list to construct the JSON using a Java lib such as GSON. See this example...
WRITE CODE TO GET JCR API SESSION....
To perform this use case, you need to query pages using QueryBuilder or JCR SQL2. Read the node properties that you want and then place them into a list. Use that list to construct the JSON using a Java lib such as GSON. See this example...
WRITE CODE TO GET JCR API SESSION....
//Obtain the query manager for the session ...
javax.jcr.query.QueryManager queryManager = session.getWorkspace().getQueryManager();
String sqlStatement = "select * from [cq:Page] where isdescendantnode('/content/we-retail/us/en/experience') " ;
javax.jcr.query.Query query = queryManager.createQuery(sqlStatement,"JCR-SQL2");
//Execute the query and get the results ...
javax.jcr.query.QueryResult result = query.execute();
//Iterate over the nodes in the results ...
javax.jcr.NodeIterator nodeIter = result.getNodes();
long size = nodeIter.getSize();
Bean myBean = null;
ArrayList<Bean> list = new ArrayList() ;
while ( nodeIter.hasNext() ) {
//For each node-- get the path of the node
javax.jcr.Node node = nodeIter.nextNode();myBean = new Bean();
javax.jcr.query.QueryManager queryManager = session.getWorkspace().getQueryManager();
String sqlStatement = "select * from [cq:Page] where isdescendantnode('/content/we-retail/us/en/experience') " ;
javax.jcr.query.Query query = queryManager.createQuery(sqlStatement,"JCR-SQL2");
//Execute the query and get the results ...
javax.jcr.query.QueryResult result = query.execute();
//Iterate over the nodes in the results ...
javax.jcr.NodeIterator nodeIter = result.getNodes();
long size = nodeIter.getSize();
Bean myBean = null;
ArrayList<Bean> list = new ArrayList() ;
while ( nodeIter.hasNext() ) {
//For each node-- get the path of the node
javax.jcr.Node node = nodeIter.nextNode();myBean = new Bean();
javax.jcr.Node context = node.getNode("jcr:content");
//Set Bean and push to List
myBean.setTitle(context.getProperty("jcr:title").getString());
myBean.setTemplate(context.getProperty("cq:template").getString());
list.add(myBean);
}
System.out.println("the list is this big "+list.size() ) ;
doGSON(list) ;
}
catch(Exception e){
e.printStackTrace();
}
return null;
}
public String doGSON(ArrayList theList) {
// create the object of the album
JsonObject albums = new JsonObject();
// add a property called title to the object of the album
albums.addProperty("name", "page");
// create an array called datasets
JsonArray datasets = new JsonArray();
// create a dataset
JsonObject dataset = null ;
int size = theList.size();
for (int index =0; index<size; index++) {
dataset = new JsonObject();
Bean singleBean = (Bean) theList.get(index);
String title = singleBean.getTitle();
String template = singleBean.getTemplate();
dataset.addProperty("title", title);
// add the property album_year to the dataset
dataset.addProperty("template", template);
datasets.add(dataset);
albums.add("dataset", datasets);
}
Gson gson = new GsonBuilder().setPrettyPrinting().serializeNulls().setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE).create();
System.out.println(gson.toJson(albums));
return "";
}
Can I use a Radio data type in a Multi-field?
See this video -- https://www.youtube.com/watch?v=Fu4mV4Xridg&t=6s
I want to know about how Sling locates resources
See: https://helpx.adobe.com/experience-manager/6-2/sites/developing/using/sling-cheatsheet.html
How can I created a nested Coral 3 Multi-field
See this article -- http://experience-aem.blogspot.ca/2018/04/aem-64-touch-ui-nested-composite-multifield-coral-3.html
I want to know more about DS Annotations
Read this article -- http://www.nateyolles.com/blog/2017/05/osgi-declarative-services-annotations-in-aem
Another good piece of community information -- https://blog.osoco.de/2016/05/migrating-from-the-apache-felix-scr-annotations-to-the-osgi-declarative-services-annotations/
//Set Bean and push to List
myBean.setTitle(context.getProperty("jcr:title").getString());
myBean.setTemplate(context.getProperty("cq:template").getString());
list.add(myBean);
}
System.out.println("the list is this big "+list.size() ) ;
doGSON(list) ;
}
catch(Exception e){
e.printStackTrace();
}
return null;
}
public String doGSON(ArrayList theList) {
// create the object of the album
JsonObject albums = new JsonObject();
// add a property called title to the object of the album
albums.addProperty("name", "page");
// create an array called datasets
JsonArray datasets = new JsonArray();
// create a dataset
JsonObject dataset = null ;
int size = theList.size();
for (int index =0; index<size; index++) {
dataset = new JsonObject();
Bean singleBean = (Bean) theList.get(index);
String title = singleBean.getTitle();
String template = singleBean.getTemplate();
dataset.addProperty("title", title);
// add the property album_year to the dataset
dataset.addProperty("template", template);
datasets.add(dataset);
albums.add("dataset", datasets);
}
Gson gson = new GsonBuilder().setPrettyPrinting().serializeNulls().setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE).create();
System.out.println(gson.toJson(albums));
return "";
}
Can I use a Radio data type in a Multi-field?
See this video -- https://www.youtube.com/watch?v=Fu4mV4Xridg&t=6s
I want to know about how Sling locates resources
See: https://helpx.adobe.com/experience-manager/6-2/sites/developing/using/sling-cheatsheet.html
How can I created a nested Coral 3 Multi-field
See this article -- http://experience-aem.blogspot.ca/2018/04/aem-64-touch-ui-nested-composite-multifield-coral-3.html
I want to know more about DS Annotations
Read this article -- http://www.nateyolles.com/blog/2017/05/osgi-declarative-services-annotations-in-aem
Another good piece of community information -- https://blog.osoco.de/2016/05/migrating-from-the-apache-felix-scr-annotations-to-the-osgi-declarative-services-annotations/
I want to use sling models to retrieve Multi-field values using sling models
This is a straightforward use case. See this article for details -- http://scottsdigitalcommunity.blogspot.ca/2017/12/creating-htl-repeating-data-set-63.html
This is a straightforward use case. See this article for details -- http://scottsdigitalcommunity.blogspot.ca/2017/12/creating-htl-repeating-data-set-63.html
How to print the jcr:lastModified using HTL without writing a java class
You can use the following syntax:
${properties['jcr:lastModified'] @format='dd/MM/yyyy'}
You can use the following syntax:
${properties['jcr:lastModified'] @format='dd/MM/yyyy'}
Can I use OAuth in AEM?
Refer to these resources:
https://docs.adobe.com/ddc/en/gems/oauth-server-functionality-in-aem---embrace-federation-and-unlea.html
https://aemcorner.com/adobe-granite-oauth-authentication-handler/
https://github.com/Adobe-Marketing-Cloud/aem-communities-oauth-sample
Refer to these resources:
https://docs.adobe.com/ddc/en/gems/oauth-server-functionality-in-aem---embrace-federation-and-unlea.html
https://aemcorner.com/adobe-granite-oauth-authentication-handler/
https://github.com/Adobe-Marketing-Cloud/aem-communities-oauth-sample
Can I programmatically remove a user from groups?
You can use the UserManager API. Use the following code:
Authorizable groupAuthorizable = userManager.getAuthorizable(group);
if (groupAuthorizable != null && groupAuthorizable instanceof Group) {
((Group) groupAuthorizable).removeMember(user);
}
You can use the UserManager API. Use the following code:
Authorizable groupAuthorizable = userManager.getAuthorizable(group);
if (groupAuthorizable != null && groupAuthorizable instanceof Group) {
((Group) groupAuthorizable).removeMember(user);
}
Can I use an API to update OSGi configuration values?
Yes you can - see http://www.nateyolles.com/blog/2015/10/updating-osgi-configurations-in-aem-and-sling
Yes you can - see http://www.nateyolles.com/blog/2015/10/updating-osgi-configurations-in-aem-and-sling
How can I add a FAVICON to an AEM Site?
See this article - http://scottsdigitalcommunity.blogspot.ca/2017/11/creating-favicon-for-adobe-experience.html
What is the Difference between IParsys and Parsys?
See: http://myadobecq.blogspot.in/2014/01/parsys-vs-iparsys.html
See this article - http://scottsdigitalcommunity.blogspot.ca/2017/11/creating-favicon-for-adobe-experience.html
What is the Difference between IParsys and Parsys?
See: http://myadobecq.blogspot.in/2014/01/parsys-vs-iparsys.html
How can I create a Nested Touch UI Multifield?
See this article - AEM 63 - Touch UI Nested ( Multi-Multi ) Coral 2 Composite Multifield
How can I extend Core Components?
See this community article -- https://www.netcentric.biz/blog/aem-6-3-developing-with-new-core-components.html
See this article - AEM 63 - Touch UI Nested ( Multi-Multi ) Coral 2 Composite Multifield
How can I extend Core Components?
See this community article -- https://www.netcentric.biz/blog/aem-6-3-developing-with-new-core-components.html
How can I create an OAK Index
Unlike Jackrabbit 2, Oak does not index content by default. Custom indexes need to be created when necessary, much like with traditional relational databases. If there is no index for a specific query, possibly many nodes will be traversed. The query may still work but probably be very slow.
To avoid performance issues, you need to create an OAK index. See these resources for more information:
1. Oak Queries and Indexing
2. GEMS Session on OAK Index
I want to see a basic Architecture diagram for AEM
See: https://helpx.adobe.com/experience-manager/6-3/sites/authoring/using/author.html
Unlike Jackrabbit 2, Oak does not index content by default. Custom indexes need to be created when necessary, much like with traditional relational databases. If there is no index for a specific query, possibly many nodes will be traversed. The query may still work but probably be very slow.
To avoid performance issues, you need to create an OAK index. See these resources for more information:
1. Oak Queries and Indexing
2. GEMS Session on OAK Index
I want to see a basic Architecture diagram for AEM
See: https://helpx.adobe.com/experience-manager/6-3/sites/authoring/using/author.html
I want to start migrating data from a non-AEM site to AEM
See this community article -- https://www.techaspect.com/blog/steps-successful-aem-content-migration/
How come I cannot use Design Mode for We Retail?
If you attempt to use Design Mode for We Retail in order to add new components, you will notice that Design mode is not there.
The reason is pages based on Editable Templates do not have Design Mode. To add a component group, you need to add the component group by using the editable templates Policy.
For information about working with Policies and editable templates - see this article - http://scottsdigitalcommunity.blogspot.ca/2017/04/creating-adobe-experience-manager.html
See this community article -- https://www.techaspect.com/blog/steps-successful-aem-content-migration/
How come I cannot use Design Mode for We Retail?
If you attempt to use Design Mode for We Retail in order to add new components, you will notice that Design mode is not there.
The reason is pages based on Editable Templates do not have Design Mode. To add a component group, you need to add the component group by using the editable templates Policy.
For information about working with Policies and editable templates - see this article - http://scottsdigitalcommunity.blogspot.ca/2017/04/creating-adobe-experience-manager.html
I am trying to render an RTE value in HTL, but is displayed as HTML Tags - not HTML content?
If you want to read the value of an RTE and display in a HTL component - along with the tags such as a hyperlink, you need to use this HTL syntax:
If you want to read the value of an RTE and display in a HTL component - along with the tags such as a hyperlink, you need to use this HTL syntax:
${head.text @ context='html'}
here head.text is the RTE value.
here head.text is the RTE value.
What are Projects in AEM?
See this link - Developing Projects in AEM.
See this link - Developing Projects in AEM.
How can I test my AEM Code?
You can test your AEM Java code by using the Test class that is generated for you when you build an Adobe Maven 11 Archetype project. See http://scottsdigitalcommunity.blogspot.ca/2017/09/creating-adobe-experience-manager-63.html.
For example, assume you create a project named AEM633. Once you build this project, you will have a class named TestHelloWorldModel located in this package:
com.foo.core.models (under src\test\java)
All of the POM dependencies are set up for you. Create a simple interface in the Core package named Foo.
package com.foo.core;
public interface Foo {
public String getName();
}
Then create an implementation class that uses a @Component annotation in the same package.
package com.foo.core;
import org.osgi.service.component.annotations.Component;
@Component
public class FooImpl implements Foo{
public String getName()
{
return "Scott" ;
}
}
This is about the most basic AEM class that you can build. It has one method that returns a static value for the getName method. Now the question is how can we test this method?
The answer is to use the TestHelloWorldModel class that already exists. You can create a Foo object and then test the getName method. See the bold code below.
package com.foo.core.models;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.UUID;
import junitx.util.PrivateAccessor;
import org.apache.sling.settings.SlingSettingsService;
import org.junit.Before;
import org.junit.Test;
import com.foo.core.Foo;
You can test your AEM Java code by using the Test class that is generated for you when you build an Adobe Maven 11 Archetype project. See http://scottsdigitalcommunity.blogspot.ca/2017/09/creating-adobe-experience-manager-63.html.
For example, assume you create a project named AEM633. Once you build this project, you will have a class named TestHelloWorldModel located in this package:
com.foo.core.models (under src\test\java)
All of the POM dependencies are set up for you. Create a simple interface in the Core package named Foo.
package com.foo.core;
public interface Foo {
public String getName();
}
Then create an implementation class that uses a @Component annotation in the same package.
package com.foo.core;
import org.osgi.service.component.annotations.Component;
@Component
public class FooImpl implements Foo{
public String getName()
{
return "Scott" ;
}
}
This is about the most basic AEM class that you can build. It has one method that returns a static value for the getName method. Now the question is how can we test this method?
The answer is to use the TestHelloWorldModel class that already exists. You can create a Foo object and then test the getName method. See the bold code below.
package com.foo.core.models;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.UUID;
import junitx.util.PrivateAccessor;
import org.apache.sling.settings.SlingSettingsService;
import org.junit.Before;
import org.junit.Test;
import com.foo.core.Foo;
import com.foo.core.FooImpl;
/**
* Simple JUnit test verifying the HelloWorldModel
*/
public class TestHelloWorldModel {
* Simple JUnit test verifying the HelloWorldModel
*/
public class TestHelloWorldModel {
//@Inject
private HelloWorldModel hello;
private Foo myFoo;
private String slingId;
private HelloWorldModel hello;
private Foo myFoo;
private String slingId;
@Before
public void setup() throws Exception {
SlingSettingsService settings = mock(SlingSettingsService.class);
slingId = UUID.randomUUID().toString();
when(settings.getSlingId()).thenReturn(slingId);
public void setup() throws Exception {
SlingSettingsService settings = mock(SlingSettingsService.class);
slingId = UUID.randomUUID().toString();
when(settings.getSlingId()).thenReturn(slingId);
hello = new HelloWorldModel();
PrivateAccessor.setField(hello, "settings", settings);
hello.init();
myFoo = new FooImpl();
PrivateAccessor.setField(hello, "settings", settings);
hello.init();
myFoo = new FooImpl();
}
@Test
public void testGetMessage() throws Exception {
// some very basic junit tests
String msg = hello.getMessage();
assertNotNull(msg);
assertTrue(msg.length() > 0);
}
@Test
public void testFooMessage() throws Exception {
@Test
public void testGetMessage() throws Exception {
// some very basic junit tests
String msg = hello.getMessage();
assertNotNull(msg);
assertTrue(msg.length() > 0);
}
@Test
public void testFooMessage() throws Exception {
//custom service
String msgFoo = myFoo.getName() ;
assertNotNull(msgFoo);
assertTrue(msgFoo.length() > 0);
}
}
When you build the Maven project (for example, mvn clean install), you can see the Test results that are written to this file:
C:\AdobeCQ\AEM633\core\target\surefire-reports\com.foo.core.models.TestHelloWorldModel.txt
For AEM and MOCK examples - see: https://github.com/adaptto/2018-junit5-and-sling-aem-mocks
How can I disable the options in the Assets Toolbar?
I have a requirement to remove options on the Assets toolbar.
If you simply want to disable those, you can overlay:
/libs/dam/gui/content/assetdetails/jcr:content/actions
and add disabled (boolean) = true for these actions
String msgFoo = myFoo.getName() ;
assertNotNull(msgFoo);
assertTrue(msgFoo.length() > 0);
}
}
When you build the Maven project (for example, mvn clean install), you can see the Test results that are written to this file:
C:\AdobeCQ\AEM633\core\target\surefire-reports\com.foo.core.models.TestHelloWorldModel.txt
For AEM and MOCK examples - see: https://github.com/adaptto/2018-junit5-and-sling-aem-mocks
How can I disable the options in the Assets Toolbar?
I have a requirement to remove options on the Assets toolbar.
If you simply want to disable those, you can overlay:
/libs/dam/gui/content/assetdetails/jcr:content/actions
and add disabled (boolean) = true for these actions
How can I apply color to a Table in the RTE?
See this blog for AEM 6.3 -- http://experience-aem.blogspot.com/2017/06/aem-63-touch-ui-rte-rich-text-editor-color-pick er-plugin-inplace-dialog-edit.html
This works as shown here:
I need to create a QUIZ in AEM. Can I use AEM Forms?
You cannot use AEM Forms to create a quiz component. It's best to use a JQuery plugin and develop a custom component as discussed here:
http://scottsdigitalcommunity.blogspot.ca/2016/01/developing-custom-adobe-experience.html
How can I configure AEM Link Checker to ignore certain URL patterns
See this community thread -- https://forums.adobe.com/thread/2422881
How do you display a DATE value in HTL?
Assume you have a node named startDate, which is based on a Date data type. To display this value in HTL, you can use the following HTL syntax.
${'yyyy-MM-dd HH:mm:ss.SSSXXX' @ format=head.startDate, timezone='UTC'}
See this article for a complete example - https://helpx.adobe.com/experience-manager/using/multifield_coral_aem63.html.
See this blog for AEM 6.3 -- http://experience-aem.blogspot.com/2017/06/aem-63-touch-ui-rte-rich-text-editor-color-pick er-plugin-inplace-dialog-edit.html
This works as shown here:
I need to create a QUIZ in AEM. Can I use AEM Forms?
You cannot use AEM Forms to create a quiz component. It's best to use a JQuery plugin and develop a custom component as discussed here:
http://scottsdigitalcommunity.blogspot.ca/2016/01/developing-custom-adobe-experience.html
How can I configure AEM Link Checker to ignore certain URL patterns
See this community thread -- https://forums.adobe.com/thread/2422881
How do you display a DATE value in HTL?
Assume you have a node named startDate, which is based on a Date data type. To display this value in HTL, you can use the following HTL syntax.
${'yyyy-MM-dd HH:mm:ss.SSSXXX' @ format=head.startDate, timezone='UTC'}
See this article for a complete example - https://helpx.adobe.com/experience-manager/using/multifield_coral_aem63.html.
How can I used GSON within AEM
To use the GSON XML library in AEM, you need to use the following dependency.
<dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId>
<version>2.8.0</version>
</dependency>
See - https://helpx.adobe.com/experience-manager/using/restful_aem63.html
How can I track Requests in AEM?
You can use the "Recent requests" view in the web console ( /system/console/requests) to actually check what the request is internally doing. Every includes and every forward is listed there and this should give you an insight into what's going on.
How can I align fields in a Touch UI Dialog?
See: https://forums.adobe.com/thread/2394012
How can I use Sling Queries?
See this community content -- http://sgaem.blogspot.ca/2017/10/apache-sling-sling-query-in-aem-63_9.html
Core Project has dependency on javax.inject [0,1) Bundles and imports not getting deployed You can add
<!-- Import any version of javax.inject, to allow running on multiple versions of AEM -->
<Import-Package>javax.inject;version=0.0.0,*</Import-Package>
to your bundles pom.xml. This should solve your issue. This says take any version from the Felix console for this bundle. Add it under maven-scr-plugin
How can I use an AEM API to find all Assets in a page?
See - http://wemcode.wemblog.com/get_asset_reference_in_page
How come when a Workflow is assigned to 1 user, sometimes another user can see it
Assume you have two users:
To use the GSON XML library in AEM, you need to use the following dependency.
<dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId>
<version>2.8.0</version>
</dependency>
See - https://helpx.adobe.com/experience-manager/using/restful_aem63.html
How can I track Requests in AEM?
You can use the "Recent requests" view in the web console ( /system/console/requests) to actually check what the request is internally doing. Every includes and every forward is listed there and this should give you an insight into what's going on.
How can I align fields in a Touch UI Dialog?
See: https://forums.adobe.com/thread/2394012
How can I use Sling Queries?
See this community content -- http://sgaem.blogspot.ca/2017/10/apache-sling-sling-query-in-aem-63_9.html
Core Project has dependency on javax.inject [0,1) Bundles and imports not getting deployed You can add
<!-- Import any version of javax.inject, to allow running on multiple versions of AEM -->
<Import-Package>javax.inject;version=0.0.0,*</Import-Package>
to your bundles pom.xml. This should solve your issue. This says take any version from the Felix console for this bundle. Add it under maven-scr-plugin
How can I use an AEM API to find all Assets in a page?
See - http://wemcode.wemblog.com/get_asset_reference_in_page
How come when a Workflow is assigned to 1 user, sometimes another user can see it
Assume you have two users:
User A
User B
Next, assume that you have a Workflow model that uses an OR Split and where the 1st step is assigned to User A. See this model.
Sometimes even if User A is assigned the a Workflow task- it may show up in User B inbox. This may happen if you have not specified User A as the 1st step. Also - it may happen if the Users are part of the workflow admin group. In order for User B not to see a task assigned to another member, ensure that they both belong to the workflow-users group.
Notice that User A is assigned a task when the workflow is started. Even if User B invokes the Workflow, a message is sent to User A - as shown here:
Although User B invoked the Workflow, they do not get a message in their corresponding inbox.
How can I get a reference to an AEM Service from a Sling Model
You cannot use @Reference to inject a service into a Sling Model. When attempting to get a service into an AEM Sling Model class - you can use @inject. See this thread:
https://forums.adobe.com/message/9864292#9864292
How can I limit the fields located in Multifield?
See this article - it works on 6.3 too -- http://experience-aem.blogspot.ca/2015/11/aem-61-sample-granite-widget-in-touch-ui-extending-multifield-to-limit-items.html
You can follow this for Classic UI
Learn Adobe AEM: Add limit to the number of elements in Multifield in Dialog
How can I change the Theme of a Touch UI Dialog?
See this article -- http://experience-aem.blogspot.ca/2017/09/aem-63-clientlib-to-change-dialog-background-to-dark-light.html
How can I modify the default text of a Parsys component?
See - https://scribcopia.wordpress.com/2017/08/13/customizing-text-within-parsys-touch-ui/
User B
Next, assume that you have a Workflow model that uses an OR Split and where the 1st step is assigned to User A. See this model.
Sometimes even if User A is assigned the a Workflow task- it may show up in User B inbox. This may happen if you have not specified User A as the 1st step. Also - it may happen if the Users are part of the workflow admin group. In order for User B not to see a task assigned to another member, ensure that they both belong to the workflow-users group.
Notice that User A is assigned a task when the workflow is started. Even if User B invokes the Workflow, a message is sent to User A - as shown here:
Although User B invoked the Workflow, they do not get a message in their corresponding inbox.
How can I get a reference to an AEM Service from a Sling Model
You cannot use @Reference to inject a service into a Sling Model. When attempting to get a service into an AEM Sling Model class - you can use @inject. See this thread:
https://forums.adobe.com/message/9864292#9864292
How can I limit the fields located in Multifield?
See this article - it works on 6.3 too -- http://experience-aem.blogspot.ca/2015/11/aem-61-sample-granite-widget-in-touch-ui-extending-multifield-to-limit-items.html
You can follow this for Classic UI
Learn Adobe AEM: Add limit to the number of elements in Multifield in Dialog
How can I change the Theme of a Touch UI Dialog?
See this article -- http://experience-aem.blogspot.ca/2017/09/aem-63-clientlib-to-change-dialog-background-to-dark-light.html
How can I modify the default text of a Parsys component?
See - https://scribcopia.wordpress.com/2017/08/13/customizing-text-within-parsys-touch-ui/
Where can I find good reference docs for Coral APIs
https://techrevel.blog/2017/05/26/coral-3-granite-ui-components/
How do I use HTL syntax to include a Core Component in my static template?
You can use HTL syntax to include AEM Core components into a static template. For example, to include the List component into a template - specify this syntax:
https://techrevel.blog/2017/05/26/coral-3-granite-ui-components/
How do I use HTL syntax to include a Core Component in my static template?
You can use HTL syntax to include AEM Core components into a static template. For example, to include the List component into a template - specify this syntax:
<div data-sly-resource="${'content' @ resourceType='core/wcm/components/list/v1/list'}">
What's the difference between a static template and an editable template
See - http://blogs.perficient.com/adobe/2017/07/24/static-or-editable-template-an-in-depth-comparison-and-guide/
In AEM 6.3 - I am getting osgi bundle whitelist error-osgi-service is NOT whitelisted to use SlingRepository.loginAdministrative
You can either use a System user and the sling mapping service:
http://scottsdigitalcommunity.blogspot.ca/2014/12/querying-adobe-experience-manager-6.html.
Or configure AEM - https://forums.adobe.com/thread/2355506
How can I integrate AEM with Hybris?
See - https://forums.adobe.com/thread/2355763
and How to integrate Adobe Experience Manager(AEM) and SAP Hybris through OOB connector
In HTL, how can I add the parsys component?
Add this code:
<sly data-sly-resource="${'content-par' @ resourceType='wcm/foundation/components/parsys'}"/>
I can use both JCR API and SLing API to work with the AEM JCR. Which one is better?
See: http://aempodcast.com/2017/apache-sling/sling-resource-api-vs-jcr-api/#.WUk8Q2jytaR
I want to send a message to a user's AEM inbox?
The easiest way is to create a task assigned to the user you want to notify.
https://docs.adobe.com/docs/en/aem/6-0/develop/ref/javadoc/com/adobe/granite/taskmanagemen t/TaskManager.html#createTask(com.adobe.granite.taskmanagement.Task)
When working with Sling Models, can I reference grandchildren nodes and work with Collections?
Yes, when you work with Sling Models, you can work with Grandchildren nodes from the node that you adapt. For example, consider the following JCR structure.
Assume you adapt NodeCollections in your Sling Model:
Resource resource = resourceResolver.getResource("/content/NodeCollections");
You can get the grandchildren nodes using this syntax and return them to a Java LIST object.
@Model(adaptables = Resource.class)
public class UserInfo {
@Inject
private List<Resource> Dad;
public List getGrandChildren()
{
return Dad ;
}
}
In this example, the List Object would contain six items. See more here:
https://sling.apache.org/documentation/bundles/models.html
I want to know the difference between Sling Models and WCMUsePojo
See https://forums.adobe.com/thread/2340988
Can Forms interact with Workflows?
See: https://helpx.adobe.com/aem-forms/6-3/aem-forms-workflow.html
I want to know more information about OSGi Declarative Services Annotations in AEM
See this article: http://www.nateyolles.com/blog/2017/05/osgi-declarative-services-annotations-in-aem
What's the difference between Foundation components and Core components?
See this community article for an answer:
http://adobeaemclub.com/aem63-core-components/
To learn to work with Core Components - see:
https://helpx.adobe.com/experience-manager/using/aem63_components.html
A user does not have permission to modify Assets, can they execute a Workflow that modifies them? Any member of the workflow-users group can list and start workflows, irrespective of their permissions on the payload the selected to run the workflow.
Does AEM by default use J2EE Sessions and Cookies? Nothing in AEM uses JavaEE Sessions.
What's the difference between a static template and an editable template
See - http://blogs.perficient.com/adobe/2017/07/24/static-or-editable-template-an-in-depth-comparison-and-guide/
In AEM 6.3 - I am getting osgi bundle whitelist error-osgi-service is NOT whitelisted to use SlingRepository.loginAdministrative
You can either use a System user and the sling mapping service:
http://scottsdigitalcommunity.blogspot.ca/2014/12/querying-adobe-experience-manager-6.html.
Or configure AEM - https://forums.adobe.com/thread/2355506
How can I integrate AEM with Hybris?
See - https://forums.adobe.com/thread/2355763
and How to integrate Adobe Experience Manager(AEM) and SAP Hybris through OOB connector
In HTL, how can I add the parsys component?
Add this code:
<sly data-sly-resource="${'content-par' @ resourceType='wcm/foundation/components/parsys'}"/>
I can use both JCR API and SLing API to work with the AEM JCR. Which one is better?
See: http://aempodcast.com/2017/apache-sling/sling-resource-api-vs-jcr-api/#.WUk8Q2jytaR
I want to send a message to a user's AEM inbox?
The easiest way is to create a task assigned to the user you want to notify.
https://docs.adobe.com/docs/en/aem/6-0/develop/ref/javadoc/com/adobe/granite/taskmanagemen t/TaskManager.html#createTask(com.adobe.granite.taskmanagement.Task)
When working with Sling Models, can I reference grandchildren nodes and work with Collections?
Yes, when you work with Sling Models, you can work with Grandchildren nodes from the node that you adapt. For example, consider the following JCR structure.
Assume you adapt NodeCollections in your Sling Model:
Resource resource = resourceResolver.getResource("/content/NodeCollections");
You can get the grandchildren nodes using this syntax and return them to a Java LIST object.
@Model(adaptables = Resource.class)
public class UserInfo {
@Inject
private List<Resource> Dad;
public List getGrandChildren()
{
return Dad ;
}
}
In this example, the List Object would contain six items. See more here:
https://sling.apache.org/documentation/bundles/models.html
I want to know the difference between Sling Models and WCMUsePojo
See https://forums.adobe.com/thread/2340988
Can Forms interact with Workflows?
See: https://helpx.adobe.com/aem-forms/6-3/aem-forms-workflow.html
I want to know more information about OSGi Declarative Services Annotations in AEM
See this article: http://www.nateyolles.com/blog/2017/05/osgi-declarative-services-annotations-in-aem
What's the difference between Foundation components and Core components?
See this community article for an answer:
http://adobeaemclub.com/aem63-core-components/
To learn to work with Core Components - see:
https://helpx.adobe.com/experience-manager/using/aem63_components.html
A user does not have permission to modify Assets, can they execute a Workflow that modifies them? Any member of the workflow-users group can list and start workflows, irrespective of their permissions on the payload the selected to run the workflow.
Does AEM by default use J2EE Sessions and Cookies? Nothing in AEM uses JavaEE Sessions.
Components cannot be moved. Why?
If you want to move components upwards or downwards, you need to use copymove in cq:actions property.
Here it is!!
If you want to move components upwards or downwards, you need to use copymove in cq:actions property.
Here it is!!
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
cq:actions="[text:My Component,-,edit,delete,insert,copymove]"
cq:dialogMode="floating"
cq:layout="editbar"
jcr:primaryType="cq:EditConfig">
</jcr:root>
Check here for more information: http://labs.6dglobal.com/blog/2014-01-08/the-great-and-powerful-cq-editconfig/
I am using AEM Forms, not AEM SitesSee these docs: https://helpx.adobe.com/aem-forms/6-1/help-tutorials.html
Can I use @Reference in an HTL Class that extends WCMUsePojo
You cannot use the @Reference annotation from an HTL class that extends WCMUsePojo. This can be used from a Java class that uses @Service to reference another service known as dependency injection. To learn about Dependency Injection in AEM, see this article:
Injecting a DataSourcePool Service into an Adobe Experience Manager OSGi bundle
Now to learn how to get a reference to another AEM service from a class that extends WCMUsePojo, see this article:
Creating an AEM HTL component that queries the JCR
Can I use @Reference from within a Sling Servlet?
You can use Dependency Injection from within a Sling Servlet. See this community article/video.
http://scottsdigitalcommunity.blogspot.ca/2016/12/creating-adobe-experience-manager-htl.html
Can I manipulate the Touch UI Rich Text Editor using code
See this community article - http://experience-aem.blogspot.ca/2015/01/aem-6-sp1-touch-ui-rich-text-editor-plugin-to-upper-case.html
How can I programmatically retrieve HTML from an AEM page
See this great community article by Nolle Yolles: http://www.nateyolles.com/blog/2015/10/get-rendered-html-for-an-aem-resource-or-component
What is cq.editconfig and when should I use it
See this great community article -- http://labs.6dglobal.com/blog/2014-01-08/the-great-and-powerful-cq-editconfig/
Where do Lucene, Solr, ElasticSearch fit in the AEM Platform?
See this great community article -- https://www.linkedin.com/pulse/where-do-lucene-solr-elasticsearch-fit-aem-platform-search-ramar
Can I view an asset's metadata in CRXDE lite?
Assume you have added metadata to a digital asset, as shown in this illustration.
You can view the assets metadata by viewing a node named metadata under the asset in the AEM dam (/content/dam). For example, the above image is located here:
/content/dam/geometrixx-instore/cover-images/seasonal.jpg
The metadata is stored as node properties as shown in this illustration.
Can I programmatically work with Coral UI objects such as checkboxes?
Yes, you can. It involves creating a JS script in an AEM Clientlib and then coding. See the reference documentation here:
https://docs.adobe.com/docs/en/aem/6-2/develop/ref/coral-ui/components/Coral.Checkbox.html#
Given this setup in CRXDE Lite:
You can get a reference to this checkbox object in a clientlibs folder. The name of the clientlibs folder for Touch UI dialogs is cq.authoring.dialog ( this is talked about here. http://scottsdigitalcommunity.blogspot.ca/2015/05/using-event-handlers-in-adobe.html).
Code:
(function ($, $document) {
"use strict";
$document.on("dialog-ready", function() {
$('#kitten').attr('checked', true);
});
})(jQuery, jQuery(document));
The result is the checkbox is checked via code:
Note - we are planning on conducting a full session of AEM Ask the Community Experts on AEM Developing with the Coral API.
Need to search for special characters when searching JCR via JCR SQL2
Read this topic -- https://wiki.apache.org/jackrabbit/EncodingAndEscaping. YOU need to escape illegal JCR characters.
How can I work with custom JARs that are not in the Maven repository
You can place the JAR in your local Maven Repository and then reference it in your POM file. For example, to resolve myCustomJAR_1.0.0.jar within an AEM service, the myCustomJAR_1.0.0.jar file must be located in the Maven repository. You can upload the myCustomJAR_1.0.0.jar to Maven by using this Maven command:
mvn install:install-file -Dfile=C:/plugins/myCustomJAR_1.0.0.jar -DgroupId=com.foo.reports -DartifactId=jrurbersrt1.0 -Dversion=1.0 -Dpackaging=jar -DgeneratePom=true
Notice that you must specify the location of the myCustomJAR file in the -Dfile argument. Also notice that you specify the Dgroup and DartifactID values. Once you upload the JAR to Maven using this command, you can reference this JAR file using this Dependency.
<groupId>com.foo.reports</groupId>
<artifactId>jrurbersrt1.0</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>C:\Users\scottm\.m2\repository\com\foo\reports\jrurbersrt1.0\1.0\myCustomJAR_1.0.0.jar</systemPath>
</dependency>
Notice that scope element is a system and systemPath references the location of the JAR file in the repository. (This dependency is used later in this article to build the AEM service)
How can I work with 3rd party JARs when I create an OSGi bundle
When working with OSGi bundles that use 3rd party JARs (that are located in the Maven Repository), you can embed the 3rd party JAR (for example, Simple JSON JAR) into a separate bundle and deploy to AEM.
See this community article/video for details.
http://scottsdigitalcommunity.blogspot.ca/2013/06/posting-form-data-to-adobe-cq-using.html
Enable CORS Access-Control-Allow-Origin in AEM
If you use the default AEM JQuery, it has a token that lets you perform AJAX operations to AEM.
AEM is experiencing slow page loading
See this community article -- https://www.linkedin.com/hp/update/6232752513683066880
How does Dispatcher Caching work
The dispatcher caches only files that have an extension, and the extensions which should be considered for caching can be configured in the dispatcher config as part of the caching rules.
So you need to add an extension to your service request (e.g. ".json") and configure the dispatcher accordingly, then the caching will work.
See these webinars on Dispatcher:
Optimizing the CQ Dispatcher Cache
AEM Technologists, Sept 2015 Dispatcher
ATACE July 25 2017 Advanced AEM Dispatcher Configurations
Capturing comments in a default email template used by an AEM 6.2 workflow
You can write a custom workflow step and inject values you want to populate into a email template with Java logic. For example:
//Populate the MAP with the values
myMap.put("topic.subject",TopicSubject);
myMap.put("time",timeStamp);
myMap.put("host.prefix",hostPrefix);
myMap.put("forum.url",forumUrl);
//Declare a MessageGateway service
MessageGateway<HtmlEmail> messageGateway;
//Specify the EMail template
String template ="/etc/notification/email/html/com.day.cq.collab.forum/en.txt";
Resource templateRsrc = request.getResourceResolver().getResource(template);
MailTemplate mailTemplate = MailTemplate.create(templateRsrc.getPath(), templateRsrc.getResourceResolver().adaptTo(Session.class));
HtmlEmail email = mailTemplate.getEmail(StrLookup.mapLookup(myMap), HtmlEmail.class);
A solution without coding is to use the variable ${item.data.comment} in the default en.txt. To see other variables that can be used, see https://docs.adobe.com/docs/en/aem/6-2/administer/operations/notification.html#Configuring the Workflow Email Notification Service.
com.adobe.granite.crxde-lite reinstall in publisher
Recently we observed com.adobe.granite.crxde-lite the bundle is not present/got deleted in publisher node. Due to this reason, we are not able to login to http://localhost:4503/crx/de
To solve this - Try the following actions:
1. On author log into OSGi /system/console/bundles.
2. Type CRX in the search field and click Apply filter
3. Most likely Adobe Granite CRXDE Lite com.adobe.granite.crxde-lite the bundle is missing, however, you can do the same search on Publish and compare the result to identify the difference.
4. Note Adobe Granite CRXDE bundle ID, in my sample, it is 222.
5. On your AEM author navigate to /crx-quickstart/launchpad/felix/bundle222 /AEM64/author/crx-quickstart/launchpad/felix/bundle222/version0.0
6. Deploy bundle.jar to AEM publish via /system/console/bundles -> Install/Update...
cq:actions="[text:My Component,-,edit,delete,insert,copymove]"
cq:dialogMode="floating"
cq:layout="editbar"
jcr:primaryType="cq:EditConfig">
</jcr:root>
Check here for more information: http://labs.6dglobal.com/blog/2014-01-08/the-great-and-powerful-cq-editconfig/
I am using AEM Forms, not AEM SitesSee these docs: https://helpx.adobe.com/aem-forms/6-1/help-tutorials.html
Can I use @Reference in an HTL Class that extends WCMUsePojo
You cannot use the @Reference annotation from an HTL class that extends WCMUsePojo. This can be used from a Java class that uses @Service to reference another service known as dependency injection. To learn about Dependency Injection in AEM, see this article:
Injecting a DataSourcePool Service into an Adobe Experience Manager OSGi bundle
Now to learn how to get a reference to another AEM service from a class that extends WCMUsePojo, see this article:
Creating an AEM HTL component that queries the JCR
Can I use @Reference from within a Sling Servlet?
You can use Dependency Injection from within a Sling Servlet. See this community article/video.
http://scottsdigitalcommunity.blogspot.ca/2016/12/creating-adobe-experience-manager-htl.html
Can I manipulate the Touch UI Rich Text Editor using code
See this community article - http://experience-aem.blogspot.ca/2015/01/aem-6-sp1-touch-ui-rich-text-editor-plugin-to-upper-case.html
How can I programmatically retrieve HTML from an AEM page
See this great community article by Nolle Yolles: http://www.nateyolles.com/blog/2015/10/get-rendered-html-for-an-aem-resource-or-component
What is cq.editconfig and when should I use it
See this great community article -- http://labs.6dglobal.com/blog/2014-01-08/the-great-and-powerful-cq-editconfig/
Where do Lucene, Solr, ElasticSearch fit in the AEM Platform?
See this great community article -- https://www.linkedin.com/pulse/where-do-lucene-solr-elasticsearch-fit-aem-platform-search-ramar
Can I view an asset's metadata in CRXDE lite?
Assume you have added metadata to a digital asset, as shown in this illustration.
You can view the assets metadata by viewing a node named metadata under the asset in the AEM dam (/content/dam). For example, the above image is located here:
/content/dam/geometrixx-instore/cover-images/seasonal.jpg
The metadata is stored as node properties as shown in this illustration.
Can I programmatically work with Coral UI objects such as checkboxes?
Yes, you can. It involves creating a JS script in an AEM Clientlib and then coding. See the reference documentation here:
https://docs.adobe.com/docs/en/aem/6-2/develop/ref/coral-ui/components/Coral.Checkbox.html#
Given this setup in CRXDE Lite:
You can get a reference to this checkbox object in a clientlibs folder. The name of the clientlibs folder for Touch UI dialogs is cq.authoring.dialog ( this is talked about here. http://scottsdigitalcommunity.blogspot.ca/2015/05/using-event-handlers-in-adobe.html).
Code:
(function ($, $document) {
"use strict";
$document.on("dialog-ready", function() {
$('#kitten').attr('checked', true);
});
})(jQuery, jQuery(document));
The result is the checkbox is checked via code:
Note - we are planning on conducting a full session of AEM Ask the Community Experts on AEM Developing with the Coral API.
Need to search for special characters when searching JCR via JCR SQL2
Read this topic -- https://wiki.apache.org/jackrabbit/EncodingAndEscaping. YOU need to escape illegal JCR characters.
How can I work with custom JARs that are not in the Maven repository
You can place the JAR in your local Maven Repository and then reference it in your POM file. For example, to resolve myCustomJAR_1.0.0.jar within an AEM service, the myCustomJAR_1.0.0.jar file must be located in the Maven repository. You can upload the myCustomJAR_1.0.0.jar to Maven by using this Maven command:
mvn install:install-file -Dfile=C:/plugins/myCustomJAR_1.0.0.jar -DgroupId=com.foo.reports -DartifactId=jrurbersrt1.0 -Dversion=1.0 -Dpackaging=jar -DgeneratePom=true
Notice that you must specify the location of the myCustomJAR file in the -Dfile argument. Also notice that you specify the Dgroup and DartifactID values. Once you upload the JAR to Maven using this command, you can reference this JAR file using this Dependency.
<groupId>com.foo.reports</groupId>
<artifactId>jrurbersrt1.0</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>C:\Users\scottm\.m2\repository\com\foo\reports\jrurbersrt1.0\1.0\myCustomJAR_1.0.0.jar</systemPath>
</dependency>
Notice that scope element is a system and systemPath references the location of the JAR file in the repository. (This dependency is used later in this article to build the AEM service)
How can I work with 3rd party JARs when I create an OSGi bundle
When working with OSGi bundles that use 3rd party JARs (that are located in the Maven Repository), you can embed the 3rd party JAR (for example, Simple JSON JAR) into a separate bundle and deploy to AEM.
See this community article/video for details.
http://scottsdigitalcommunity.blogspot.ca/2013/06/posting-form-data-to-adobe-cq-using.html
Enable CORS Access-Control-Allow-Origin in AEM
If you use the default AEM JQuery, it has a token that lets you perform AJAX operations to AEM.
AEM is experiencing slow page loading
See this community article -- https://www.linkedin.com/hp/update/6232752513683066880
How does Dispatcher Caching work
The dispatcher caches only files that have an extension, and the extensions which should be considered for caching can be configured in the dispatcher config as part of the caching rules.
So you need to add an extension to your service request (e.g. ".json") and configure the dispatcher accordingly, then the caching will work.
See these webinars on Dispatcher:
Optimizing the CQ Dispatcher Cache
AEM Technologists, Sept 2015 Dispatcher
ATACE July 25 2017 Advanced AEM Dispatcher Configurations
Capturing comments in a default email template used by an AEM 6.2 workflow
You can write a custom workflow step and inject values you want to populate into a email template with Java logic. For example:
//Populate the MAP with the values
myMap.put("topic.subject",TopicSubject);
myMap.put("time",timeStamp);
myMap.put("host.prefix",hostPrefix);
myMap.put("forum.url",forumUrl);
//Declare a MessageGateway service
MessageGateway<HtmlEmail> messageGateway;
//Specify the EMail template
String template ="/etc/notification/email/html/com.day.cq.collab.forum/en.txt";
Resource templateRsrc = request.getResourceResolver().getResource(template);
MailTemplate mailTemplate = MailTemplate.create(templateRsrc.getPath(), templateRsrc.getResourceResolver().adaptTo(Session.class));
HtmlEmail email = mailTemplate.getEmail(StrLookup.mapLookup(myMap), HtmlEmail.class);
A solution without coding is to use the variable ${item.data.comment} in the default en.txt. To see other variables that can be used, see https://docs.adobe.com/docs/en/aem/6-2/administer/operations/notification.html#Configuring the Workflow Email Notification Service.
com.adobe.granite.crxde-lite reinstall in publisher
Recently we observed com.adobe.granite.crxde-lite the bundle is not present/got deleted in publisher node. Due to this reason, we are not able to login to http://localhost:4503/crx/de
To solve this - Try the following actions:
1. On author log into OSGi /system/console/bundles.
2. Type CRX in the search field and click Apply filter
3. Most likely Adobe Granite CRXDE Lite com.adobe.granite.crxde-lite the bundle is missing, however, you can do the same search on Publish and compare the result to identify the difference.
4. Note Adobe Granite CRXDE bundle ID, in my sample, it is 222.
5. On your AEM author navigate to /crx-quickstart/launchpad/felix/bundle222 /AEM64/author/crx-quickstart/launchpad/felix/bundle222/version0.0
6. Deploy bundle.jar to AEM publish via /system/console/bundles -> Install/Update...
No comments:
Post a Comment
If you have any doubts or questions, please let us know.