Adobe-Consulting-Services/acs-aem-commons — pull request #350 by godanny86 (2014-11-07 22:18:53+00:00)
Title: Feature/email template workflow process

A workflow process step that sends an email using the email api from acs commons from [Issue #277](https://github.com/Adobe-Consulting-Services/acs-aem-commons/issues/277). Tested on AEM 5.6.1 and 6.0

* Based on the payload the email parameters are pre-populate with jcr properties:
* if **DAM asset** then param map is populated with metadata node properties
* if **cq:Page** then param map is populated with jcr:content properties.
* for the param map the key is the jcr property name and the value is a string representation of the property value. For jcr properties such as String[] the value is one comma separated string. Currently only checks for String[] as multiple properties.
* includes additional parameters added to email params:
* **wfStepTitle** - title of workflow step
* **wfModelTitle** - name of workflow model
* **authorLink** - uses **AuthorUIHelper** service to create a link to the payload on author
* **publishLink** - uses externalizer to create a link to the payload on publish
* Process is configured using the ootb Process Step with the following workflow arguments:
* **sendTo** - path to a cq user or group. email will be sent to the individual user or if its a group email sent to all members
* **emailTemplate** - path to the email template to use
* **dateFormat** - (optional) SimpleDateFormat string for converting Calendar properties to a String to be used in the email (i.e: yyyy-MM-dd hh:mm)

![screen shot 2014-11-07 at 5 11 00 pm](https://cloud.githubusercontent.com/assets/8974514/4961133/01978c0e-66cb-11e4-912d-e99c80102c1f.png)

Created **AbstractSendTemplatedEmailProcess.java** an abstract class so that project implementations can add unique business logic for email recipients and/or add additional email parameters to meet business requirements.

Created **AuthorUIHelper.java** to externalize logic related to generating a link to an asset/page on the author environment so that it can be re-used for other features. Has an OSGi configuration to toggle between Touch UI and Classic. (defaults to TouchUI)

![screen shot 2014-11-07 at 5 13 04 pm](https://cloud.githubusercontent.com/assets/8974514/4961177/5ba2cf74-66cb-11e4-9dce-cb2191a451f0.png)