I searched the archives and found some suggestions to use map, but I'm still not sure how to do it. I'm writing a small app that will copy an ldap object. Basically, read the current object, grab all the attirbutes, create a new object somewhere else using all the attributes.
So it would look something like this:
Attribute givenName = new BasicAttribute("givenName", firstName);
Attribute sn = new BasicAttribute("sn", lastName);
Attribute uid = new BasicAttribute("uid", username);
// Add these to the container
container.put(objClasses);
container.put(cn);
container.put(sn);
Since I'm reading all the attributes from an existing object, I don't know them before hand. So if I had an ArrayList of Strings where the first value is the attribute name, and the rest of the array had the values (because some could have more than one) how would I use this in the code?
This is not meant to be code, just showing where I want to use the values.
ArrayList is myValues
(this would be a loop until the end of myValues ArrayList)
Attribute [myValues.get(0)] = new BasicAttribute( [myValues.get(0)], [myValues.get(1)]);
Attribute [myValues.get(0)] = new BasicAttribute( [myValues.get(0)], [myValues.get(2)]);
container.put(myValues.get(0));
I hope that makes sense. How would I do this?
Thanks,
James