OIM DBAT Connector - Groovy Script for User Create with return value
Hi,
We need to connect to an Oracle Database target system, using only stored procedures.
We already created the groovy scripts for this, but the stored procedures have return codes (error codes) that we need to link to our response codes.
Looking in the documentation, there is no example on how to do this. Does anyone knows how to do this?
Bellow there is an example of our groovy script (parameter 4 is the error code and 5 is the error description):
//import java.sql.PreparedStatement; import org.identityconnectors.framework.common.objects.*; import java.text.*; // START HERE System.out.println("[Create-Groovy] Attributes::"+attributes); //Get all the attributes from script argument String uid = attributes.get("__NAME__")!=null? attributes.get("__NAME__").getValue().get(0):null; String password=attributes.get("PASSWORD")!=null? attributes.get("PASSWORD").getValue().get(0):null; String displayName=attributes.get("DISPLAYNAME")!=null? attributes.get("DISPLAYNAME").getValue().get(0):null; //PreparedStatement createCall = null; try { //Initialize the prepare statement to insert the data into database table createCall = conn.prepareCall("{call UserCreate(?,?,?,?,?)}"); //Set the input parameters createCall.setString(1, uid); createCall.setString(2, password); createCall.setString(3, displayName); createCall.registerOutParameter(4, OracleTypes.VARCHAR); createCall.registerOutParameter(5, OracleTypes.VARCHAR); //Execute sql statement createCall.execute(); } finally { //close the sql statements if (createCall != null) createCall.close(); } System.out.println("[Create] Created User::"+uid); //Return Uid from the script return new Uid(uid);