preprocessor JAR file

sandeepverma
New Contributor II
New Contributor II

Can I get a sample JAR file to understand the code writing?

I want to use preprocessor code in REST connector using modifyuserjson.

sandeepverma_0-1660668728847.png

 

5 REPLIES 5

Hi Rushikesh,

Thank you very much for your quick response.

Do you have any sample java code for preprocessor.

I want to understand how you have picked user variable from source(Success Factor) and compared it with Saviynt user.

I am using REST connector API. And I want to check duplicity based on firstname+lastname+DOB.

Thank you,

Sandeep

 

Spring maven code exist in below link 

https://saviynt.freshdesk.com/helpdesk/attachments/43201110065

rushikeshvartak_0-1660757120874.png

rushikeshvartak_1-1660757206134.png

 

sandeepverma
New Contributor II
New Contributor II

Hi Rushikesh,

Have you used the above-shared query during user import using REST connector (modifyuserJSON).

Because your provided document is directing to Third Party Access Governance - Validation Jars.

Thank you,

sahajranajee
Saviynt Employee
Saviynt Employee

Hi @sandeepverma ,

I am providing a sample User Import Preprocessor code which removes accents/diacritics from firstname and lastname in the import feed :

 

package com.saviynt.pps.preprocessor;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.text.Normalizer;
import java.util.Map;


public class dataNormalizer {
    public void removeAccents(Connection connection, Map tempTableNamesMap) throws Exception {
        System.out.println("--------------------------------------------------------------------");
        System.out.println("Preprocessing Logic initiated!");
        System.out.println("Connection=" + connection.toString());
        System.out.println("Temp Table Names Map= " + tempTableNamesMap.toString());
        String metaDataQuery="select firstname,lastname,username from "+ tempTableNamesMap.get("NEWUSERDATA");
        //String existingUsernames="select username from "+ tempTableNamesMap.get("CURRENTUSERS");
        ResultSet rs1,rs2;
        CallableStatement cstmt=null;
        try{

            Statement statement=connection.createStatement();
            rs1=statement.executeQuery(metaDataQuery);
            while(rs1.next()){
                System.out.println("Normalising Accents for:"+rs1.getString(3));
                String firstname= Normalizer.normalize(rs1.getString(1), Normalizer.Form.NFD).replaceAll("\\p{M}", "");
                String lastname=Normalizer.normalize(rs1.getString(2), Normalizer.Form.NFD).replaceAll("\\p{M}", "");
                String username=Normalizer.normalize(rs1.getString(3), Normalizer.Form.NFD).replaceAll("\\p{M}", "");
                String updateQry="UPDATE " + tempTableNamesMap.get("NEWUSERDATA") + " SET firstname = '" +firstname+ "', lastname='" +lastname+ "' where username='"+username+"'";
                cstmt=connection.prepareCall(updateQry);
                cstmt.execute();
                if (!connection.getAutoCommit()) {
                    connection.commit();
                }
            }
            System.out.println("Preprocessor Logic Ending!");
        }
        catch (Exception e){
            System.out.println("Exception Occurred: "+e);
        }
    }
}

 

 Documentation : https://saviynt.freshdesk.com/support/solutions/articles/43000571860-normalizing-the-identity-data-u...


Regards,
Sahaj Ranajee
Sr. Product Specialist