1 16 17 package org.apache.jetspeed.om.profile; 18 19 import org.apache.jetspeed.portal.PortletSet; 20 import org.apache.jetspeed.services.PortalToolkit; 21 import org.apache.jetspeed.services.PsmlManager; 22 23 29 30 public class BaseProfile extends BaseProfileLocator implements Profile 31 { 32 33 protected PSMLDocument document = null; 34 35 public BaseProfile() 36 {} 37 38 public BaseProfile(ProfileLocator locator) 39 { 40 init(locator); 41 } 42 43 public void init(ProfileLocator locator) 44 { 45 this.setAnonymous(locator.getAnonymous()); 46 this.setCountry(locator.getCountry()); 47 this.setGroup(locator.getGroup()); 48 this.setLanguage(locator.getLanguage()); 49 this.setMediaType(locator.getMediaType()); 50 this.setName(locator.getName()); 51 this.setRole(locator.getRole()); 52 this.setUser(locator.getUser()); 53 } 54 55 59 public Object clone() throws java.lang.CloneNotSupportedException 60 { 61 Object cloned = super.clone(); 62 63 ((BaseProfile)cloned).document = ((this.document == null) ? null : (PSMLDocument) this.document.clone()); 65 66 return cloned; 67 } 68 69 74 public PortletSet getRootSet() 75 { 76 return PortalToolkit.getSet( getDocument().getPortlets() ); 77 } 78 79 84 public PSMLDocument getDocument() 85 { 86 synchronized (this) 87 { 88 if ((this.document == null) || (this.document.getPortlets() == null)) 89 { 90 this.document = PsmlManager.getDocument(this); 91 } 92 } 93 94 return this.document; 95 } 96 97 102 public void setDocument(PSMLDocument document) 103 { 104 this.document = document; 105 } 106 107 112 public void store() throws ProfileException 113 { 114 if (document != null) 115 { 116 PsmlManager.store(this); 117 } 118 } 119 120 123 public String toString() 124 { 125 return "BaseProfile["+ getId() + "]"; 134 } 135 136 137 } 138 | Popular Tags |