The following is a sample groovy script for performing a delete provisioning operation.
Register the delete script as follows:
import java.sql.PreparedStatement;
import org.identityconnectors.framework.common.objects.*;
//Get the UID from the input map 'attributes'
String uid = attributes.get("__UID__").getValue().get(0);
System.out.println("[Delete-Groovy] Deleting user:: "+ uid);
try {
//Delete data from child tables and then, main table
//Delete user roles
st = conn.prepareStatement("DELETE FROM USER_ROLE WHERE USERID=?");
st.setString(1, uid);
st.executeUpdate();
st.close();
//Delete user groups
st = conn.prepareStatement("DELETE FROM USER_GROUP WHERE USERID=?");
st.setString(1, uid);
st.executeUpdate();
st.close();
//Delete user account
st = conn.prepareStatement("DELETE FROM USERINFO WHERE USERID=?");
st.setString(1, uid);
st.executeUpdate();
} finally {
if (st != null)
st.close(); };
System.out.println("Deleted user:: "+ uid);