KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > portal > impl > PageData


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.portal.impl;
6
7 import org.exoplatform.services.portal.model.*;
8 import com.thoughtworks.xstream.XStream;
9 /**
10  * Created by The eXo Platform SARL .
11  * Author : Tuan Nguyen
12  * tuan08@users.sourceforge.net
13  * Date: Jun 14, 2003
14  * Time: 1:12:22 PM
15  *
16  * @hibernate.class table="EXO_PAGE"
17  */

18 public class PageData extends PageDescriptionData {
19
20   transient private Page page_ ;
21
22   public PageData() { }
23
24   public PageData(Page page) throws Exception JavaDoc {
25     setPage(page) ;
26   }
27
28   public PageData(String JavaDoc xml) throws Exception JavaDoc {
29     setData(xml) ;
30   }
31
32   /**
33    * @hibernate.property length="65535" type="org.exoplatform.services.database.impl.TextClobType"
34    **/

35   public String JavaDoc getData() throws Exception JavaDoc {
36     XStream xstream = PortalConfigServiceImpl.getXStreamInstance() ;
37     String JavaDoc xml = xstream.toXML(page_) ;
38     return xml ;
39   }
40
41   public void setData(String JavaDoc s) throws Exception JavaDoc {
42     XStream xstream = PortalConfigServiceImpl.getXStreamInstance() ;
43     page_ = (Page)xstream.fromXML(s) ;
44     owner_ = page_.getOwner() ;
45     name_ = page_.getName() ;
46     title_ = page_.getTitle() ;
47     id_ = getId(page_);
48     viewPermission_ = page_.getViewPermission() ;
49     editPermission_ = page_.getEditPermission() ;
50   }
51   
52   public Page getPage() { return page_ ; }
53   public void setPage(Page obj) {
54     page_ = obj ;
55     owner_ = page_.getOwner() ;
56     name_ = page_.getName() ;
57     title_ = page_.getTitle() ;
58     id_ = getId(page_);
59     viewPermission_ = page_.getViewPermission() ;
60     editPermission_ = page_.getEditPermission() ;
61   }
62   
63   static public String JavaDoc getId(Page page) {
64     return page.getOwner() + ":" + page.getName() ;
65   }
66 }
Popular Tags