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.framework.type;
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;
022
023import javax.jws.WebMethod;
024import javax.jws.WebParam;
025import javax.jws.WebResult;
026import javax.jws.soap.SOAPBinding;
027import javax.xml.bind.annotation.XmlElement;
028import javax.xml.bind.annotation.XmlElementWrapper;
029import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
030import java.util.List;
031import java.util.Map;
032
033/**
034 * Interface to be extended by type services that have remotable attributes that will need to be rendered and
035 * validated
036 */
037
038@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL,
039        parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
040
041public interface RemotableAttributeOwner {
042
043    /**
044     * <p>get the attributes supported by the type with the given krmsTypeId.</p>
045     *
046     * @param krmsTypeId the people flow type identifier.  Must not be null or blank.
047     * @return the {@link RemotableAttributeField}s that the PeopleFlow type with the given id supports.
048     * Will not return null.
049     */
050    @WebMethod(operationName="getAttributeFields")
051    @XmlElementWrapper(name = "attributeFields", required = true)
052    @XmlElement(name = "attributeField", required = false)
053    @WebResult(name = "attributeFields")
054    List<RemotableAttributeField> getAttributeFields( @WebParam(name = "krmsTypeId") String krmsTypeId )
055            throws RiceIllegalArgumentException;
056
057    /**
058     * <p>This method validates the passed in attributes for a krmsTypeId generating a List of
059     * {@link RemotableAttributeError}s.</p>
060     *
061     * @param krmsTypeId the people flow type identifier.  Must not be null or blank.
062     * @param attributes the attributes to validate. Cannot be null.
063     * @return any errors that are discovered during validation.  Will not return null.
064     * @throws RiceIllegalArgumentException
065     */
066    @WebMethod(operationName="validateAttributes")
067    @XmlElementWrapper(name = "attributeErrors", required = true)
068    @XmlElement(name = "attributeError", required = false)
069    @WebResult(name = "attributeErrors")
070    List<RemotableAttributeError> validateAttributes(
071
072            @WebParam(name = "krmsTypeId") String krmsTypeId,
073
074            @WebParam(name = "attributes")
075            @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
076            Map<String, String> attributes
077
078    )  throws RiceIllegalArgumentException;
079
080    /**
081     * <p>This method validates the passed in attributes for a krmsTypeId generating a List of
082     * {@link RemotableAttributeError}s.  This method used the oldAttributes to aid in validation.  This is useful for
083     * validating "new" or "updated" attributes.</p>
084     *
085     * @param krmsTypeId the people flow type identifier.  Must not be null or blank.
086     * @param newAttributes the kim type attributes to validate. Cannot be null.
087     * @param oldAttributes the old attributes to use for validation. Cannot be null.
088     * @return any errors that are discovered during validation.  Will not return null.
089     * @throws RiceIllegalArgumentException
090     */
091    @WebMethod(operationName="validateAttributesAgainstExisting")
092    @XmlElementWrapper(name = "attributeErrors", required = true)
093    @XmlElement(name = "attributeError", required = false)
094    @WebResult(name = "attributeErrors")
095    List<RemotableAttributeError> validateAttributesAgainstExisting(
096
097            @WebParam(name = "krmsTypeId") String krmsTypeId,
098
099            @WebParam(name = "newAttributes")
100            @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
101            Map<String, String> newAttributes,
102
103            @WebParam(name = "oldAttributes")
104            @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
105            Map<String, String> oldAttributes
106
107    ) throws RiceIllegalArgumentException;
108
109}