1 /** 2 * Copyright 2005-2015 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.repository.function; 17 18 import org.kuali.rice.core.api.mo.common.Identifiable; 19 import org.kuali.rice.core.api.mo.common.Versioned; 20 import org.kuali.rice.core.api.mo.common.active.Inactivatable; 21 import org.kuali.rice.krms.api.repository.category.CategoryDefinitionContract; 22 import org.kuali.rice.krms.api.repository.type.KrmsTypeDefinition; 23 24 import java.util.List; 25 26 /** 27 * Defines the contract for a function definition. A function definition can be 28 * defined by clients integrating with KRMS in order to implement custom logic 29 * which they may require as part of rule execution and evaluation. These can 30 * then be used in simple propositions. 31 * 32 * <p>The function definition itself defines various metadata about the function 33 * including it's name, return type, and expected parameter types. The actual 34 * implementation of the function is retrieved through the type defined by 35 * {@link #getTypeId()}. 36 * 37 * @author Kuali Rice Team (rice.collab@kuali.org) 38 * 39 */ 40 public interface FunctionDefinitionContract extends Versioned, Identifiable, Inactivatable { 41 42 /** 43 * Returns the namespace code of this function definition. All functions 44 * have a namespace and this value can never be null or blank. The 45 * combination of namespace plus name must be unique within the entire 46 * repository of functions. 47 * 48 * @return the namespace code of this function definition 49 */ 50 String getNamespace(); 51 52 /** 53 * Returns the name of this function definition. All functions have a name 54 * and this value can never be null or blank. The combination of namespace 55 * plus name must be unique within the entire repository of functions. 56 * 57 * @return the name of this function definition 58 */ 59 String getName(); 60 61 /** 62 * Returns the description of this function definition. The description is 63 * intended to provide more information about a function and it's 64 * appropriate usage. The description is optional. 65 * 66 * @return the description of this function definition 67 */ 68 String getDescription(); 69 70 /** 71 * Returns the type of the return value of the function defined by this 72 * function definition. This can be one of a set of "built-in" data types 73 * or a custom data type represented as a fully qualified java class name. 74 * All functions must have a return type so this method should never return 75 * null or blank. 76 * 77 * @return the return type of this function definition 78 */ 79 String getReturnType(); 80 81 /** 82 * Returns the id of the {@link KrmsTypeDefinition} which defines the 83 * actual implementation of this function such that it can be loaded into 84 * the engine and executed. 85 * 86 * @return the type id of this function definition 87 */ 88 String getTypeId(); 89 90 /** 91 * Returns an ordered, immutable list of the parameters which this function 92 * definition requires. This list can be empty (in the case of a function 93 * which has no arguments) but will never be null. 94 * 95 * @return the list of parameters for this function definition 96 */ 97 List<? extends FunctionParameterDefinitionContract> getParameters(); 98 99 /** 100 * Returns an ordered list of the categories which this function 101 * definition requires. This list can be empty (in the case of a function 102 * which has no arguments) but will never be null. 103 * 104 * @return the list of categories for this function definition 105 */ 106 List<? extends CategoryDefinitionContract> getCategories(); 107 108 }