Hello,
I am trying to create a DB2 JDBC Connector to perform some attribute syncs. I’ve been trying to utilize the following code to ensure I am passing the EEID correctly for the requests it is iterating through. I did some research and found that setting the attribute to the nativeIdentity should return the EEID, However, after reviewing the trace in DB2, it looks like its sending the NETID instead (this maps to SearchSam).
import java.sql.Types;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.Date;
import java.sql.Decimal;
import sailpoint.object.ProvisioningPlan;
import sailpoint.object.ProvisioningPlan.AccountRequest;
import sailpoint.object.ProvisioningPlan.AttributeRequest;
import sailpoint.object.ProvisioningResult;
import sailpoint.tools.Util;
// Get a string value from an attribute request object
public String getAttributeRequestValue(AccountRequest acctReq, String attribute) {
String val = null;
if ( acctReq != null ) {
AttributeRequest attrReq = acctReq.getAttributeRequest(attribute);
if ( attrReq != null && attrReq.getValue() instanceof String ) {
val = attrReq.getValue();
}
}
log.debug(attribute + \" = \" + val);
return val;
}
// Start of iSeries Provision rule
log.debug(\"Enter iSeries JDBC Provisioning\");
ProvisioningResult result = new ProvisioningResult();
CallableStatement cStatement = null;
// Check if plan is null
if ( plan instanceof ProvisioningPlan ) {
// Get all account requests from plan
List accounts = plan.getAccountRequests();
// If the plan contains one or more account requests, we'll iterate through them
if ((accounts != null) && (accounts.size() > 0)) {
for (AccountRequest account : accounts) {
String nativeId = (String) account.getNativeIdentity();
log.debug(\"native identity: \" + nativeId);
log.debug(\"application: \" + account.getApplicationName());
log.debug(\"operation: \" + account.getOperation());
try {
// CREATE procedure
if ( AccountRequest.Operation.Create == account.getOperation() ) {
log.debug(\"Entering Create Operation\");
cStatement = connection.prepareCall(\"CALL OBJECT.EX850SP (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\");
// Add attributes from account create profile
log.debug(\"setting value for index 1\");
cStatement.setString(1, getAttributeRequestValue(account, \"CUSTS\")); //employment status code
log.debug(\"setting value for index 2\");
cStatement.setString(2, getAttributeRequestValue(account, \"CUETYP\")); //employee type code
log.debug(\"setting value for index 3\");
cStatement.setString(3, getAttributeRequestValue(account, \"CULOCN\")); //location code
log.debug(\"setting value for index 4\");
cStatement.setString(4, getAttributeRequestValue(account, \"CUEMAD\")); //work email
log.debug(\"setting value for index 5\");
cStatement.setString(5, getAttributeRequestValue(account, \"CUEMPL\")); //company code
log.debug(\"setting value for index 6\");
cStatement.setString(6, getAttributeRequestValue(account, \"CUFNAM\")); //legal first name
log.debug(\"setting value for index 7\");
cStatement.setString(7, getAttributeRequestValue(account, \"CULNAM\")); //last name
log.debug(\"setting value for index 8\");
cStatement.setString(8, getAttributeRequestValue(account, \"CUSPRV\")); //manager name
log.debug(\"setting value for index 9\");
cStatement.setString(9, nativeId); //search sam upper (CUNETU)
log.debug(\"setting value for index 10\");
cStatement.setString(10, getAttributeRequestValue(account, \"CUDPDS\")); //department description
log.debug(\"setting value for index 11\");
cStatement.setString(11, getAttributeRequestValue(account, \"CUJBDS\")); //job title
log.debug(\"setting value for index 12\");
cStatement.setString(12, getAttributeRequestValue(account, \"CULEAD\")); //employee management level
log.debug(\"setting value for index 13\");
cStatement.setString(13, getAttributeRequestValue(account, \"CUODCD\")); //org level 1 code
log.debug(\"setting value for index 14\");
if ( getAttributeRequestValue(account, \"CUEXDT\") != null ) {
log.debug(\"setting CUEXDT to \" + Util.atoi(getAttributeRequestValue(account, \"CUEXDT\")));
cStatement.setInt(14, Util.atoi(getAttributeRequestValue(account, \"CUEXDT\"))); //iSeries term date
} else {
log.debug(\"setting CUEXDT to 0\");
cStatement.setInt(14, 0);
}
log.debug(\"setting value for index 15\");
cStatement.setString(15, getAttributeRequestValue(account, \"CULUDT\")); //iSeries update date
log.debug(\"setting value for index 16\");
cStatement.setString(16, getAttributeRequestValue(account, \"CULUBY\")); //service user
log.debug(\"setting value for index 17\");
cStatement.setString(17, (String) account.getNativeIdentity()); //employee id
//cStatement.setString(17, identityNumber); //employee id
//Statement.setString(17, getAttributeRequestValue(account, \"CUEEID\")); //employee id
log.debug(\"setting value for index 18\");
cStatement.setString(18, getAttributeRequestValue(account, \"CUROLE\")); //role
log.debug(\"EX850SP full statement: \" + cStatement.toString());
cStatement.executeUpdate();
// Successful Create, so mark result as COMMITTED
log.debug(\"Create Account Execution successfully completed\");
result.setStatus(ProvisioningResult.STATUS_COMMITTED);
log.debug(\"Exiting Create Operation\");
} else if ( AccountRequest.Operation.Modify == account.getOperation() ) {
log.debug(\"Entering Modify Operation\");
cStatement = connection.prepareCall(\"CALL OBJECT.EX850SP (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\");
// Add attributes from account modify profile
log.debug(\"setting value for index 1\");
cStatement.setString(1, getAttributeRequestValue(account, \"CUSTS\")); //employment status code
log.debug(\"setting value for index 2\");
cStatement.setString(2, getAttributeRequestValue(account, \"CUETYP\")); //employee type code
log.debug(\"setting value for index 3\");
cStatement.setString(3, getAttributeRequestValue(account, \"CULOCN\")); //location code
log.debug(\"setting value for index 4\");
cStatement.setString(4, getAttributeRequestValue(account, \"CUEMAD\")); //work email
log.debug(\"setting value for index 5\");
cStatement.setString(5, getAttributeRequestValue(account, \"CUEMPL\")); //company code
log.debug(\"setting value for index 6\");
cStatement.setString(6, getAttributeRequestValue(account, \"CUFNAM\")); //legal first name
log.debug(\"setting value for index 7\");
cStatement.setString(7, getAttributeRequestValue(account, \"CULNAM\")); //last name
log.debug(\"setting value for index 8\");
cStatement.setString(8, getAttributeRequestValue(account, \"CUSPRV\")); //manager netid
log.debug(\"setting value for index 9\");
cStatement.setString(9, nativeId); //search sam upper (CUNETU)
log.debug(\"setting value for index 10\");
String cudpds = getAttributeRequestValue(account, \"CUDPDS\");
if ( cudpds != null && cudpds.length() > 30 )
cStatement.setString(10, cudpds.substring(0,30)); // department description
else
cStatement.setString(10, cudpds); //none
log.debug(\"setting value for index 11\");
cStatement.setString(11, getAttributeRequestValue(account, \"CUJBDS\")); //job title
log.debug(\"setting value for index 12\");
cStatement.setString(12, getAttributeRequestValue(account, \"CULEAD\")); //employee management level
log.debug(\"setting value for index 13\");
cStatement.setString(13, getAttributeRequestValue(account, \"CUODCD\")); //org level 1 code
log.debug(\"setting value for index 14\");
if ( getAttributeRequestValue(account, \"CUEXDT\") != null )
cStatement.setInt(14, Util.atoi(getAttributeRequestValue(account, \"CUEXDT\"))); //iSeries term date
else
cStatement.setInt(14, 0);
log.debug(\"setting value for index 15\");
cStatement.setString(15, getAttributeRequestValue(account, \"CULUDT\")); // iSeries update date
log.debug(\"setting value for index 16\");
cStatement.setString(16, getAttributeRequestValue(account, \"CULUBY\")); //service user
log.debug(\"setting value for index 17\");
//cStatement.setString(17, identityNumber); //employee id
cStatement.setString(17, (String) account.getNativeIdentity()); //employee id
log.debug(\"setting value for index 18\");
cStatement.setString(18, getAttributeRequestValue(account, \"CUROLE\")); //role
log.debug(\"EX851SP full statement: \" + cStatement.toString());
cStatement.executeUpdate();
// Successful Modify, so mark result as COMMITTED
log.debug(\"Modify Account Execution successfully completed\");
result.setStatus(ProvisioningResult.STATUS_COMMITTED);
log.debug(\"Exiting Modify Operation\");
}
} catch(Exception e) {
result.setStatus(ProvisioningResult.STATUS_FAILED);
result.addError(e);
log.error(\"iSeries JDBC Provisioning SQL Error: \" + e.getMessage());
} finally {
if(cStatement != null) {
cStatement.close();
}
}
}
}
}
log.debug(\"Exit iSeries JDBC Provisioning\");
return result;