<?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: [resolved] Configure a tJavaFlex to generate e-mail addresses in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-Configure-a-tJavaFlex-to-generate-e-mail-addresses/m-p/2302017#M74051</link>
    <description>Oh I actually solved it!! Anyways...in how I generated the java code for the email address I might just as well document it in here for the sake of ALL THE BEGINNERS out there like me on how I solved the whole exercise...for the exercise task, there is a picture attached below: 
&lt;BR /&gt; 
&lt;BR /&gt;Step 1: Create a routine called "MyRoutines" that will validate email address. As for me, my routine looked like this: 
&lt;BR /&gt; 
&lt;BR /&gt;package routines; 
&lt;BR /&gt; 
&lt;BR /&gt;import org.apache.oro.text.regex.MalformedPatternException; 
&lt;BR /&gt;import org.apache.oro.text.regex.Pattern; 
&lt;BR /&gt;import org.apache.oro.text.regex.Perl5Compiler; 
&lt;BR /&gt;import org.apache.oro.text.regex.Perl5Matcher; 
&lt;BR /&gt; 
&lt;BR /&gt;public class MyRoutines { 
&lt;BR /&gt; 
&lt;BR /&gt;public static boolean isValidEmail(String email) { 
&lt;BR /&gt;Perl5Matcher matcher = new Perl5Matcher(); 
&lt;BR /&gt;Perl5Compiler compiler = new Perl5Compiler(); 
&lt;BR /&gt;Pattern pattern; 
&lt;BR /&gt; 
&lt;BR /&gt;try { 
&lt;BR /&gt;pattern = compiler.compile("^[\\w_.-]+@[\\w_.-]+\\.[\\w]+$"); 
&lt;BR /&gt;if(!matcher.matches(email, pattern)) { 
&lt;BR /&gt;return false; 
&lt;BR /&gt;} 
&lt;BR /&gt;} catch (MalformedPatternException e) { 
&lt;BR /&gt;throw new RuntimeException(e); 
&lt;BR /&gt;}&amp;nbsp; 
&lt;BR /&gt;return true; 
&lt;BR /&gt;} 
&lt;BR /&gt;}&amp;nbsp; 
&lt;BR /&gt; 
&lt;BR /&gt;this routine needs to have a jakarta-oro-2.0.8.jar in order for this to work, so just (Download jakarta-oro-2.0.8 &amp;gt; right-click My Routines &amp;gt; Edit Routine Libraries &amp;gt; New &amp;gt; Browse Library File &amp;gt; Select jakarta-oro-2.0.8&amp;nbsp;) 
&lt;BR /&gt; 
&lt;BR /&gt;Step 2: Create a Job, put tJavaflex, tMap and tLogrow 
&lt;BR /&gt; 
&lt;BR /&gt;Step 3: Configure tJavaflex to generate 3 email address: ("talend@talend.com", "test.talend.com", "support@talend.com") 
&lt;BR /&gt; 
&lt;BR /&gt;The code in the tJavaflex is actually very simple:&amp;nbsp; 
&lt;BR /&gt; 
&lt;BR /&gt;// start part of your Java code 
&lt;BR /&gt;String [] emailArray = {"training@talend.com", "test.talend.com", "support@talend.com"}; 
&lt;BR /&gt;for(int j=0;j&amp;lt;emailArray.length;j++) { 
&lt;BR /&gt; 
&lt;BR /&gt;//main 
&lt;BR /&gt;row1.mail = emailArray&amp;lt;J&amp;gt;; 
&lt;BR /&gt; 
&lt;BR /&gt;// end of the component, outside/closing the loop 
&lt;BR /&gt;} 
&lt;BR /&gt; 
&lt;BR /&gt;Step 4: In the edit schema button of the tJavaFlex component, create a column and name it "mail" and connect the tjavaflex to the tMap component and connect the tMap compnent to the tLogRow component(you can choose the output name) 
&lt;BR /&gt; 
&lt;BR /&gt;Step 5: Double click the tMap component and&amp;nbsp;drag the row1.mail to the output side of the tMap 
&lt;BR /&gt; 
&lt;BR /&gt;Step 6: In the output side, add another column and name it "test" and set its type to Boolean 
&lt;BR /&gt; 
&lt;BR /&gt;Step 7: In the output expression part of the tMap, just below the row1.mail(output) and right beside the "test" column put this expression ------&amp;gt;&amp;nbsp;MyRoutines.isValidEmail(row1.mail) ------&amp;gt; this will call the routine and will validate the email address generated by the tJavaflex 
&lt;BR /&gt; 
&lt;BR /&gt;Step 8: That's it your done and run the Job!! 
&lt;BR /&gt; 
&lt;BR /&gt;Thank you guys for bearing with me!! hahaha!! XD peace y'all!!!&amp;nbsp; 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;A href="https://community.talend.com/legacyfs/online/320525/tmapExercise13.jpg" target="_blank"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MGiu.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/128329iB9C6A98871F4692B/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MGiu.jpg" alt="0683p000009MGiu.jpg" /&gt;&lt;/span&gt; &lt;/A&gt; 
&lt;A href="https://community.talend.com/legacyfs/online/320525/Exercise13.jpg" target="_blank"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MGox.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/158055i06FD5DBEF6C2B2AD/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MGox.jpg" alt="0683p000009MGox.jpg" /&gt;&lt;/span&gt;&lt;/A&gt;</description>
    <pubDate>Tue, 20 Oct 2015 04:48:40 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-10-20T04:48:40Z</dc:date>
    <item>
      <title>[resolved] Configure a tJavaFlex to generate e-mail addresses</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Configure-a-tJavaFlex-to-generate-e-mail-addresses/m-p/2302016#M74050</link>
      <description>&lt;P&gt;Hello Guys!&lt;BR /&gt;&lt;BR /&gt;I have encountered this exercise from the internet(Advanced Talend Exercise 13: Call an existing jar from within a job) and one of its task is to generate 3 email addresses("training@talend.com", "test.talend.com", "support@talend.com") by using a tJavaflex component. Now I'm not sure if the code that I made is right...so Im just gonna show you guys my code below:&lt;BR /&gt;// start part of your Java code&lt;BR /&gt;String [] emailArray = {"training@talend.com", "test@talend.com", "support@talend.com"};&lt;BR /&gt;for(int j=0;j&amp;lt;emailArray.length;j++) {&lt;BR /&gt;&lt;BR /&gt;// here is the main part of the component,&lt;BR /&gt;// a piece of code executed in the row&lt;BR /&gt;// loop&lt;BR /&gt;System.out.println(emailArray)&lt;BR /&gt;&lt;BR /&gt;// end of the component, outside/closing the loop&lt;BR /&gt;}&amp;nbsp;&lt;BR /&gt;and I want to know if this is correct? or Am I missing something important here? Because after generating the email addresses, you will have to link the tJavaflex to a tMap so that when the job runs, the the email generated will be outputted and the tMap &amp;nbsp;will test if it has the right email pattern or not...anyways, Any kind of help would be gladly appreciated thank you and God Bless to all and here is the screenshot of the exercise below:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://community.talend.com/legacyfs/online/320525/Exercise13.jpg" target="_blank" rel="noopener"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MGox.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/158055i06FD5DBEF6C2B2AD/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MGox.jpg" alt="0683p000009MGox.jpg" /&gt;&lt;/span&gt; &lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2015 13:12:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Configure-a-tJavaFlex-to-generate-e-mail-addresses/m-p/2302016#M74050</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-10-19T13:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Configure a tJavaFlex to generate e-mail addresses</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Configure-a-tJavaFlex-to-generate-e-mail-addresses/m-p/2302017#M74051</link>
      <description>Oh I actually solved it!! Anyways...in how I generated the java code for the email address I might just as well document it in here for the sake of ALL THE BEGINNERS out there like me on how I solved the whole exercise...for the exercise task, there is a picture attached below: 
