1 5 package org.exoplatform.services.portal.impl; 6 7 import org.exoplatform.services.portal.model.*; 8 import com.thoughtworks.xstream.XStream; 9 18 public class PageData extends PageDescriptionData { 19 20 transient private Page page_ ; 21 22 public PageData() { } 23 24 public PageData(Page page) throws Exception { 25 setPage(page) ; 26 } 27 28 public PageData(String xml) throws Exception { 29 setData(xml) ; 30 } 31 32 35 public String getData() throws Exception { 36 XStream xstream = PortalConfigServiceImpl.getXStreamInstance() ; 37 String xml = xstream.toXML(page_) ; 38 return xml ; 39 } 40 41 public void setData(String s) throws Exception { 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 getId(Page page) { 64 return page.getOwner() + ":" + page.getName() ; 65 } 66 } | Popular Tags |