[Building Sakai] user properties

Nkululeko Phakela nonkululeko.phakela at wits.ac.za
Mon Mar 26 02:44:57 PDT 2012


Hi All,

I want to save some properties for a user when adding them onto the
system. This is because I would like to know which slot and degree code
each student belongs to. This information has been required when
displaying student information to the lecturer. 

try {
    preferencesEdit = preferencesService.edit(studentNumber);
} catch (Exception ex) {
    preferencesEdit = preferencesService.add(studentNumber);
}

ResourcePropertiesEdit props = preferencesEdit.getPropertiesEdit();
props.addProperty("degreeCode", currentCalCode);
props.addProperty("slot", slot);

preferencesService.commit(preferencesEdit);
ResourceProperties properties =
preferencesService.getPreferences(studentNumber).getProperties(studentNumber);


To save the user, I am doing this:
userDirectoryService.addUser(null, userId, givenName, surname, email,
null, type, properties); 


What am I missing because now when I try to retrieve the properties, I
am getting null values. I am retrieving the values by doing this: 

ResourceProperties rp = user.getProperties();
                      
String slot = rp.getProperty("slot");
String degreeCode = rp.getProperty("degreeCode");


Kind Regards,
-- 
Nkululeko Phakela 
Software Developer 
011 717 7167 
eLearning Support and Innovation (eLSI) 
Witwatersrand University 
Braamfontein, Johannesburg
<html><p><font face = "verdana" size = "0.8" color = "navy">This communication is intended for the addressee only. It is confidential. If you have received this communication in error, please notify us immediately and destroy the original message. You may not copy or disseminate this communication without the permission of the University. Only authorized signatories are competent to enter into agreements on behalf of the University and recipients are thus advised that the content of this message may not be legally binding on the University and may contain the personal views and opinions of the author, which are not necessarily the views and opinions of The University of the Witwatersrand, Johannesburg. All agreements between the University and outsiders are subject to South African Law unless the University agrees in writing to the contrary.</font></p></html>



More information about the sakai-dev mailing list