KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > wsrp > consumer > adapters > WSRPPortletAdapter


1 /*
2 * Copyright 2001-2004 The eXo platform SARL All rights reserved.
3 * Please look at license.txt in info directory for more license detail.
4 */

5
6 package org.exoplatform.services.wsrp.consumer.adapters;
7
8 import org.exoplatform.services.wsrp.consumer.PortletKey;
9 import org.exoplatform.services.wsrp.consumer.WSRPPortlet;
10 import org.exoplatform.services.wsrp.type.PortletContext;
11
12 /*
13  * @author Mestrallet Benjamin
14  * benjmestrallet@users.sourceforge.net
15  * Date: 8 févr. 2004
16  * Time: 23:11:40
17  */

18
19 public class WSRPPortletAdapter implements WSRPPortlet {
20
21   private PortletKey portletKey = null;
22   private PortletContext portletContext = null;
23   private String JavaDoc parentHandle = null;
24
25   public WSRPPortletAdapter(PortletKey portletKey) {
26     this.portletKey = portletKey;
27     this.parentHandle = portletKey.getPortletHandle();
28   }
29
30   public PortletKey getPortletKey() {
31     return this.portletKey;
32   }
33
34   public void setPortletKey(PortletKey portletKey) {
35     if (portletKey != null) {
36       this.portletKey = portletKey;
37       if (this.portletContext != null) {
38         this.portletContext.setPortletHandle(portletKey.getPortletHandle());
39       }
40       if (parentHandle == null) {
41         parentHandle = portletKey.getPortletHandle();
42       }
43     }
44   }
45
46   public void setPortletContext(PortletContext portletContext) {
47     if (portletContext != null) {
48       this.portletContext = portletContext;
49       this.portletKey.setPortletHandle(portletContext.getPortletHandle());
50     }
51   }
52
53   public PortletContext getPortletContext() {
54     return this.portletContext;
55   }
56
57   public String JavaDoc getParent() {
58     return this.parentHandle;
59   }
60
61   public void setParent(String JavaDoc portletHandle) {
62     this.parentHandle = portletHandle;
63   }
64
65   public boolean isConsumerConfigured() {
66     return !getParent().equals(portletKey.getPortletHandle());
67   }
68
69 }
Popular Tags