&lt;BR /&gt; 
&lt;BR /&gt;Step 1: Create a routine called "MyRoutines" that will validate email address. As for me, my routine looked like this: 
&lt;BR /&gt; 
&lt;BR /&gt;package routines; 
&lt;BR /&gt; 
&lt;BR /&gt;import org.apache.oro.text.regex.MalformedPatternException; 
&lt;BR /&gt;import org.apache.oro.text.regex.Pattern; 
&lt;BR /&gt;import org.apache.oro.text.regex.Perl5Compiler; 
&lt;BR /&gt;import org.apache.oro.text.regex.Perl5Matcher; 
&lt;BR /&gt; 
&lt;BR /&gt;public class MyRoutines { 
&lt;BR /&gt; 
&lt;BR /&gt;public static boolean isValidEmail(String email) { 
&lt;BR /&gt;Perl5Matcher matcher = new Perl5Matcher(); 
&lt;BR /&gt;Perl5Compiler compiler = new Perl5Compiler(); 
&lt;BR /&gt;Pattern pattern; 
&lt;BR /&gt; 
&lt;BR /&gt;try { 
&lt;BR /&gt;pattern = compiler.compile("^[\\w_.-]+@[\\w_.-]+\\.[\\w]+$"); 
&lt;BR /&gt;if(!matcher.matches(email, pattern)) { 
&lt;BR /&gt;return false; 
&lt;BR /&gt;} 
&lt;BR /&gt;} catch (MalformedPatternException e) { 
&lt;BR /&gt;throw new RuntimeException(e); 
&lt;BR /&gt;}&amp;nbsp; 
&lt;BR /&gt;return true; 
&lt;BR /&gt;} 
&lt;BR /&gt;}&amp;nbsp; 
&lt;BR /&gt; 
&lt;BR /&gt;this routine needs to have a jakarta-oro-2.0.8.jar in order for this to work, so just (Download jakarta-oro-2.0.8 &amp;gt; right-click My Routines &amp;gt; Edit Routine Libraries &amp;gt; New &amp;gt; Browse Library File &amp;gt; Select jakarta-oro-2.0.8&amp;nbsp;) 
&lt;BR /&gt; 
&lt;BR /&gt;Step 2: Create a Job, put tJavaflex, tMap and tLogrow 
&lt;BR /&gt; 
&lt;BR /&gt;Step 3: Configure tJavaflex to generate 3 email address: ("talend@talend.com", "test.talend.com", "support@talend.com") 
&lt;BR /&gt; 
&lt;BR /&gt;The code in the tJavaflex is actually very simple:&amp;nbsp; 
&lt;BR /&gt; 
&lt;BR /&gt;// start part of your Java code 
&lt;BR /&gt;String [] emailArray = {"training@talend.com", "test.talend.com", "support@talend.com"}; 
&lt;BR /&gt;for(int j=0;j&amp;lt;emailArray.length;j++) { 
&lt;BR /&gt; 
&lt;BR /&gt;//main 
&lt;BR /&gt;row1.mail = emailArray&amp;lt;J&amp;gt;; 
&lt;BR /&gt; 
&lt;BR /&gt;// end of the component, outside/closing the loop 
&lt;BR /&gt;} 
&lt;BR /&gt; 
&lt;BR /&gt;Step 4: In the edit schema button of the tJavaFlex component, create a column and name it "mail" and connect the tjavaflex to the tMap component and connect the tMap compnent to the tLogRow component(you can choose the output name) 
&lt;BR /&gt; 
&lt;BR /&gt;Step 5: Double click the tMap component and&amp;nbsp;drag the row1.mail to the output side of the tMap 
&lt;BR /&gt; 
&lt;BR /&gt;Step 6: In the output side, add another column and name it "test" and set its type to Boolean 
&lt;BR /&gt; 
&lt;BR /&gt;Step 7: In the output expression part of the tMap, just below the row1.mail(output) and right beside the "test" column put this expression ------&amp;gt;&amp;nbsp;MyRoutines.isValidEmail(row1.mail) ------&amp;gt; this will call the routine and will validate the email address generated by the tJavaflex 
&lt;BR /&gt; 
&lt;BR /&gt;Step 8: That's it your done and run the Job!! 
&lt;BR /&gt; 
&lt;BR /&gt;Thank you guys for bearing with me!! hahaha!! XD peace y'all!!!&amp;nbsp; 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;A href="https://community.talend.com/legacyfs/online/320525/tmapExercise13.jpg" target="_blank"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MGiu.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/128329iB9C6A98871F4692B/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MGiu.jpg" alt="0683p000009MGiu.jpg" /&gt;&lt;/span&gt; &lt;/A&gt; 
&lt;A href="https://community.talend.com/legacyfs/online/320525/Exercise13.jpg" target="_blank"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MGox.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/158055i06FD5DBEF6C2B2AD/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MGox.jpg" alt="0683p000009MGox.jpg" /&gt;&lt;/span&gt;&lt;/A&gt;</description>
      <pubDate>Tue, 20 Oct 2015 04:48:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Configure-a-tJavaFlex-to-generate-e-mail-addresses/m-p/2302017#M74051</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-10-20T04:48:40Z</dc:date>
    </item>
  </channel>
</rss>

