1 16 package org.apache.cocoon.portal.tools; 17 18 import java.util.ArrayList ; 19 import java.util.Collection ; 20 import java.util.HashMap ; 21 import java.util.Iterator ; 22 import java.util.List ; 23 24 29 public class PortalTool { 30 31 protected final HashMap functions; 32 33 protected final String toolName; 34 protected final String toolId; 35 protected final ArrayList i18n; 36 37 44 public PortalTool(String toolName, String toolId, HashMap functions, ArrayList i18n) { 45 this.toolName = toolName; 46 this.toolId = toolId; 47 this.functions = functions; 48 this.i18n = i18n; 49 } 50 51 55 public Collection getFunctions() { 56 return functions.values(); 57 } 58 59 64 public PortalToolFunction getFunction(String id) { 65 return (PortalToolFunction) functions.get(id); 66 } 67 68 72 public Collection getInternalFunctions() { 73 ArrayList internal = new ArrayList (); 74 Collection funs = functions.values(); 75 for(Iterator it = funs.iterator(); it.hasNext(); ) { 76 PortalToolFunction ptf = (PortalToolFunction) it.next(); 77 if (ptf.isInternal()) { 78 internal.add(ptf); 79 } 80 } 81 return internal; 82 } 83 84 87 public Collection getPublicFunctions() { 88 ArrayList publik = new ArrayList (); 89 Collection funs = functions.values(); 90 for(Iterator it = funs.iterator(); it.hasNext(); ) { 91 PortalToolFunction ptf = (PortalToolFunction) it.next(); 92 if (!ptf.isInternal()) { 93 publik.add(ptf); 94 } 95 } 96 return publik; 97 } 98 99 103 public String getId() { 104 return toolId; 105 } 106 107 111 public String getName() { 112 return toolName; 113 } 114 115 118 public List getI18n() { 119 return i18n; 120 } 121 122 } 123 | Popular Tags |