Skip to main content

Posts

Showing posts from June, 2015

Encryption Decryption in java

In some use cases we require encryption and decryption of parameters. There are so many algorithm present for this implementation.  Java Encryption Algorithms When we are implementing the algorithm we need to consider our requirement and select the appropriate algorithm. In one of my use case i had one requirement to send some parameters after encryption and decrypt it wherever i am using those parameters. I used AES algorithm. You can use the same code in your application by creating a java file. import java.io.IOException; import java.nio.charset.Charset; import java.security.GeneralSecurityException; import java.util.regex.Pattern; import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; public class Encryption {    private static String key = "xyzBKabcccraSing";     public static void main(String[] args) {...

Exception Handling in ADF

Exception handling is one of the important aspect of any application. In below example i will explain how to handle exception/errors in adf taskflows with the help of taskflow-template. Create a generic taskflow-template which contains the exception handling logic may be a method(java code) or a page. Use the same taskflow-template when you are creating a taskflow. Whenever exception is thrown, taskflow-template will handle it. Below image show a method marked as exception handler in taskflow-template. It is nothing but one java code with some logic. Using this template create a taskflow as shown below. In this taskflow add 2 activities, one will be a page containing a button which will call processData method. This method throws an exception. Thrown exception will be handled in one method which is there in taskflow template. When exception is thrown you can see the below message. Java code handling exception : import j...