View Javadoc
1   /**
2    * Copyright 2005-2014 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.krms.api.engine.expression;
17  
18  import org.kuali.rice.krms.api.KrmsConstants;
19  import org.kuali.rice.krms.framework.engine.expression.EngineComparatorExtension;
20  import org.kuali.rice.krms.framework.engine.expression.StringCoercionExtension;
21  
22  import javax.jws.WebMethod;
23  import javax.jws.WebResult;
24  import javax.jws.WebService;
25  import javax.jws.soap.SOAPBinding;
26  import java.util.List;
27  
28  /**
29   * Interface for registering {@link EngineComparatorExtension} for use as a
30   * {@link org.kuali.rice.krms.framework.engine.expression.ComparisonOperator} when comparing
31   * {@link org.kuali.rice.krms.framework.engine.Proposition} {@link Term}s
32   *
33   * @author Kuali Rice Team (rice.collab@kuali.org)
34   */
35  @WebService(name = "comparisonOperatorService", targetNamespace = KrmsConstants.Namespaces.KRMS_NAMESPACE_2_0)
36  @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
37  public interface ComparisonOperatorService extends StringCoercionExtension {
38  
39      /**
40       * The {@link List} of {@link EngineComparatorExtension}s.
41       * @return List<EngineComparatorExtension> of configured {@link EngineComparatorExtension}s.
42       */
43      public List<EngineComparatorExtension> getOperators();
44  
45      /**
46       * List<EngineComparatorExtension> to use.
47       * @param operators
48       */
49      public void setOperators(List<EngineComparatorExtension> operators);
50  
51      @Override
52      @WebMethod(operationName = "canCoerce")
53      @WebResult(name = "coerced")
54      public boolean canCoerce(String type, String value);
55  
56      @Override
57      @WebMethod(operationName = "coerce")
58      @WebResult(name = "coerced")
59      public Object coerce(String type, String value);
60  
61      /**
62       * Returns the int result of a compare between the lhs and rhs objects.
63       * @param lhs left hand side object
64       * @param rhs right hand side object
65       * @return int result of compare between lhs and rhs objects
66       */
67      public int compare(Object lhs, Object rhs);
68  
69      /**
70       * Does the service have an Extension that can compare the given objects?
71       *
72       * @param leftHandSide left hand side Object
73       * @param rightHandSide right hand side Object
74       * @return boolean true a configured {@link EngineComparatorExtension} can compare the lhs and rhs Objects.
75       */
76      public boolean canCompare(Object leftHandSide, Object rightHandSide);
77  
78      /**
79       * {@link EngineComparatorExtension} that canCompare the given Objects
80       * @param leftHandSide left hand side Object
81       * @param rightHandSide right hand side Object
82       * @return the EngineComparatorExtension that can compare the given Objects.
83       */
84      public EngineComparatorExtension findComparatorExtension(Object leftHandSide, Object rightHandSide);
85  
86      /**
87       *
88       * @return List<StringCoercionExtension>
89       */
90      // this would move to a StringCoercionExtensionService if we go that way
91      public List<StringCoercionExtension> getStringCoercionExtensions();
92  
93      /**
94       * The {@link List} of {@link StringCoercionExtension}s.
95       * @param stringCoercionExtensions
96       */
97      // this would move to a StringCoercionExtensionService if we go that way
98      public void setStringCoercionExtensions(List<StringCoercionExtension> stringCoercionExtensions);
99  
100     /**
101      *
102      * @param type to coerce
103      * @param value to coerce
104      * @return {@link StringCoercionExtension} that can coerce the given type and value
105      */
106     // this would move to a StringCoercionExtensionService if we go that way
107     StringCoercionExtension findStringCoercionExtension(String type, String value);
108 
109 }