01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.kuali.kfs.service;
17:
18: import java.io.Serializable;
19:
20: /**
21: * This is a stateful wrapper for Parameters, which provides convenient methods to evaluate a constrained value against a Parameter.
22: */
23: public interface ParameterEvaluator extends Serializable {
24: /**
25: * This method determines whether the constrainedValue specified when the ParameterEvaluator was created matches the parameter.
26: *
27: * @return boolean indicating whether the constrained value adheres to the restriction specified by the combination of the
28: * parameter constraint and the parameter value
29: */
30: public boolean evaluationSucceeds();
31:
32: /**
33: * This method uses the evaluateAndAddError method. It passes the constrainedPropertyName as both the constrainedPropertyName
34: * and the userEditablePropertyName, i.e. it should be used when they are one and the same.
35: *
36: * @param businessObjectOrDocumentClass
37: * @param constrainedPropertyName
38: * @return boolean indicating whether evaluation succeeded (see evaluationSucceeds)
39: */
40: public boolean evaluateAndAddError(
41: Class businessObjectOrDocumentClass,
42: String constrainedPropertyName);
43:
44: /**
45: * This method uses the evaluationSucceeds method to evaluate the constrainedValue. If evaluation does not succeed, it adds an
46: * error for the user. The businessObjectOrDocumentClass, nameOfConstrainedProperty and userEditablePropertyName are used by
47: * ParameterEvaluatorImpl to retrieve user friendly labels for the error message. The constrainedPropertyName corresponds to the
48: * field that has the value that the parameter is evaluating. The userEditablePropertyName corresponds to the field that has the
49: * value the user needs to correct to resolve the error. For example, the object type may be invalid, but the user needs to
50: * change the object code in order to remedy that.
51: *
52: * @param businessObjectOrDocumentClass
53: * @param userEditableFieldToHighlight
54: * @param nameOfconstrainedProperty
55: * @return boolean indicating whether evaluation succeeded (see evaluationSucceeds)
56: */
57: public boolean evaluateAndAddError(
58: Class businessObjectOrDocumentClass,
59: String constrainedPropertyName,
60: String userEditablePropertyName);
61:
62: /**
63: * This method determines whether the parameter lists allowed values or denied values.
64: *
65: * @return boolean indicating whether the parameter lists allowed values
66: */
67: public boolean constraintIsAllow();
68:
69: /**
70: * This method creates a pretty String representation of parameter values for the user messages.
71: *
72: * @return user-friendly String representation of Parameter values
73: */
74: public String getParameterValuesForMessage();
75:
76: /**
77: * This method returns the value of the correspnding Parameter.
78: *
79: * @return String value of underlying Parameter
80: */
81: public String getValue();
82:
83: public void setConstrainedValue(String constrainedValue);
84: }
|