[Building Sakai] Clarification on using UserDirectoryService Object
Steve Swinsburg
steve.swinsburg at gmail.com
Tue Feb 1 05:14:00 PST 2011
Hi,
Are you getting a NPE? If so, you'll need to inject the UserDirectoryService API into your class, via Spring, or via the ComponentManager. Simply importing it is insufficient since it is in a different classloader to your tool.
See: https://confluence.sakaiproject.org/display/BOOT/Using+the+UserDirectoryService
cheers,
Steve
On 01/02/2011, at 11:55 PM, Gautham wrote:
>
>
> Hi Steve,
>
> As suggested, we created a new tool for Self Certification. I am trying to
> get the user details by importing UserDirectoryService Object. It is not
> fetching the details. Is there anything I am missing here?
>
> CODE:
>
> public String getUserType() {
> String userId = (String)externalLogic.getCurrentUserId();
> String type="";
> try{
> user = userService.getUser(userId);
> type = user.getType();
> }
> catch(org.sakaiproject.user.api.UserNotDefinedException unde)
> {
> System.out.println(unde.getMessage());
> }
> catch(Exception e)
> {
> type = "Type NA";
> System.out.println(e.getMessage());
> }
> return(type);
> }
>
>
> Regards,
> Gautham
> --
> View this message in context: http://old.nabble.com/Clarification-on-using-UserDirectoryService-Object-tp30815901p30815901.html
> Sent from the Sakai - Development mailing list archive at Nabble.com.
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
More information about the sakai-dev
mailing list