Creating a routine - Cloud

Talend Cloud Data Management Platform Studio User Guide

Version
Cloud
Language
English (United States)
Product
Talend Cloud
Module
Talend Management Console
Talend Studio
Content
Design and Development

In this procedure, create a user routine to execute the algorithm for password encryption.

Procedure

  1. In the Repository tree view, create a new routine MyRoutine.
  2. In the routine editor, add a function named decrypt and define the specify mechanism to decrypt the encryption string of the password.
    The code of the function reads as follows:
    public class MyRoutine {
        public static String decrypt(String encryptedPassword) {
            StringBuffer output = new StringBuffer();
            for (int i = 0; i < encryptedPassword.length(); i++) {
                char c = encryptedPassword.charAt(i);
                if (c >= 'a' && c <= 'm')
                    c += 13;
                else if (c >= 'A' && c <= 'M')
                    c += 13;
                else if (c >= 'n' && c <= 'z')
                    c -= 13;
                else if (c >= 'N' && c <= 'Z')
                    c -= 13;
                output.append(c);
            }
            return output.toString();
        }
    }
  3. When done, click Ctrl+S to save your routine.