001: /*
002: * Copyright 2001-2006 C:1 Financial Services GmbH
003: *
004: * This software is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License Version 2.1, as published by the Free Software Foundation.
007: *
008: * This software is distributed in the hope that it will be useful,
009: * but WITHOUT ANY WARRANTY; without even the implied warranty of
010: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
011: * Lesser General Public License for more details.
012: *
013: * You should have received a copy of the GNU Lesser General Public
014: * License along with this library; if not, write to the Free Software
015: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
016: */
017:
018: package de.finix.contelligent.category;
019:
020: import java.util.Collection;
021: import java.util.Locale;
022: import java.util.Map;
023:
024: import de.finix.contelligent.CallData;
025: import de.finix.contelligent.ComponentPath;
026:
027: /**
028: * The <code>CategoryManager</code> is responsible for handling
029: * {@link Category categories}.
030: */
031: public interface CategoryManager {
032:
033: public final static String CATEGORY_TOKEN = "*";
034:
035: public final static char IDENTIFIER_SEPARATOR = ':';
036:
037: public final static String IDENTIFIER_SEPARATOR_STRING = ":";
038:
039: public final static String CHANNEL = "channel";
040:
041: public final static String HTML_CHANNEL = "html";
042:
043: public final static String SGML_CHANNEL = "sgml";
044:
045: public final static String XML_CHANNEL = "xml";
046:
047: public final static String DEFAULT_CHANNEL = HTML_CHANNEL;
048:
049: /**
050: * Returns a <code>String[]</code> containing the names of all currently
051: * registered categories.
052: *
053: * @return a <code>String[]</code> value
054: */
055: public String[] getCategoryNames();
056:
057: /**
058: * Returns an unmodifiable <code>Collection</code> containing all
059: * currently registered categories, so the collection contains
060: * {@link Category} instances only.
061: *
062: * @return a <code>Collection</code>
063: */
064: public Collection getCategories();
065:
066: /**
067: * Returns the {@link Category} with the given name or null if no such
068: * category is registered.
069: *
070: * @return a <code>Category</code> value, maybe null
071: */
072: public Category getCategory(String categoryName);
073:
074: public String createUniqueCategoryIdentifier(
075: Collection sensitiveCategories, Map categoryMap);
076:
077: public String createUniqueCategoryIdentifier(
078: Collection sensitiveCategories);
079:
080: public Map createCategoryMapForUniqueCategoryIdentifier(
081: Collection sensitiveCategories, String categoryIdentfier);
082:
083: public void completeCategoryToResourceMapping(
084: Collection sensitiveCategories, Map categoryToResourceMap);
085:
086: /**
087: * Returns true if the given name is a name of an existing category and the
088: * value is valid for this category.
089: *
090: * @param categoryName
091: * a <code>String</code> value
092: * @param categoryValue
093: * a <code>String</code> value
094: */
095: public boolean isValid(String categoryName, String categoryValue);
096:
097: /**
098: * Returns true if the given path contains a {@link #CATEGORY_TOKEN}.
099: */
100: public boolean containsCategory(ComponentPath path);
101:
102: /**
103: * If the given path {@link #containsCategory contains a category} the
104: * {@link #CATEGORY_TOKEN category-tokens} get replaced with their current
105: * values according to the given map.
106: *
107: * @exception CategoryException
108: * if the map does not contain a value for a category found
109: * in the path.
110: */
111: public ComponentPath expandCategories(ComponentPath path,
112: Map categoryMap) throws CategoryException;
113:
114: /**
115: * Returns the XML representation of the category with the specified name or
116: * null if the category is unknown.
117: */
118: public String categoryToXML(String categoryName);
119:
120: /**
121: * Returns a newly created category-map for the user specified in the
122: * session contained in the CallData object.
123: *
124: * @param callData
125: * a <code>CallData</code> value
126: * @return a <code>Map</code> value
127: * @exception de.finix.contelligent.category.CategoryException
128: * if an error occurs
129: */
130: public Map getCategoryMap(CallData callData, boolean sessionScope)
131: throws CategoryException;
132:
133: /**
134: * Select all entries from the map where the key is a valid category name.
135: *
136: * @param parameterMap
137: * @return
138: * @throws CategoryException
139: */
140: public Map getCategoryMap(Map parameterMap)
141: throws CategoryException;
142:
143: /**
144: * Returns a newly created category-map for the user specified in the
145: * session contained in the CallData object. If the given <code>Map</code>
146: * contains any key/value pairs where the key matches an existsing category
147: * the value is used as default for the category instead of the initially
148: * configured one.
149: *
150: * @param callData
151: * a <code>CallData</code> value
152: * @param baseMap
153: * a <code>Map</code> used a default value for categories which
154: * aren't defined for this user.
155: * @return a <code>Map</code> value
156: * @exception de.finix.contelligent.category.CategoryException
157: * if an error occurs
158: */
159: public Map getCategoryMap(CallData callData, Map baseMap,
160: boolean sessionScope) throws CategoryException;
161:
162: /**
163: * Returns map containing (String,String) entries where every key represents
164: * a valid category and the corresponding value is the default value of this
165: * category.
166: *
167: * @return a <code>Map</code> value
168: */
169: public Map getDefaultCategoryMap();
170:
171: public Map getSensitveCategoryCombinations(
172: Collection sensitiveCategories);
173:
174: public Locale getLocale(CallData callData);
175:
176: public String getChannel(CallData callData);
177:
178: }
|