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.kew.api.repository.type;
017
018import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
019import org.kuali.rice.core.api.exception.RiceIllegalStateException;
020import org.kuali.rice.kew.api.KewApiConstants;
021
022import javax.jws.WebMethod;
023import javax.jws.WebParam;
024import javax.jws.WebResult;
025import javax.jws.WebService;
026import javax.jws.soap.SOAPBinding;
027import javax.xml.bind.annotation.XmlElement;
028import javax.xml.bind.annotation.XmlElementWrapper;
029import java.util.List;
030
031@WebService(name = "KEWTypeService", targetNamespace = KewApiConstants.Namespaces.KEW_NAMESPACE_2_0)
032@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
033public interface KewTypeRepositoryService {
034
035    /**
036     * This will create a {@link KewTypeDefinition} exactly like the parameter passed in.
037     *
038     * @param kewType - KewType
039     * @throws IllegalArgumentException if the kewType is null
040     * @throws IllegalStateException if the kewType already exists in the system
041     */
042    @WebMethod(operationName="createKewType")
043    KewTypeDefinition createKewType(@WebParam(name = "kewType") KewTypeDefinition kewType) throws RiceIllegalArgumentException, RiceIllegalStateException;
044
045    /**
046     * This will update an existing {@link KewTypeDefinition}
047     *
048     * @param kewType - KewType
049     * @throws IllegalArgumentException if the kewType is null
050     * @throws IllegalStateException if the KewType does not exist in the system
051     */
052    @WebMethod(operationName="updateKewType")
053    void updateKewType(@WebParam(name = "kewType") KewTypeDefinition kewType) throws RiceIllegalArgumentException, RiceIllegalStateException;
054
055    /**
056     * Lookup a kew type based on the given id.
057     *
058     * @param id the given kew type id
059     * @return a KewType object with the given id.  A null reference is returned if an invalid or
060     *         non-existant id is supplied.
061     */
062    @WebMethod(operationName = "getTypeById")
063    @WebResult(name = "type")
064    KewTypeDefinition getTypeById(@WebParam(name = "id") String id) throws RiceIllegalArgumentException;
065
066    /**
067     * Get a kew type object based on name and namespace
068     *
069     * @param name the given type name
070     * @param namespace the given type namespace
071     * @return A kew type object with the given namespace and name if one with that name and namespace
072     *         exists.  Otherwise, null is returned.
073     * @throws IllegalStateException if multiple kew types exist with the same name and namespace
074     */
075    @WebMethod(operationName = "getTypeByNameAndNamespace")
076    @WebResult(name = "type")
077    KewTypeDefinition getTypeByNameAndNamespace(
078            @WebParam(name = "name") String name,
079            @WebParam(name = "namespace") String namespace) throws RiceIllegalArgumentException, RiceIllegalStateException;
080
081    /**
082     * Returns all KEW types that for a given namespace.
083     *
084     * @return all KEW types for a namespace
085     */
086    @WebMethod(operationName = "findAllTypesByNamespace")
087    @WebResult(name = "namespaceTypes")
088    @XmlElementWrapper(name = "namespaceTypes", required = false)
089    @XmlElement(name = "namespaceType", required = false)
090    List<KewTypeDefinition> findAllTypesByNamespace(
091            @WebParam(name = "namespace") String namespace) throws RiceIllegalArgumentException;
092
093    /**
094     * Returns all KEW types
095     *
096     * @return all KEW types
097     */
098    @WebMethod(operationName = "findAllTypes")
099    @WebResult(name = "types")
100    @XmlElementWrapper(name = "types", required = false)
101    @XmlElement(name = "type", required = false)
102    List<KewTypeDefinition> findAllTypes();
103
104    /**
105     * This will create a {@link KewTypeAttribute} exactly like the parameter passed in.
106     *
107     * @param kewTypeAttribute - KewTypeAttribute
108     * @throws IllegalArgumentException if the kewTypeAttribute is null
109     * @throws IllegalStateException if the KewTypeAttribute already exists in the system
110     */
111    @WebMethod(operationName="createKewTypeAttribute")
112    void createKewTypeAttribute(@WebParam(name = "kewTypeAttribute") KewTypeAttribute kewTypeAttribute) throws RiceIllegalArgumentException, RiceIllegalStateException;
113
114    /**
115     * This will update an existing {@link KewTypeAttribute}
116     *
117     * @param kewTypeAttribute - KewTypeAttribute
118     * @throws IllegalArgumentException if the kewTypeAttribute is null
119     * @throws IllegalStateException if the KewTypeAttribute does not exist in the system
120     */
121    @WebMethod(operationName="updateKewTypeAttribute")
122    void updateKewTypeAttribute(@WebParam(name = "kewTypeAttribute") KewTypeAttribute kewTypeAttribute) throws RiceIllegalArgumentException, RiceIllegalStateException;
123
124
125}