How to get the email Id of the logged user?

One Star

How to get the email Id of the logged user?

Hi all,
I'm working on Talend MDM. In my workflow I have to send email to the logged person.
I added email connector (on Ready status) to one step, activity type is Human. Whenever the user got the workflow in ready state an email should sent to his/her email id.
As Bonita Engine included in Talend MDM, I tried this task on Bonita by giving the following code:
import org.ow2.bonita.util.AccessorUtil
String to=AccessorUtil.getIdentityAPI().getUser(loggedUser).getEmail()
return to
This code successfully executed on Bonita but not on Talend MDM.
Is there any other way to get this task.
Please help me......

Thanks and regards,
Lalitha.
Six Stars

Re: How to get the email Id of the logged user?

The Talend job is executed on user's workstation or where? Better describe your scenarion, please....
Ladislav
One Star

Re: How to get the email Id of the logged user?

Hi Ladislav,
It is on developer's work station. Actually the task is we have 8 roles. When the users registered through the administrator, they need to give details like identifier, password,first name, last name, email id and roles assigned.
In my workflow I need to send email for every step when the workflow is in ready state in that particular step. For this I added email connector. In 'to' attribute of email connector I don't want to hard code the email id's. I would like to retrieve the email Id given by the users at registration time.
We can get the username by using 'loggedUser' variable. But I need that user's email Id. As I mentioned in my previous post I implemented the code in Bonita. It is working well on Bonita but I want it on Talend MDM. Please help me....

Thanks and Regards,
Lalitha.
Six Stars

Re: How to get the email Id of the logged user?

Hi,
Which version of Bonita do you use? when looking into Bonita User API documentation at:
http://www.jarvana.com/jarvana/view/org/ow2/bonita/bonita-client/5.3.1/bonita-client-5.3.1-javadoc.j...
In the org.ow2.bonita.facade.identity of client api version 5.3.1 package getEmail method is already deprecated, ContactInfo object is used instead.
At http://www.jarvana.com/jarvana/view/org/ow2/bonita/bonita-client/5.3/bonita-client-5.3-javadoc.jar!/...,
it seems to me, that also the getUser method is already deprecated, getUserByName or UUID schould be used instead.
From what I know until now about your issue, you schould check your bonita version running at your workstation (this includes also the user API) against the API which is used by Talend in ./lib folder
I use TOS 4.2.1 and my library versions are 5.2.3 for both bonita client and server.
Ladislav
One Star

Re: How to get the email Id of the logged user?

Hi,
Thanks for your reply....
Actually we are using a separate Bonita software and the version is 5.4.1.
And in talend the plug-ins we have Bonita of version 5.2.3.
We are getting the code on Bonita of version 5.4.1.
We will checkout the APIs that you provided in the links above.

Thanks and Regards,
Lalitha.
Six Stars

Re: How to get the email Id of the logged user?

Well, actually you schould refer to the version of bonita you have installed at workstation.
I am using TOS instead of the MDM product of Talend, but these 2 are similar and in TOS there are 2 bonita related components:
tBonitaDeploy
tBonitaInstantiateProcess
Maybe MDM has more Bonita related components, I don't now and don't want to download and install MDM right now :-) , but here is some proposal of approach how to "hack" the component in way to tell it how to use different library than delivered directly with with Talend product:
I will take for example tBonitaInstantiateProcess. In the Talend product folder you can find the component under ./plugins/org.talend.designer.components.localprovide_XversionoftalendX directory, where are located following files:
zangetsu@helios:/ip/talend/configuration$ ls -l /development/Talend/TOS-All-r60995-V4.2.1/plugins/org.talend.designer.components.localprovider_4.2.1.r60995/components/tBonitaInstantiateProcess
tBonitaInstantiateProcess_begin.javajet
tBonitaInstantiateProcess_messages_en.properties
tBonitaInstantiateProcess_end.javajet
tBonitaInstantiateProcess_messages_es.properties
tBonitaInstantiateProcess_icon32.png
tBonitaInstantiateProcess_messages_fr.properties
tBonitaInstantiateProcess_icon32_white.png
tBonitaInstantiateProcess_messages.properties
tBonitaInstantiateProcess_java.xml
tBonitaInstantiateProcess_messages_ru.properties
tBonitaInstantiateProcess_main.javajet

The tBonitaInstantiateProcess_java.xml file is one which can be easily customized to meet your needs. In my version of TOS 4.2.1 there is this:
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Bonita_Client" MODULE="bonita-client-5.2.3.jar" REQUIRED="true" />
<IMPORT NAME="Bonita_Server" MODULE="bonita-server-5.2.3.jar" REQUIRED="true" />

If I am in your position I would replace the definition to be the same as current Bonita system, so in your case it schould look like this:
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Bonita_Client" MODULE="bonita-client-5.4.1.jar" REQUIRED="true" />
<IMPORT NAME="Bonita_Server" MODULE="bonita-server-5.4.1.jar" REQUIRED="true" />

Both files are located already somewhere on the workstation installation or you can download these at:
http://code.google.com/p/processbase/downloads/list
You schould copy these files in MDM folder ./lib
There are many other imports of external libraries, but these 2 are you are interested in....
So, now Talend MDM component will use same version of bonita libraries as you are running. This approach might help, and I used this for example with components like tSambaPut, tSambaGet, tSambaList, etc. to include newest libraries for working with Windows shares.....but, there could be from my point of view also second issue, the implementation of library could change and you will have to change it also in respect to component. If this will be the case, you schould take a look into files *.javajet in the component directory. These files are source codes of the component. If you are not able to change this behavior by yourself, I would propose to report a bug at Talend bugtracker as new issue and describe this problem.
I already did successful project in Talend which is in UAT tests at our customer and everything is running well. I also discovered about 5 bugs in Talend components and always those were fixed by Talend in very short time. Of course you will not wait until they release the fix in future version, but from the bugtracker you will know that fixed version is already at Talend SVN server and you can download it by yourself weeks before it will be released in official way.
This is what I think could help you......
.....On the other hand, you can forget component based modeling and write Talend User Subroutine in pure Java and get the Emails by this code directly, altough this is not the "right" way how do things in Talend, but in some situations this is still the option, which I found "right" :-)
Regards,
Ladislav