Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Java method call to encrypt data field (type is string)
SrinivasaRao
Hi,
I have a java method which will encrypt the given string. Please refer below
public static String encrypt(String stringToEncrypt) throws Exception
{
//Here it will do some encrypt operation
return encryptedHexString;
}
i need to call this method for each detail row in my birt report.
Ex:- I should display the employee no is in encrypted
Now i am in confusion how to call the above method on create of datafield.
Can anybody please help me. I have very urgent requirement to do this.
Any help would be mostly appreciated.
FYI: i am using birt 2.5.1
Thanks,
Srinivas
Find more posts tagged with
Comments
johnw
There are actually a couple of ways to do this.
I am assuming you have a JAR file with this method. In which caase, you put this JAR file in your classpath, then you call it with using the Packages.<packageName>.encrypt(String) method. So, lets say your class is called EncyptClass, in pacakge. com.birt.encrypt. You would call it in your expression like so:
////////////////////////////////////////////////////////////
var encrypt = new Packages.com.birt.encrypt.EncryptClass();
var returnstring = encrypt.encrypt(row["employeeNumber"]);
returnstring;
////////////////////////////////////////////////////////////
Another way you can do this is to create a BIRT user function extenstion plugin. Then, when you run BIRT, this method will appear in the Javascript functions at the bottom of the Expression Editor, just like the BIRTComp, date, and Javascript functions do.
John
SrinivasaRao
Hi,
Thanks a lot for your reply.
I have created a BIRT user function extension plugin and its showing the function for encrypt and its working fine in report designer.
But, its not working when i run the WebViewerExample in tomcat even i copied the jar file in plugins folder WebViewerExample.
Kindly let me know whats the steps i need to take to run the report in WebViewerExample also because i need to show in tomcat.
Any help would be mostly appreciated.
Thanks,
Srinivas.T
SrinivasaRao
Please look in to the attachment, i am getting this exception while deploying
johnw
Hmmmm. The process I always use is I open my Manifest.MF file in Eclipse, and I use the Export Plugins wizard from there. The resulting JAR that is created never seems to have any problems. just make sure it is copied into the plugins folder, which you seem to have covered already. Tomcat might require a restart for that.<br />
<br />
John<br />
<br />
<blockquote class='ipsBlockquote' data-author="'rishwanth'" data-cid="66691" data-time="1279901902" data-date="23 July 2010 - 09:18 AM"><p>
Hi,<br />
<br />
Thanks a lot for your reply.<br />
<br />
I have created a BIRT user function extension plugin and its showing the function for encrypt and its working fine in report designer.<br />
<br />
But, its not working when i run the WebViewerExample in tomcat even i copied the jar file in plugins folder WebViewerExample.<br />
<br />
Kindly let me know whats the steps i need to take to run the report in WebViewerExample also because i need to show in tomcat.<br />
<br />
Any help would be mostly appreciated.<br />
<br />
Thanks,<br />
Srinivas.T<br /></p></blockquote>
SrinivasaRao
Hi Johnw,
Yes this is the problem with Manifest.MF file. Now i resolved the problem ( i am using same Manifest.MF file).
It's working fine for me know.
Thanks a lot for your help.
Srinivas.T