ramesh kopparapu
2017-06-11 21:28:34 UTC
Hi,
This is in ISIM.
I've a file with orphan ids and corresponding UserIDs
The logic is to find OrphanID DN and add a new attribute called owner and set UserId Dn to the owner.
I've retreived OwnerDN but the problem is there are multiple Orphans with same IDs. So I've collected them into array of DNs
Now, How to update them with OwnerID??
My flow is as follows
Feed -> ReadMappings (CSV)
Data Flow -> OwnerLookup (LDAP Lookup to fetch the Owners DN)
-> OrphanLookup (LDAP Lookup to fetch the Orphan's DN)
Following is the snippet for multiple Entries hook.
(I'm trying to update it in the same hook. But the issue is there's no owner attribute to update, it needs to be added)
// Get all the multiple entries and store them in an array
//var ldapconn = UpdateOwner.getConnector();
dn_arr = [];
var thisEntry = thisConnector.getFirstDuplicateEntry();
while (thisEntry != null)
{
//task.logmsg(thisEntry.getAttribute("$dn"));
dn_arr.push(thisEntry.getAttribute("$dn"));
thisEntry = thisConnector.getNextDuplicateEntry();
}
work.setAttribute("dnarray",dn_arr);
for (i in dn_arr )
{
//thisEntry.add
var theCriteria = new com.ibm.di.server.SearchCriteria("$dn",61,"dn="+dn_arr[i]);
//ldapconn.addAttributeValue()
try {
thisConnector.getConnector().modEntry(work,theCriteria);
task.logmsg("Entry Updated "+ dn_arr[i]);
}
catch (Ex)
{
task.logmsg("Error updating this entry");
task.logmsg("ERROR : "+ Ex.getMessage());
task.dumpEntry(work);
}
}
Please let your suggestions flow.
Thanks.
This is in ISIM.
I've a file with orphan ids and corresponding UserIDs
The logic is to find OrphanID DN and add a new attribute called owner and set UserId Dn to the owner.
I've retreived OwnerDN but the problem is there are multiple Orphans with same IDs. So I've collected them into array of DNs
Now, How to update them with OwnerID??
My flow is as follows
Feed -> ReadMappings (CSV)
Data Flow -> OwnerLookup (LDAP Lookup to fetch the Owners DN)
-> OrphanLookup (LDAP Lookup to fetch the Orphan's DN)
Following is the snippet for multiple Entries hook.
(I'm trying to update it in the same hook. But the issue is there's no owner attribute to update, it needs to be added)
// Get all the multiple entries and store them in an array
//var ldapconn = UpdateOwner.getConnector();
dn_arr = [];
var thisEntry = thisConnector.getFirstDuplicateEntry();
while (thisEntry != null)
{
//task.logmsg(thisEntry.getAttribute("$dn"));
dn_arr.push(thisEntry.getAttribute("$dn"));
thisEntry = thisConnector.getNextDuplicateEntry();
}
work.setAttribute("dnarray",dn_arr);
for (i in dn_arr )
{
//thisEntry.add
var theCriteria = new com.ibm.di.server.SearchCriteria("$dn",61,"dn="+dn_arr[i]);
//ldapconn.addAttributeValue()
try {
thisConnector.getConnector().modEntry(work,theCriteria);
task.logmsg("Entry Updated "+ dn_arr[i]);
}
catch (Ex)
{
task.logmsg("Error updating this entry");
task.logmsg("ERROR : "+ Ex.getMessage());
task.dumpEntry(work);
}
}
Please let your suggestions flow.
Thanks.