1 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 18 19 public class WSRPPortletAdapter implements WSRPPortlet { 20 21 private PortletKey portletKey = null; 22 private PortletContext portletContext = null; 23 private String 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 getParent() { 58 return this.parentHandle; 59 } 60 61 public void setParent(String portletHandle) { 62 this.parentHandle = portletHandle; 63 } 64 65 public boolean isConsumerConfigured() { 66 return !getParent().equals(portletKey.getPortletHandle()); 67 } 68 69 } | Popular Tags |