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.exception.RiceIllegalArgumentException;
019import org.kuali.rice.krms.api.KrmsConstants;
020
021import java.util.List;
022
023import javax.jws.WebMethod;
024import javax.jws.WebParam;
025import javax.jws.WebResult;
026import javax.jws.WebService;
027import javax.jws.soap.SOAPBinding;
028import javax.xml.bind.annotation.XmlElement;
029import javax.xml.bind.annotation.XmlElementWrapper;
030
031/**
032 * The function repository contains information about custom functions which
033 * can be used on propositions that are defined when constructing rules.
034 *
035 * @author Kuali Rice Team (rice.collab@kuali.org)
036 *
037 */
038@WebService(name = "functionRepositoryService", targetNamespace = KrmsConstants.Namespaces.KRMS_NAMESPACE_2_0)
039@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
040public interface FunctionRepositoryService {
041        
042        /**
043         * Retrieves the function for the given functionId.  The function can be used when
044         * constructing propositions and defines the type of the parameters to the function
045         * as well as it's return type.
046         *
047         * @param functionId the id of the function to retrieve
048         * @return the function definition, or null if no function could be located for the given functionId
049         * 
050         * @throws RiceIllegalArgumentException if the given functionId is null
051         */
052        @WebMethod(operationName = "getFunction")
053        @WebResult(name = "function")
054        public FunctionDefinition getFunction(@WebParam(name = "functionId") String functionId)
055            throws RiceIllegalArgumentException;
056        
057        /**
058         * Retrieves all of the functions for the given list of functionIds.  The
059         * function can be used when constructing propositions and defines the type
060         * of the parameters to the function as well as it's return type.
061         * 
062         * <p>The list which is returned from this operation may not be the same size as the list
063         * which is passed to this method.  If a function doesn't exist for a given function id then
064         * no result for that id will be returned in the list.  As a result of this, the returned
065         * list can be empty, but it will never be null.
066         *
067         * @param functionIds the list of function ids for which to retrieve the functions
068         * @return the list of functions for the given ids, this list will only contain functions for the ids
069         * that were resolved successfully, it will never return null but could return an empty list if no
070         * functions could be loaded for the given set of ids
071         * 
072         * @throws RiceIllegalArgumentException if the given list of functionIds is null
073         */
074        @WebMethod(operationName = "getFunctions")
075    @XmlElementWrapper(name = "functions", required = true)
076    @XmlElement(name = "function", required = false)
077        @WebResult(name = "functions")
078        public List<FunctionDefinition> getFunctions(@WebParam(name = "functionIds") List<String> functionIds)
079            throws RiceIllegalArgumentException;
080
081}