KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > organization > ldap > UserProfileLDAPData


1 /***************************************************************************
2  * Copyright 2001-2004 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.services.organization.ldap;
6
7 import org.exoplatform.services.organization.impl.UserProfileImpl;
8
9 import com.thoughtworks.xstream.XStream;
10 import com.thoughtworks.xstream.io.xml.XppDriver;
11
12
13 /**
14  * Created by the eXo platform team
15  * User: Daniel Summer
16  * Date: 28 august 2004
17  *
18  */

19 public class UserProfileLDAPData {
20     static transient private XStream xstream_ ;
21     
22   private String JavaDoc userName ;
23   private String JavaDoc profile ;
24
25   public UserProfileLDAPData() {
26   }
27   
28   public UserProfileLDAPData(String JavaDoc userName) {
29     StringBuffer JavaDoc b = new StringBuffer JavaDoc() ;
30     b.append("<user-profile>\n").
31       append(" <userName>").append(userName).append("</userName>\n");
32     b.append("</user-profile>\n");
33     this.userName = userName ;
34     this.profile = b.toString() ;
35   }
36
37   /**
38    * @hibernate.id generator-class="assigned"
39    **/

40   public String JavaDoc getUserName() { return userName ; }
41   public void setUserName(String JavaDoc s) { this.userName = s ; }
42
43   /**
44    * @hibernate.property
45    **/

46   public String JavaDoc getProfile() { return profile ; }
47   public void setProfile(String JavaDoc s) { profile = s; }
48
49   public org.exoplatform.services.organization.UserProfile getUserProfile() {
50     XStream xstream = getXStream() ;
51     UserProfileImpl up = (UserProfileImpl)xstream.fromXML(profile) ;
52     return up ;
53   }
54
55   public void setUserProfile(org.exoplatform.services.organization.UserProfile up) {
56     UserProfileImpl impl = (UserProfileImpl) up ;
57     userName = up.getUserName() ;
58     XStream xstream = getXStream() ;
59     profile = xstream.toXML(impl) ;
60   }
61   
62   static private XStream getXStream() {
63     if (xstream_ == null) {
64         xstream_ = new XStream(new XppDriver());
65       xstream_.alias("user-profile", UserProfileImpl.class);
66     }
67     return xstream_ ;
68   }
69 }
Popular Tags