KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > organization > hibernate > UserProfileData


1 /***************************************************************************
2  * Copyright 2001-2003 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.hibernate;
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 SARL .
15  * Author : Tuan Nguyen
16  * tuan08@users.sourceforge.net
17  * Date: Jun 14, 2003
18  * Time: 1:12:22 PM
19  *
20  * @hibernate.class table="EXO_USER_PROFILE"
21  */

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

43   public String JavaDoc getUserName() { return userName ; }
44   public void setUserName(String JavaDoc s) { this.userName = s ; }
45
46   /**
47    * @hibernate.property length="65535" type="org.exoplatform.services.database.impl.TextClobType"
48    **/

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