Friday, 18 December 2015

Winners of the 2015 AEM Community Code Contest

During the month of November 2015, the AEM community team held a code contest where AEM Developers submitted functioning AEM code. All of these submissions will be discussed in upcoming 2016 AEM Community articles.

The AEM community team presents you with the three winning submissions:

AEM Quiz Component

The AEM Quiz component lets AEM authors configure a quiz by setting questions and answers. Question and Answer and other details of the quiz is authored using the Quiz Configuration component.  The Quiz component refers to the par/quiz_config node of a page. The result is a component that you can use in an AEM site that lets visitors fill out a quiz.



Congratulations to Praveen Dubey for submitting this first place submission. One of the reasons why this was selected as first place is it has addressed many questions in the AEM Forums on how to write a quiz component.

Vanity URL Manager

The vanity URL manager is a way for AEM users to manage vanity URLs. This tool is a new view in the Touch UI. Using this tool, you can filter by site and peform other operations such as deleting them. 




Congratulations to Lokesh BS for submitting this code.


Custom Carousel Component

The  custom carousel component uses panels and grids where author can see what image they are selecting and which image or items need to update. This submission is a great example of how you can customize out of the box AEM functionality to meet your business requirements. 


Congratulations to Ganesh Malaiyappan for submitting this entry. 


Adobe Digital Marketing Community

Join the Adobe Digital Marketing Community. Start by clicking this banner



I (Scott Macdonald) am a Senior Digital Marketing Community Manager at Adobe Systems with over 18 years in the high tech industry. I am also a programmer with knowledge in Java, JavaScript, C#,C++, HTML, XML and ActionScript. If  you would like to see more CQ or other Adobe Digital Marketing end to end articles like this, then leave a comment and let me know what content you would like to see.

TwitterFollow the Digital Marketing Customer Care team on Twitter @AdobeMktgCare.



 

Monday, 14 December 2015

Example JCR SQL Queries


Search for JCR retPlugin nodes in JCR

The following code example shows JCR SQL2 syntax to search for all rtePlugin nodes under /apps.

import javax.jcr.Repository;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
import javax.jcr.Node;
import javax.jcr.query.Query;

import org.apache.jackrabbit.commons.JcrUtils;

public class TestJCR {


    public static void main(String [] args)
    {


        try {

            String aemUrl = "http://localhost:4502/crx/server" ;
            //Create a connection to the CQ repository running on local host
            Repository repository = JcrUtils.getRepository(aemUrl);



            //Create a Session
            javax.jcr.Session session = repository.login( new SimpleCredentials("admin", "admin".toCharArray()));

            //Obtain the query manager for the session ...
            javax.jcr.query.QueryManager queryManager = session.getWorkspace().getQueryManager();

            //Specify the AEM JCR path where examples users are stored at /home/users/test

            String sqlStatement = "select * from [nt:unstructured] as p where isdescendantnode (p, [/apps]) AND NAME(p)='rtePlugins'";


            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 mySize = nodeIter.getSize();

            while ( nodeIter.hasNext() ) {

                //For each node-- get the path of the node
                javax.jcr.Node node = nodeIter.nextNode();

                String myPath = node.getPath();

                System.out.println(myPath);
            }

            // Save the session changes and log out
            session.save();
            session.logout();


        }
        catch(Exception e){
            e.printStackTrace();
        }

    }



}

Using Date Values in JCR SQL2 Queries

While developing AEM tools for my team, I am using some date-based queries while performing JCR-SQL2 queries. While this will not be a community article, I will still post the date-based queries so people new to JCR SQL2 can reference this. Futhermore - the dates are variables used in the query string.

This example is based on this stackoverflow thread: http://stackoverflow.com/questions/15117075/jcr-sql2-query-comparing-dates.

The important thing to consider and is shown below is:

The best way to use dates in a query is to use CAST to force the conversion of a string representation of a date/time into a DATE value used by JCR.

 String sqlStatement2 = "select * from [rep:User] where isdescendantnode('/home/users/mypath') and [jcr:created] > cast('"+ year +"-"+monthStr+"-"+dayStr+"T00:00:00.000+02:00' as date) and [jcr:created] < cast('"+ year2 +"-"+monthStr2+"-"+dayStr2+"T23:59:59.000+02:00' as date)";

  javax.jcr.query.Query query = queryManager.createQuery(sqlStatement2,"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();
   while ( nodeIter.hasNext() ) {


                //For each node-- get the path of the node
                javax.jcr.Node node = nodeIter.nextNode();

                String myPath = node.getPath();
                //do something with path value.... 


}

Saturday, 5 December 2015

Congratulations to Lokesh for 2015 AEM Community member of the Year

Congratulations to Lokesh BS - he was the AEM 2015 community member of the year. He has helped many community members throughout this year by submitting many AEM code packages, helping in the forums (currently 3rd place on leaderboard), doing ASK the Experts.

In recognition of his great community work - I will be travelling to New York this week to award Lo Ki with a brand new IPAD, an AEM 2015 Community member plaque, and a dinner at a New York Restaurant on Adobe.




I also want to say congratulations ot Praveen Dubey - who was 2nd  AEM community member of the year and started helping the AEM Community in May 2015 and has been very strong since.
Its awesome members like Praveen and Lokesh that help AEM developers become successful in their AEM projects. Great Job to both of you!!


Adobe Digital Marketing Community

Join the Adobe Digital Marketing Community. Start by clicking this banner



I (Scott Macdonald) am a Senior Digital Marketing Community Manager at Adobe Systems with over 18 years in the high tech industry. I am also a programmer with knowledge in Java, JavaScript, C#,C++, HTML, XML and ActionScript. If  you would like to see more CQ or other Adobe Digital Marketing end to end articles like this, then leave a comment and let me know what content you would like to see.

TwitterFollow the Digital Marketing Customer Care team on Twitter @AdobeMktgCare.

Tuesday, 1 December 2015

AEM Community Code Contest is now closed

Thanks AEM community for your great response to the code contest. We will be reviewing all entries and announce the winners by Dec 18, 2015. The three winning submissions will also be converted into community articles so our AEM community can benefit from these entries and learn new AEM skills.

These community articles will be posted in the first couple of months in 2016.



Adobe Digital Marketing Community

Join the Adobe Digital Marketing Community. Start by clicking this banner



I (Scott Macdonald) am a Senior Digital Marketing Community Manager at Adobe Systems with over 18 years in the high tech industry. I am also a programmer with knowledge in Java, JavaScript, C#,C++, HTML, XML and ActionScript. If  you would like to see more CQ or other Adobe Digital Marketing end to end articles like this, then leave a comment and let me know what content you would like to see.

TwitterFollow the Digital Marketing Customer Care team on Twitter @AdobeMktgCare.