1 5 6 package org.exoplatform.portlets.wsrp; 7 8 9 import java.util.HashMap ; 10 import java.util.Iterator ; 11 import java.util.Map ; 12 import org.exoplatform.services.wsrp.consumer.GroupSessionMgr; 13 import org.exoplatform.services.wsrp.consumer.PortletSession; 14 15 21 22 public class GroupSessionImpl extends InitCookieImpl 23 implements GroupSessionMgr { 24 25 protected String groupID; 26 protected Map portletSessions = new HashMap (); 27 28 public GroupSessionImpl(String groupID, String markupURL) { 29 super(markupURL); 30 this.groupID = groupID; 31 } 32 33 public PortletSession getPortletSession(String portletHandle) { 34 if (portletHandle == null) { 35 return null; 36 } 37 PortletSession portletSession = (PortletSession) this.portletSessions.get(portletHandle); 38 if (portletSession == null) { 39 portletSession = new PortletSessionImpl(portletHandle); 40 addPortletSession(portletSession); 41 } 42 return portletSession; 43 } 44 45 public String getGroupID() { 46 return groupID; 47 } 48 49 public void setGroupID(String groupID) { 50 this.groupID = groupID; 51 } 52 53 public Iterator getAllPortletSessions() { 54 return portletSessions.values().iterator(); 55 } 56 57 public boolean existsPortletSession(String instanceKey) { 58 return portletSessions.containsKey(instanceKey); 59 } 60 61 public void addPortletSession(PortletSession portletSession) { 62 portletSessions.put(portletSession.getPortletHandle(), portletSession); 63 } 64 65 public void removePortletSession(String instanceKey) { 66 portletSessions.remove(instanceKey); 67 } 68 69 public void removeAllPortletSessions() { 70 portletSessions.clear(); 71 } 72 73 74 75 } | Popular Tags |