1 | package edu.iu.uis.sit.portal.portlet.attribute; |
2 | |
3 | import java.util.ArrayList; |
4 | import java.util.HashMap; |
5 | import java.util.List; |
6 | import java.util.Map; |
7 | |
8 | //TODO: Should probably become a spring service |
9 | |
10 | public class PortletAttributeManager { |
11 | |
12 | private static PortletAttributeManager instance; |
13 | private Map portletAttributes; |
14 | |
15 | private PortletAttributeManager() { |
16 | portletAttributes = new HashMap(); |
17 | } |
18 | |
19 | public static PortletAttributeManager getInstance() { |
20 | if (instance == null) { |
21 | instance = new PortletAttributeManager(); |
22 | } |
23 | return instance; |
24 | } |
25 | |
26 | public void setAttributes(String id, List portletAttributes) { |
27 | this.portletAttributes.put(id, new ArrayList(portletAttributes)); |
28 | } |
29 | |
30 | public List getAttributes(String id) { |
31 | return (List) portletAttributes.get(id); |
32 | } |
33 | |
34 | // TODO: Stick this call into the webapp context listener (init or destroy) |
35 | public void clear() { |
36 | portletAttributes.clear(); |
37 | } |
38 | |
39 | } |