<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to trigger an action with java? in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/how-to-trigger-an-action-with-java/m-p/59262#M21005</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use case:&lt;/P&gt;&lt;P&gt;1. So basically I have an example &lt;A href="https://www.jhipster.tech/" rel="nofollow noopener noreferrer"&gt;jHipster&lt;/A&gt; java/angular project &amp;amp; Alfresco server.&lt;/P&gt;&lt;P&gt;2. I can add/pull files to/from Alfreesco repo via CMIS 1.1 &amp;amp; atompub URL&lt;/P&gt;&lt;P&gt;3. I can receive emails with attachments into alfresco&lt;/P&gt;&lt;P&gt;3. Now I would like to take received email with an attachment &amp;amp; send it to lets say to my Gmail account&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I understood correctly then Alfresco Share comes with a built in "Send Email" action. (This action can be triggered with a folder rule for example).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Is it possible to trigger this&amp;nbsp;"Send Email" action with a custom java code? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;1. Generate an example "Hello world" project (maven+java+Spring Boot) at&amp;nbsp;&lt;A href="https://start.spring.io/" rel="nofollow noopener noreferrer"&gt;Spring Initializr&lt;/A&gt; website&lt;/P&gt;&lt;P&gt;2. Inside this project call alfrescoSendMail();&lt;/P&gt;&lt;P&gt;3. This method then should connect to Alfresco server&lt;img id="smileytongue" class="emoticon emoticon-smileytongue" src="https://connect.hyland.com/i/smilies/16x16_smiley-tongue.png" alt="Smiley Tongue" title="Smiley Tongue" /&gt;ort, authenticate, pass in parameters like (subject, to , from, message, attachments).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H6 id="toc-hId-829962526"&gt;Or would it be simpler to just pull the files from alfresco repo via CMIS 1.1 &amp;amp; then &lt;SPAN style="text-decoration: underline; color: #00ccff;"&gt;&lt;A href="https://www.tutorialspoint.com/java/java_sending_email.htm" style="color: #00ccff;" rel="nofollow noopener noreferrer"&gt;use java functionality (click this link)&lt;/A&gt;&lt;/SPAN&gt; to send the emails instead ?&lt;/H6&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 May 2018 07:24:06 GMT</pubDate>
    <dc:creator>elcamino</dc:creator>
    <dc:date>2018-05-30T07:24:06Z</dc:date>
    <item>
      <title>How to trigger an action with java?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-trigger-an-action-with-java/m-p/59260#M21003</link>
      <description>Alfresco Community (Build: 201707)===============================Contains:&amp;nbsp;&amp;nbsp; &amp;nbsp;- Alfresco Platform:&amp;nbsp;&amp;nbsp; &amp;nbsp;5.2.g&amp;nbsp;&amp;nbsp; &amp;nbsp;- Alfresco Share:&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;5.2.falfresco-global.properties:### Outbound SMTP configuration properties - Working example #### Sample Gmail settingsmail.host=smtp.gmail.commail.port=465mail.use</description>
      <pubDate>Tue, 29 May 2018 10:22:01 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-trigger-an-action-with-java/m-p/59260#M21003</guid>
      <dc:creator>elcamino</dc:creator>
      <dc:date>2018-05-29T10:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to trigger an action with java?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-trigger-an-action-with-java/m-p/59261#M21004</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have the right idea. The question I have is, what do you want to trigger this code? Your method looks right (except for the method name, which should look more like "alfrescoSendMail"). But what class is your method in?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;* Is this an action executer that you are calling from a folder rule? (See &lt;A href="https://ecmarchitect.com/alfresco-developer-series-tutorials/actions/tutorial/tutorial.html" rel="nofollow noopener noreferrer"&gt;Actions Tutorial&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;&amp;nbsp;* Or is this a web script controller that you are invoking via REST? (See &lt;A href="https://ecmarchitect.com/alfresco-developer-series-tutorials/webscripts/tutorial/tutorial.html" rel="nofollow noopener noreferrer"&gt;Web Script Tutorial&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;&amp;nbsp;* Or is this a behavior that you have bound to a policy to trigger when something happens to a node of a certain type or with a certain aspect? (See &lt;A href="https://ecmarchitect.com/alfresco-developer-series-tutorials/behaviors/tutorial/tutorial.html" rel="nofollow noopener noreferrer"&gt;Behavior Tutorial&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you have decided what will trigger your email, you can put your method in a class that extends the appropriate parent class, then you can package your JAR up as an AMP and use the MMT to merge it with your Alfresco WAR (See &lt;A href="https://ecmarchitect.com/alfresco-developer-series-tutorials/maven-sdk/tutorial/tutorial.html" rel="nofollow noopener noreferrer"&gt;Maven SDK Tutorial&lt;/A&gt;).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2018 16:15:44 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-trigger-an-action-with-java/m-p/59261#M21004</guid>
      <dc:creator>jpotts</dc:creator>
      <dc:date>2018-05-29T16:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to trigger an action with java?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-trigger-an-action-with-java/m-p/59262#M21005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use case:&lt;/P&gt;&lt;P&gt;1. So basically I have an example &lt;A href="https://www.jhipster.tech/" rel="nofollow noopener noreferrer"&gt;jHipster&lt;/A&gt; java/angular project &amp;amp; Alfresco server.&lt;/P&gt;&lt;P&gt;2. I can add/pull files to/from Alfreesco repo via CMIS 1.1 &amp;amp; atompub URL&lt;/P&gt;&lt;P&gt;3. I can receive emails with attachments into alfresco&lt;/P&gt;&lt;P&gt;3. Now I would like to take received email with an attachment &amp;amp; send it to lets say to my Gmail account&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I understood correctly then Alfresco Share comes with a built in "Send Email" action. (This action can be triggered with a folder rule for example).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Is it possible to trigger this&amp;nbsp;"Send Email" action with a custom java code? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;1. Generate an example "Hello world" project (maven+java+Spring Boot) at&amp;nbsp;&lt;A href="https://start.spring.io/" rel="nofollow noopener noreferrer"&gt;Spring Initializr&lt;/A&gt; website&lt;/P&gt;&lt;P&gt;2. Inside this project call alfrescoSendMail();&lt;/P&gt;&lt;P&gt;3. This method then should connect to Alfresco server&lt;img id="smileytongue" class="emoticon emoticon-smileytongue" src="https://connect.hyland.com/i/smilies/16x16_smiley-tongue.png" alt="Smiley Tongue" title="Smiley Tongue" /&gt;ort, authenticate, pass in parameters like (subject, to , from, message, attachments).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H6 id="toc-hId-829962526"&gt;Or would it be simpler to just pull the files from alfresco repo via CMIS 1.1 &amp;amp; then &lt;SPAN style="text-decoration: underline; color: #00ccff;"&gt;&lt;A href="https://www.tutorialspoint.com/java/java_sending_email.htm" style="color: #00ccff;" rel="nofollow noopener noreferrer"&gt;use java functionality (click this link)&lt;/A&gt;&lt;/SPAN&gt; to send the emails instead ?&lt;/H6&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 May 2018 07:24:06 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-trigger-an-action-with-java/m-p/59262#M21005</guid>
      <dc:creator>elcamino</dc:creator>
      <dc:date>2018-05-30T07:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to trigger an action with java?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-trigger-an-action-with-java/m-p/59263#M21006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Java&amp;nbsp;service you used in your code is intended to be used in the Alfresco process, and not from outside.&lt;/P&gt;&lt;P&gt;In order to achieve what you need, I would use the webscript way (the link Jeff shared) and then, with the method exposed, use anything you want to execute it via REST, passing on the parameters you already have.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your custom webscript would have the code you shared&amp;nbsp;as part of it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 May 2018 18:02:41 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-trigger-an-action-with-java/m-p/59263#M21006</guid>
      <dc:creator>douglascrp</dc:creator>
      <dc:date>2018-05-30T18:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to trigger an action with java?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-trigger-an-action-with-java/m-p/59264#M21007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Either way it is Java code, so I don't think one is easier or harder than the other. From an architectural perspective it seems to me that Alfresco might be the right place to send the email because it is also the system receiving the email. On the other hand, if your JHipster app needs to do some processing, then maybe your JHipster app should send the email.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you decide to send the email from Alfresco you have to decide what triggers the email to be sent. If you need it to be triggered from your JHipster app, then write a web script and trigger it by calling the webscript's URL from the JHipster app.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you decide to send the email from JHipster, use CMIS to grab the files, then send it from there using whatever Java API you want.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 May 2018 20:42:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-trigger-an-action-with-java/m-p/59264#M21007</guid>
      <dc:creator>jpotts</dc:creator>
      <dc:date>2018-05-30T20:42:11Z</dc:date>
    </item>
  </channel>
</rss>

