View Javadoc

1   /*
2    * Copyright 2007-2009 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
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.rice.kns.service.impl;
17  
18  import org.kuali.rice.kns.service.ParameterEvaluator;
19  
20  /**
21   * This implementation of ParameterEvaluator is returned by ParameterServiceImpl when evaluation involves a constraining value and
22   * neither the allow nor deny parameter have restrictions for that value.
23   */
24  public class AlwaysSucceedParameterEvaluatorImpl implements ParameterEvaluator {
25      private static final AlwaysSucceedParameterEvaluatorImpl instance = new AlwaysSucceedParameterEvaluatorImpl();
26  
27      public static ParameterEvaluator getInstance() {
28          return instance;
29      }
30  
31      private AlwaysSucceedParameterEvaluatorImpl() {
32      }
33  
34      public boolean constraintIsAllow() {
35          return Boolean.TRUE;
36      }
37  
38  
39      public boolean evaluateAndAddError(Class businessObjectOrDocumentClass, String constrainedPropertyName, String userEditablePropertyName) {
40          return evaluationSucceeds();
41      }
42  
43      public boolean evaluateAndAddError(Class businessObjectOrDocumentClass, String constrainedPropertyName) {
44          return evaluationSucceeds();
45      }
46  
47      public boolean evaluationSucceeds() {
48          return Boolean.TRUE;
49      }
50  
51      public String getName() {
52          return AlwaysSucceedParameterEvaluatorImpl.class.getName();
53      }
54  
55      public String getParameterValuesForMessage() {
56          return AlwaysSucceedParameterEvaluatorImpl.class.getName();
57      }
58  
59      public String getValue() {
60          return AlwaysSucceedParameterEvaluatorImpl.class.getName();
61      }
62  
63      public void setConstrainedValue(String constrainedValue) {
64      }
65  }