1 5 package org.exoplatform.test.mocks.portlet; 6 7 import java.util.* ; 8 import javax.portlet.* ; 9 10 17 public class MockPortletSession implements PortletSession { 18 HashMap attributes_ ; 19 HashMap appAttributes_ ; 20 21 public MockPortletSession() { 22 super(); 23 attributes_ = new HashMap() ; 24 appAttributes_ = new HashMap() ; 25 } 26 27 public Object getAttribute(String name) { 28 return attributes_.get(name) ; 29 } 30 31 public Object getAttribute(String name, int scope) { 32 if (scope == PortletSession.APPLICATION_SCOPE) { 33 return appAttributes_.get(name) ; 34 } else { 35 return attributes_.get(name) ; 36 } 37 } 38 39 public void setAttribute(String name, Object obj) { 40 attributes_.put(name, obj) ; 41 } 42 43 public void setAttribute(String name, Object obj , int scope) { 44 if (scope == PortletSession.APPLICATION_SCOPE) { 45 appAttributes_.put(name, obj) ; 46 } else { 47 attributes_.put(name, obj) ; 48 } 49 } 50 51 public void removeAttribute(String name) { 52 attributes_.remove(name) ; 53 } 54 55 public void removeAttribute(String name, int scope) { 56 if (scope == PortletSession.APPLICATION_SCOPE) { 57 appAttributes_.remove(name) ; 58 } else { 59 attributes_.remove(name) ; 60 } 61 } 62 63 public java.util.Enumeration getAttributeNames() { 64 return null ; 65 } 66 67 public java.util.Enumeration getAttributeNames(int scope) { 68 return null ; 69 } 70 71 public long getCreationTime() { 72 return 0 ; 73 } 74 75 public java.lang.String getId() { 76 return new String (Integer.toString(this.hashCode())) ; 77 } 78 79 public long getLastAccessedTime() { 80 return 0 ; 81 } 82 83 public int getMaxInactiveInterval() { 84 return 0 ; 85 } 86 87 88 public void invalidate() {} 89 90 91 public boolean isNew() { 92 return false ; 93 } 94 95 public void setMaxInactiveInterval(int interval) { 96 97 } 98 99 100 public PortletContext getPortletContext () { 101 return null ; 102 } 103 104 } 105 | Popular Tags |