001: /*
002: * Copyright 2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.opensource.org/licenses/ecl1.php
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.kuali.kfs.service;
017:
018: import java.util.List;
019:
020: import org.kuali.core.bo.ParameterDetailType;
021:
022: /**
023: * This class provides methods to verify the existence of Parameters, get the value(s), and get ParameterEvaluators. For the most
024: * part, your code should be asking for a ParameterEvaluator and interacting with that. For optional parameters (ones that may not
025: * exist but should be processed if they do), you will want to use the parameterExists method before using other methods, since an
026: * exception will be thrown by the other methods if the referenced parameter does not exist. In some cases you may need to just pull
027: * the value(s) of a parameter via the getParameterValue(s) or getIndicatorParameter methods. All of the methods that you will want
028: * to use take a Class componentClass and String parameterName argument. Implementations of this class know how to translate these
029: * appropriately to retrieve Parameters and construct ParameterEvaluators.
030: */
031: public interface ParameterService {
032: /**
033: * This method provides an exception free way to ensure that a parameter exists.
034: *
035: * @param componentClass
036: * @param parameterName
037: * @return boolean indicating whether or not the parameter exists
038: */
039: public boolean parameterExists(Class componentClass,
040: String parameterName);
041:
042: /**
043: * This method provides a convenient way to access the a parameter that signifies true or false.
044: *
045: * @param componentClass
046: * @param parameterName
047: * @return boolean value of indicator parameter
048: */
049: public boolean getIndicatorParameter(Class componentClass,
050: String parameterName);
051:
052: /**
053: * This method returns the unprocessed text value of a parameter.
054: *
055: * @param componentClass
056: * @param parameterName
057: * @return unprocessed string value os a parameter
058: */
059: public String getParameterValue(Class componentClass,
060: String parameterName);
061:
062: /**
063: * This method can be used to derive a value based on another value.
064: *
065: * @param componentClass
066: * @param parameterName
067: * @param constrainingValue
068: * @return derived value
069: */
070: public String getParameterValue(Class componentClass,
071: String parameterName, String constrainingValue);
072:
073: /**
074: * This method can be used to parse the value of a parameter.
075: *
076: * @param componentClass
077: * @param parameterName
078: * @return parsed List of String parameter values
079: */
080: public List<String> getParameterValues(Class componentClass,
081: String parameterName);
082:
083: /**
084: * This method can be used to derive a set of values based on another value.
085: *
086: * @param componentClass
087: * @param parameterName
088: * @param constrainingValue
089: * @return derived values List<String>
090: */
091: public List<String> getParameterValues(Class componentClass,
092: String parameterName, String constrainingValue);
093:
094: /**
095: * This method will return an instance of a ParameterEvaluator implementation that will wrap a Parameter and provide convenient
096: * evaluation methods.
097: *
098: * @param componentClass
099: * @param parameterName
100: * @return ParameterEvaluator
101: */
102: public ParameterEvaluator getParameterEvaluator(
103: Class componentClass, String parameterName);
104:
105: /**
106: * This method will return an instance of a ParameterEvaluator implementation that will wrap a Parameter and constrainedValue
107: * and provide convenient evaluation methods.
108: *
109: * @param componentClass
110: * @param parameterName
111: * @return ParameterEvaluator
112: */
113: public ParameterEvaluator getParameterEvaluator(
114: Class componentClass, String parameterName,
115: String constrainedValue);
116:
117: /**
118: * This method will return an instance of a ParameterEvaluator implementation that will wrap a Parameter, constrainingValue, and
119: * constrainedValue and provide convenient evaluation methods.
120: *
121: * @param componentClass
122: * @param parameterName
123: * @return ParameterEvaluator
124: */
125: public ParameterEvaluator getParameterEvaluator(
126: Class componentClass, String parameterName,
127: String constrainingValue, String constrainedValue);
128:
129: /**
130: * This method will return an instance of a ParameterEvaluator implementation that will wrap an allow Parameter, a deny
131: * Parameter, constrainingValue, and constrainedValue and provide convenient evaluation methods.
132: *
133: * @param componentClass
134: * @param parameterName
135: * @return ParameterEvaluator
136: */
137: public ParameterEvaluator getParameterEvaluator(
138: Class componentClass, String allowParameterName,
139: String denyParameterName, String constrainingValue,
140: String constrainedValue);
141:
142: /**
143: * This method returns ParameterEvaluators initialized per public ParameterEvaluator getParameterEvaluator(Class componentClass,
144: * String parameterName, String constrainedValue)
145: *
146: * @param componentClass
147: * @param constrainedValue
148: * @return List<ParameterEvaluator> initialized per public ParameterEvaluator getParameterEvaluator(Class componentClass,
149: * String parameterName, String constrainedValue)
150: */
151: public List<ParameterEvaluator> getParameterEvaluators(
152: Class componentClass, String constrainedValue);
153:
154: /**
155: * This method returns ParameterEvaluators initialized per public ParameterEvaluator getParameterEvaluator(Class componentClass,
156: * String parameterName, String constrainingValue, String constrainedValue)
157: *
158: * @param componentClass
159: * @param constrainedValue
160: * @return List<ParameterEvaluator> initialized per public ParameterEvaluator getParameterEvaluator(Class componentClass,
161: * String parameterName, String constrainingValue, String constrainedValue)
162: */
163: public List<ParameterEvaluator> getParameterEvaluators(
164: Class componentClass, String constrainingValue,
165: String constrainedValue);
166:
167: /**
168: * This method can be used to supplement the list of ParameterDetailTypes defined in the database from other sources.
169: *
170: * @return List<ParameterDetailedType> containing the detailed types configured in non-database sources
171: */
172: public List<ParameterDetailType> getNonDatabaseDetailTypes();
173:
174: /**
175: * This method can be used to change the value of a Parameter for unit testing purposes.
176: *
177: * @param componentClass
178: * @param parameterName
179: * @param parameterText
180: */
181: public void setParameterForTesting(Class componentClass,
182: String parameterName, String parameterText);
183: }
|