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.peopleflow;
017
018import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
019import org.kuali.rice.core.api.uif.RemotableAttributeError;
020import org.kuali.rice.core.api.uif.RemotableAttributeField;
021import org.kuali.rice.core.api.util.jaxb.MapStringStringAdapter;
022import org.kuali.rice.kew.api.KewApiConstants;
023import org.kuali.rice.kew.api.document.Document;
024import org.kuali.rice.kew.api.document.DocumentContent;
025
026import javax.jws.WebMethod;
027import javax.jws.WebParam;
028import javax.jws.WebResult;
029import javax.jws.WebService;
030import javax.jws.soap.SOAPBinding;
031import javax.xml.bind.annotation.XmlElement;
032import javax.xml.bind.annotation.XmlElementWrapper;
033import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
034import java.util.List;
035import java.util.Map;
036
037/**
038 * <p>Interface for services that implement the type-specific behaviors of people flows.</p>
039 */
040@WebService(name = "PeopleFlowTypeService", targetNamespace = KewApiConstants.Namespaces.KEW_NAMESPACE_2_0)
041@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
042public interface PeopleFlowTypeService {
043
044    /**
045     * <p>Allows for the people flow to restrict the roles that can be selected when adding members to it.</p>
046     *
047     * @param kewTypeId the people flow type identifier.  Must not be null or blank.
048     * @param roleIds the set of ids to filter down.  Must not be null.
049     * @return the roleIds from the above list that are valid to select.  Will not return null.
050     */
051    @WebMethod(operationName="filterToSelectableRoleIds")
052    @WebResult(name = "selectableRoleIds")
053    @XmlElementWrapper(name = "selectableRoleIds", required = false)
054    @XmlElement(name = "selectableRoleId", required = false)
055    List<String> filterToSelectableRoleIds(
056            @WebParam(name = "kewTypeId") String kewTypeId,
057            @WebParam(name = "roleIds") List<String> roleIds
058    );
059
060    /**
061     * <p>Resolve any role qualifiers for the given roleId, and document (along with documentContent).</p>
062     *
063     * @param kewTypeId the people flow type identifier.  Must not be null or blank.
064     * @param roleId the role that the qualifiers are specific to.  Must not be null or blank.
065     * @param document the document that the qualifiers are being resolved against.  Must not be null.
066     * @param documentContent the contents for the document that the qualifiers are being resolved against.
067     * Must not be null.
068     * @return the resolved role qualifiers.  Will not return null.
069     */
070    @WebMethod(operationName="resolveRoleQualifiers")
071    @WebResult(name = "roleQualifiers")
072    @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
073    Map<String,String> resolveRoleQualifiers(
074            @WebParam(name = "kewTypeId") String kewTypeId,
075            @WebParam(name = "roleId") String roleId,
076            @WebParam(name = "document") Document document,
077            @WebParam(name = "documentContent") DocumentContent documentContent
078    );
079
080    /**
081     * <p>Resolve any role qualifiers for the given roleId, and document (along with documentContent). Allows for
082     * more than one set of qualifiers to be returned for the purpose of matching.</p>
083     *
084     * @param kewTypeId the people flow type identifier.  Must not be null or blank.
085     * @param roleId the role that the qualifiers are specific to.  Must not be null or blank.
086     * @param document the document that the qualifiers are being resolved against.  Must not be null.
087     * @param documentContent the contents for the document that the qualifiers are being resolved against.
088     * Must not be null.
089     * @return a list of the resolved role qualifiers.  Will not return null.
090     */
091    @WebMethod(operationName="resolveMultipleRoleQualifiers")
092    @WebResult(name = "roleQualifierList")
093    @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
094    List<Map<String, String>> resolveMultipleRoleQualifiers(
095            @WebParam(name = "kewTypeId") String kewTypeId,
096            @WebParam(name = "roleId") String roleId,
097            @WebParam(name = "document") Document document,
098            @WebParam(name = "documentContent") DocumentContent documentContent
099    );
100
101    /**
102     * <p>get the attributes supported by the people flow type with the given kewTypeId.</p>
103     *
104     * @param kewTypeId the people flow type identifier.  Must not be null or blank.
105     * @return the {@link RemotableAttributeField}s that the PeopleFlow type with the given id supports.
106     * Will not return null.
107     */
108    @WebMethod(operationName="getAttributeFields")
109    @WebResult(name = "attributeFields")
110    @XmlElementWrapper(name = "attributeFields", required = false)
111    @XmlElement(name = "attributeField", required = false)
112    List<RemotableAttributeField> getAttributeFields( @WebParam(name = "kewTypeId") String kewTypeId );
113
114    /**
115     * <p>This method validates the passed in attributes for a kewTypeId generating a List of
116     * {@link RemotableAttributeError}s.</p>
117     *
118     * @param kewTypeId the people flow type identifier.  Must not be null or blank.
119     * @param attributes the attributes to validate. Cannot be null.
120     * @return any errors that are discovered during validation.  Will not return null.
121     * @throws RiceIllegalArgumentException
122     */
123    @WebMethod(operationName="validateAttributes")
124    @XmlElementWrapper(name = "attributeErrors", required = true)
125    @XmlElement(name = "attributeError", required = false)
126    @WebResult(name = "attributeErrors")
127    List<RemotableAttributeError> validateAttributes(
128
129            @WebParam(name = "kewTypeId") String kewTypeId,
130
131            @WebParam(name = "attributes")
132            @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
133            Map<String, String> attributes
134
135    )  throws RiceIllegalArgumentException;
136
137    /**
138     * <p>This method validates the passed in attributes for a kewTypeId generating a List of
139     * {@link RemotableAttributeError}s.  This method used the oldAttributes to aid in validation.  This is useful for
140     * validating "new" or "updated" attributes.</p>
141     *
142     * @param kewTypeId the people flow type identifier.  Must not be null or blank.
143     * @param newAttributes the kim type attributes to validate. Cannot be null.
144     * @param oldAttributes the old attributes to use for validation. Cannot be null.
145     * @return any errors that are discovered during validation.  Will not return null.
146     * @throws RiceIllegalArgumentException
147     */
148    @WebMethod(operationName="validateAttributesAgainstExisting")
149    @XmlElementWrapper(name = "attributeErrors", required = true)
150    @XmlElement(name = "attributeError", required = false)
151    @WebResult(name = "attributeErrors")
152    List<RemotableAttributeError> validateAttributesAgainstExisting(
153
154            @WebParam(name = "kewTypeId") String kewTypeId,
155
156            @WebParam(name = "newAttributes")
157            @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
158            Map<String, String> newAttributes,
159
160            @WebParam(name = "oldAttributes")
161            @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
162            Map<String, String> oldAttributes
163
164    ) throws RiceIllegalArgumentException;
165
166}