I was a little disappointed just now to discover that JTOpen's
com.ibm.as400.resource.Resource package has been deprecated.
I want to be able to list (in a generic manner) the attributes and values of
any resource, and in particular that of User Profiles. The following
deprecated technique nicely does the job and is (ironically for a deprecated
technique) upwardly compatible with future i5/OS releases because it's all
generic!
...
system = new AS400(system_name);
boolean error = true;
RUser resource = new RUser(system, user_name);
try {
// Get the attribute meta data.
ResourceMetaData[] attributeMetaData =
resource.getAttributeMetaData();
// Loop through all attributes and print the values.
for(int i = 0; i < attributeMetaData.length; ++i)
{
Object attributeID = attributeMetaData[i].getID();
Object value = resource.getAttributeValue(attributeID);
System.out.println("Attribute " + attributeID + " = " +
value);
}
} catch (ResourceException e) {
e.printStackTrace();
}
....
Unless I'm missing something, it seems to me that the suggested alternative
of (for user information)com.ibm.as400.access.UserList and
com.ibm.as400.access.User is less flexible because com.ibm.as400.access.User
requires the programmer to have knowledge of the property getters (one has
to program 'getDescroption()', 'getDirectoryEntry()', etc.)
Any thoughts anyone/someone who has been through this path already? Maybe
there is some alternative that I'm not aware of?
Thanks in advance
Chris Jewell
mailto:jewellcj@xxxxxxxxxxxx
As an Amazon Associate we earn from qualifying purchases.