001/**
002 * Copyright 2005-2017 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.kew.framework.rule.attribute;
017
018import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
019import org.kuali.rice.core.api.util.jaxb.MapStringStringAdapter;
020import org.kuali.rice.kew.api.KewApiConstants;
021import org.kuali.rice.kew.api.extension.ExtensionDefinition;
022import org.kuali.rice.kew.api.rule.RoleName;
023import org.kuali.rice.kew.framework.KewFrameworkServiceLocator;
024
025import javax.jws.WebMethod;
026import javax.jws.WebParam;
027import javax.jws.WebResult;
028import javax.jws.WebService;
029import javax.jws.soap.SOAPBinding;
030import javax.xml.bind.annotation.XmlElement;
031import javax.xml.bind.annotation.XmlElementWrapper;
032import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
033import java.util.List;
034import java.util.Map;
035
036/**
037 * A remotable service which handles processing of a client application's document search customizations.
038 *
039 * @author Kuali Rice Team (rice.collab@kuali.org)
040 */
041@WebService(name = KewFrameworkServiceLocator.WORKFLOW_RULE_ATTRIBUTE_HANDLER_SERVICE, targetNamespace = KewApiConstants.Namespaces.KEW_NAMESPACE_2_0)
042@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
043public interface WorkflowRuleAttributeHandlerService {
044
045    /**
046     * Using the WorkflowRuleAttribute defined by the given extension definition, does the following: validates the
047     * given rule attribute parameters, fetches the list of RemotableAttributeField objects to display for the rule, and
048     * then determines the rule extension values produced by the attribute and returns this information as a
049     * WorkflowRuleAttributeFields object.
050     *
051     * @param parameters the parameters against which to validate
052     * @param extensionDefinition extension definition of the WorkflowRuleAttribute, cannot be null or blank.
053     * @param required the required flag which should be passed to the WorkflowRuleAttribute prior to processing
054     *
055     * @return the WorkflowRuleAttributeFields, will not return null.
056     *
057     * @throws RiceIllegalArgumentException if the extensionDefinition is null or blank
058     * @throws RiceIllegalArgumentException if the WorkflowRuleAttribute is not found
059     */
060    @WebMethod(operationName = "getRuleFields")
061    @XmlElement(name = "ruleFields", required = true)
062    @WebResult(name = "ruleFields")
063    WorkflowRuleAttributeFields getRuleFields(@WebParam(name = "parameters")
064                                              @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
065                                              Map<String, String> parameters,
066                                              @WebParam(name = "extensionDefinition")
067                                              ExtensionDefinition extensionDefinition,
068                                              @WebParam(name = "required")
069                                              boolean required)
070            throws RiceIllegalArgumentException;
071
072    /**
073     * Using the WorkflowRuleAttribute defined by the given extension definition, does the following: validates the
074     * given rule attribute parameters, fetches the list of RemotableAttributeField objects to display for the rule
075     * search, and then determines the rule extension values produced by the attribute and returns this information as a
076     * WorkflowRuleAttributeFields object.
077     *
078     * @param parameters the parameters against which to validate
079     * @param extensionDefinition extension definition of the WorkflowRuleAttribute, cannot be null or blank.
080     * @param required the required flag which should be passed to the WorkflowRuleAttribute prior to processing
081     *
082     * @return the WorkflowRuleAttributeFields, will not return null.
083     *
084     * @throws RiceIllegalArgumentException if the extensionDefinition is null or blank
085     * @throws RiceIllegalArgumentException if the WorkflowRuleAttribute is not found
086     */
087    @WebMethod(operationName = "getSearchFields")
088    @XmlElement(name = "searchFields", required = true)
089    @WebResult(name = "searchFields")
090    WorkflowRuleAttributeFields getSearchFields(@WebParam(name = "parameters")
091                                                @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
092                                                Map<String, String> parameters,
093                                                @WebParam(name = "extensionDefinition")
094                                                ExtensionDefinition extensionDefinition,
095                                                @WebParam(name = "required")
096                                                boolean required)
097            throws RiceIllegalArgumentException;
098
099    /**
100     * Using the WorkflowRuleAttribute defined by the given extension definition, does the following: validates the
101     * given rule attribute parameters, fetches the list of RemotableAttributeField objects to display for rule 
102     * reporting then determines the rule extension values produced by the attribute and returns this information as a
103     * WorkflowRuleAttributeFields object.
104     *
105     * @param parameters the parameters against which to validate
106     * @param extensionDefinition extension definition of the WorkflowRuleAttribute, cannot be null or blank.
107     * @param required the required flag which should be passed to the WorkflowRuleAttribute prior to processing
108     *
109     * @return the WorkflowRuleAttributeFields, will not return null.
110     *
111     * @throws RiceIllegalArgumentException if the extensionDefinition is null or blank
112     * @throws RiceIllegalArgumentException if the WorkflowRuleAttribute is not found
113     */
114    @WebMethod(operationName = "getRoutingDataFields")
115    @XmlElement(name = "routingDataFields", required = true)
116    @WebResult(name = "routingDataFields")
117    WorkflowRuleAttributeFields getRoutingDataFields(@WebParam(name = "parameters")
118                                              @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
119                                              Map<String, String> parameters,
120                                              @WebParam(name = "extensionDefinition")
121                                              ExtensionDefinition extensionDefinition,
122                                              @WebParam(name = "required")
123                                              boolean required)
124            throws RiceIllegalArgumentException;
125 
126    /**
127     * Gets a List of {@link RoleName} objects produced by the RoleAttribute defined by the given extension definition.
128     *
129     * @param extensionDefinition extension definition of the RoleAttribute, cannot be null or blank.
130     *
131     * @return an immutable list of RoleName objects, if none are defined or the supplied extension definition is not
132     * an instance of RoleAttribute, this will return an empty list. This method will never return null.
133     *
134     * @throws RiceIllegalArgumentException if the extensionDefinition is null or blank
135     * @throws RiceIllegalArgumentException if the RoleAttribute is not found
136     */
137    @WebMethod(operationName = "getRoleNames")
138    @XmlElementWrapper(name = "roleNames", required = true)
139    @XmlElement(name = "roleName", required = false)
140    @WebResult(name = "roleNames")
141    List<RoleName> getRoleNames(@WebParam(name = "extensionDefinition")
142                                ExtensionDefinition extensionDefinition)
143            throws RiceIllegalArgumentException;
144
145}