01: /*
02: * Copyright 2005 Sun Microsystems, Inc. All
03: * rights reserved. Use of this product is subject
04: * to license terms. Federal Acquisitions:
05: * Commercial Software -- Government Users
06: * Subject to Standard License Terms and
07: * Conditions.
08: *
09: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
10: * are trademarks or registered trademarks of Sun Microsystems,
11: * Inc. in the United States and other countries.
12: */
13:
14: package com.sun.portal.wsrp.common.registry.ebxml;
15:
16: import java.util.HashMap;
17: import java.util.Set;
18: import java.util.List;
19: import java.util.HashSet;
20: import java.util.Iterator;
21: import java.util.Map;
22:
23: public class TypeConverter {
24: public static final char TAB = '\t';
25:
26: public static Set convertProducerToBasic(List producers) {
27: Set returntype = new HashSet(producers.size());
28: Iterator it = producers.iterator();
29: WSRPProducerImpl producer = null;
30: Map record = null;
31: while (it.hasNext()) {
32: producer = (WSRPProducerImpl) it.next();
33: record = new HashMap();
34: record.put("producer.key", producer.getKey());
35: record.put("producer.name", producer.getName());
36: record.put("producer.description", producer
37: .getDescription());
38: record.put("producer.urls", producer.getProducerURL()
39: .toString());
40: returntype.add(record);
41: }
42: return returntype;
43: }
44:
45: public static Set convertPortletToBasic(List portlets) {
46: Set returntype = new HashSet(portlets.size());
47: Iterator it = portlets.iterator();
48: WSRPPortletImpl portlet = null;
49: Map record = null;
50: while (it.hasNext()) {
51: portlet = (WSRPPortletImpl) it.next();
52: record = new HashMap();
53: record.put("portlet.key", portlet.getKey());
54: record.put("portlet.name", portlet.getName());
55: record.put("portlet.description", portlet.getDescription());
56: record.put("portlet.producer.urls", portlet
57: .getProducerURL().toString());
58: returntype.add(record);
59: }
60: return returntype;
61: }
62:
63: public static Set convertOrgToBasic(List orgs) {
64: Set returntype = new HashSet(orgs.size());
65: Iterator it = orgs.iterator();
66: WSRPOrganizationImpl org = null;
67: Map record = null;
68: while (it.hasNext()) {
69: org = (WSRPOrganizationImpl) it.next();
70: record = new HashMap();
71: record.put("organization.key", org.getKey());
72: record.put("organization.name", org.getName());
73: record
74: .put("organization.description", org
75: .getDescription());
76: //TODO : Add organization Contact details
77: returntype.add(record);
78: }
79: return returntype;
80: }
81: }
|