cancel
Showing results for 
Search instead for 
Did you mean: 

updating UME Attributes through JAVA

Former Member
0 Kudos

Hi,

I have wrote some code and below is a section where I am trying to update a UME attribute, but it appears not to be working.

Has anyone done anything like this......

String [] val = new String[1];

try{

IUserAccountFactory accountFactory = UMFactory.getUserAccountFactory();

IUserAccount account = accountFactory.getUserAccountByLogonId(myuser);

IUserAccount mutableAccount = accountFactory.getMutableUserAccount(account.getUniqueID());

val[0] = "6";

mutableAccount.setAttribute("com.sap.security.core.usermanagement", "*attributename*", val);

mutableAccount.save();

mutableAccount.commit();

} catch (UMException e) {

response.write("<br>Problem: " + e.getLocalizedMessage());

}// End catch (UMException e).....

Attribute appears not to be set to any value, but can read the value from this attribute, so must be in the setAttribute that is missing.

Many thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Kai,

It depends of the datasource that your users belong to. E.g. If UME datasource is configured as LDAP and readonly

you will not managed to change this attribute.

Please check first your UME configuration.

Hope this help

Jakub Krecicki

Former Member
0 Kudos

Hi,

I have already checked the LDAP configuration to ensure its not read only.

The error log message appears to complain about the array, so it appears to be about my code.

Thanks

Former Member
0 Kudos

Hi,

Could You post your error log message ?

Best Regards

Jakub Krecicki

Former Member
0 Kudos

Hi,

I have checked the logs again and it appears as no error.

As I can read the attribute from the array, it appears that my save is not being stored.

If you have any examples, to see if my code is incorrect, that would be grateful and will award the points.

Thanks

Former Member
0 Kudos

Hi,

Just to let anyone know that I spotted where I was going wrong, so might help others....

Here is new code

String [] val = new String[1];

try{

IUserFactory userFact = UMFactory.getUserFactory();

IUserMaint user = userFact.getMutableUser(userFact.getUserByLogonID(myuser).getUniqueID());

val[0] = "6";

user.setAttribute("com.sap.security.core.usermanagement", "*attributename*", val);

user.save();

user.commit();

} catch (UMException e) {

response.write("

Problem: " + e.getLocalizedMessage());

}// End catch (UMException e).....

Thanks for all the help...

Edited by: Kai Chalker on Dec 20, 2007 4:46 PM

Former Member
0 Kudos

Done...