001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.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/ecl2.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 */
016package org.kuali.rice.krms.api.repository.function;
017
018import org.kuali.rice.core.api.mo.common.Identifiable;
019import org.kuali.rice.core.api.mo.common.Versioned;
020import org.kuali.rice.core.api.mo.common.active.Inactivatable;
021import org.kuali.rice.krms.api.repository.category.CategoryDefinitionContract;
022import org.kuali.rice.krms.api.repository.type.KrmsTypeDefinition;
023
024import java.util.List;
025
026/**
027 * Defines the contract for a function definition.  A function definition can be
028 * defined by clients integrating with KRMS in order to implement custom logic
029 * which they may require as part of rule execution and evaluation.  These can
030 * then be used in simple propositions.
031 * 
032 * <p>The function definition itself defines various metadata about the function
033 * including it's name, return type, and expected parameter types.  The actual
034 * implementation of the function is retrieved through the type defined by
035 * {@link #getTypeId()}.
036 * 
037 * @author Kuali Rice Team (rice.collab@kuali.org)
038 *
039 */
040public interface FunctionDefinitionContract extends Versioned, Identifiable, Inactivatable {
041
042        /**
043         * Returns the namespace code of this function definition.  All functions
044         * have a namespace and this value can never be null or blank.  The
045         * combination of namespace plus name must be unique within the entire
046         * repository of functions.
047         * 
048         * @return the namespace code of this function definition
049         */
050        String getNamespace();
051        
052        /**
053         * Returns the name of this function definition.  All functions have a name
054         * and this value can never be null or blank.  The combination of namespace
055         * plus name must be unique within the entire repository of functions.
056         * 
057         * @return the name of this function definition
058         */
059        String getName();
060        
061        /**
062         * Returns the description of this function definition.  The description is
063         * intended to provide more information about a function and it's
064         * appropriate usage.  The description is optional.
065         * 
066         * @return the description of this function definition
067         */
068        String getDescription();
069        
070        /**
071         * Returns the type of the return value of the function defined by this
072         * function definition.  This can be one of a set of "built-in" data types
073         * or a custom data type represented as a fully qualified java class name.
074         * All functions must have a return type so this method should never return
075         * null or blank.
076         * 
077         * @return the return type of this function definition
078         */
079        String getReturnType();
080        
081        /**
082         * Returns the id of the {@link KrmsTypeDefinition} which defines the
083         * actual implementation of this function such that it can be loaded into
084         * the engine and executed.
085         * 
086         * @return the type id of this function definition
087         */
088        String getTypeId();
089
090        /**
091         * Returns an ordered, immutable list of the parameters which this function
092         * definition requires.  This list can be empty (in the case of a function
093         * which has no arguments) but will never be null.
094         * 
095         * @return the list of parameters for this function definition
096         */
097        List<? extends FunctionParameterDefinitionContract> getParameters();
098
099    /**
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}