KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > portletcontainer > pci > ExoWindowID


1 package org.exoplatform.services.portletcontainer.pci;
2
3 import org.apache.commons.lang.StringUtils;
4
5 /**
6  * Created by the Exo Development team.
7  * Author : Mestrallet Benjamin
8  * benjamin.mestrallet@exoplatform.com
9  */

10 public class ExoWindowID implements WindowID {
11   final static public String JavaDoc DEFAULT_PORTAL_CONFIG = "default-portal-config" ;
12   final static public String JavaDoc MOBILE_PORTAL_CONFIG = "default-portal-config" ;
13   
14   private String JavaDoc owner;
15   private String JavaDoc portletApplicationName;
16   private String JavaDoc portletName;
17   private String JavaDoc uniqueID;
18   private String JavaDoc persistenceId ;
19   private String JavaDoc configurationSource = DEFAULT_PORTAL_CONFIG;
20
21   public ExoWindowID() {
22   }
23   
24   public ExoWindowID(String JavaDoc persistenceId) {
25     this.persistenceId = persistenceId ;
26         int idx = persistenceId.indexOf(":/");
27         owner = persistenceId.substring(0, idx);
28         persistenceId = persistenceId.substring(idx + 2, persistenceId.length());
29         String JavaDoc[] keys = StringUtils.split(persistenceId, "/");
30         portletApplicationName = keys[0];
31         portletName = keys[1];
32         uniqueID = keys[2];
33     }
34   
35   public String JavaDoc getOwner() {
36     return owner;
37   }
38
39   public void setOwner(String JavaDoc owner) {
40     this.owner = owner;
41   }
42
43   public String JavaDoc getPortletApplicationName() {
44     return portletApplicationName;
45   }
46
47   public void setPortletApplicationName(String JavaDoc portletApplicationName) {
48     this.portletApplicationName = portletApplicationName;
49   }
50
51   public String JavaDoc getPortletName() {
52     return portletName;
53   }
54
55   public void setPortletName(String JavaDoc portletName) {
56     this.portletName = portletName;
57   }
58
59   public String JavaDoc getUniqueID() {
60     return uniqueID;
61   }
62
63   public void setUniqueID(String JavaDoc uniqueID) {
64     this.uniqueID = uniqueID;
65   }
66
67   public String JavaDoc getPersistenceId() {
68     return this.persistenceId ;
69   }
70   
71   public void setPersistenceId(String JavaDoc id) {
72     persistenceId = id ;
73   }
74   
75   public String JavaDoc generatePersistenceId() {
76     return owner + ":/" + portletApplicationName + "/" + portletName + "/" + uniqueID ;
77   }
78   
79   public String JavaDoc generateKey() {
80     return uniqueID;
81   }
82   
83   /**
84    * The configuration source can be from default portal config layout, mobile portal
85    * config layout or page config
86    */

87   public String JavaDoc getConfigurationSource() { return configurationSource ; }
88   public void setConfigurationSource(String JavaDoc source) { configurationSource = source; }
89 }
Popular Tags