01: /* Copyright 2004 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal.container.om.portlet;
07:
08: import java.io.Serializable;
09: import java.util.HashMap;
10: import java.util.Iterator;
11: import java.util.Map;
12:
13: import javax.portlet.PortletMode;
14:
15: import org.apache.pluto.om.portlet.ContentType;
16: import org.apache.pluto.om.portlet.ContentTypeSet;
17:
18: /**
19: * Implementation of Apache Pluto object model.
20: * @author Ken Weiner, kweiner@unicon.net
21: * @version $Revision: 34757 $
22: */
23: public class ContentTypeSetImpl implements ContentTypeSet, Serializable {
24:
25: private Map contentTypes = null;
26:
27: public ContentTypeSetImpl() {
28: contentTypes = new HashMap();
29: }
30:
31: public Iterator iterator() {
32: return contentTypes.values().iterator();
33: }
34:
35: public ContentType get(String contentType) {
36: return (ContentType) contentTypes.get(contentType);
37: }
38:
39: public boolean supportsPortletMode(PortletMode portletMode) {
40: boolean supportsPortletMode = false;
41: Iterator iter = this .iterator();
42: while (iter.hasNext()) {
43: ContentType contentType = (ContentType) iter.next();
44: if (contentType.supportsPortletMode(portletMode)) {
45: supportsPortletMode = true;
46: break;
47: }
48: }
49: return supportsPortletMode;
50: }
51:
52: // Additional methods
53:
54: public void add(ContentType contentType) {
55: contentTypes.put(contentType.getContentType(), contentType);
56: }
57: }
|