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.kim.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.util.jaxb.MapStringStringAdapter; 021import org.kuali.rice.kim.api.KimConstants; 022import org.kuali.rice.kim.api.type.KimAttributeField; 023 024import javax.jws.WebMethod; 025import javax.jws.WebParam; 026import javax.jws.WebResult; 027import javax.jws.WebService; 028import javax.jws.soap.SOAPBinding; 029import javax.xml.bind.annotation.XmlElement; 030import javax.xml.bind.annotation.XmlElementWrapper; 031import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; 032import java.util.List; 033import java.util.Map; 034 035/** 036 * This is the base service interface for handling type-specific behavior. Types can be attached 037 * to various objects (currently groups and roles) in KIM to add additional attributes and 038 * modify their behavior. 039 * 040 * @author Kuali Rice Team (rice.collab@kuali.org) 041 */ 042@WebService(name = "kimTypeService", targetNamespace = KimConstants.Namespaces.KIM_NAMESPACE_2_0) 043@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED) 044public interface KimTypeService { 045 046 /** 047 * Gets the name of a workflow document type that should be passed to kew when resolving responsibilities for routing. 048 * 049 * This name will be passed as a qualifier with the "documentTypeName" key. 050 * return null to indicate that there is no custom workflow document needed for this type. 051 * 052 * @return the doc type name or null. 053 */ 054 @WebMethod(operationName="getWorkflowDocumentTypeName") 055 @WebResult(name = "name") 056 String getWorkflowDocumentTypeName(); 057 058 /** 059 * Gets an unmodifiable list of attribute names identifying the attribute qualifiers that are provided to 060 * the KIM responsibility service when resolving responsibility-based routing at the node with the given name. 061 * 062 * Returns an empty list, indicating that no attributes from this 063 * type should be passed to workflow. 064 * 065 * @param nodeName the name of the node to retrieve attribute names for. Cannot be null or blank. 066 * @return an unmodifiable list should not return null. 067 * @throws IllegalArgumentException if the nodeName is null or blank. 068 */ 069 @WebMethod(operationName="getWorkflowRoutingAttributes") 070 @XmlElementWrapper(name = "attributeNames", required = true) 071 @XmlElement(name = "attributeName", required = false) 072 @WebResult(name = "attributeNames") 073 List<String> getWorkflowRoutingAttributes(@WebParam(name = "nodeName") String nodeName) throws RiceIllegalArgumentException; 074 075 /** 076 * Gets a List of {@link KimAttributeField} for a kim type id. The order of the attribute fields in the list 077 * can be used as a hint to a ui framework consuming these attributes as to how to organize these fields. 078 * 079 * @param kimTypeId the kimTypeId to retrieve fields for. Cannot be null or blank. 080 * @return an immutable list of KimAttributeField. Will not return null. 081 * @throws IllegalArgumentException if the kimTypeId is null or blank 082 */ 083 @WebMethod(operationName="getAttributeDefinitions") 084 @XmlElementWrapper(name = "kimAttributeFields", required = true) 085 @XmlElement(name = "kimAttributeField", required = false) 086 @WebResult(name = "kimAttributeFields") 087 List<KimAttributeField> getAttributeDefinitions(@WebParam(name = "kimTypeId") String kimTypeId) throws RiceIllegalArgumentException; 088 089 /** 090 * This method validates the passed in attributes for a kimTypeId generating a List of {@link RemotableAttributeError}. 091 * 092 * The order of the attribute errors in the list 093 * can be used as a hint to a ui framework consuming these errors as to how to organize these errors. 094 * 095 * @param kimTypeId the kimTypeId that is associated with the attributes. Cannot be null or blank. 096 * @param attributes the kim type attributes to validate. Cannot be null. 097 * @return an immutable list of RemotableAttributeError. Will not return null. 098 * @throws IllegalArgumentException if the kimTypeId is null or blank or the attributes are null 099 */ 100 @WebMethod(operationName="validateAttributes") 101 @XmlElementWrapper(name = "attributeErrors", required = true) 102 @XmlElement(name = "attributeError", required = false) 103 @WebResult(name = "attributeErrors") 104 List<RemotableAttributeError> validateAttributes(@WebParam(name = "kimTypeId") 105 String kimTypeId, 106 @WebParam(name = "attributes") 107 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) 108 Map<String, String> attributes) throws RiceIllegalArgumentException; 109 110 /** 111 * This method validates the passed in attributes for a kimTypeId generating a List of {@link RemotableAttributeError}. 112 * This method used the oldAttributes to aid in validation. This is useful for validating "new" or "updated" attributes. 113 * 114 * The order of the attribute errors in the list 115 * can be used as a hint to a ui framework consuming these errors as to how to organize these errors. 116 * 117 * @param kimTypeId the kimTypeId that is associated with the attributes. Cannot be null or blank. 118 * @param newAttributes the kim type attributes to validate. Cannot be null. 119 * @param oldAttributes the old kim type attributes to use for validation. Cannot be null. 120 * @return an immutable list of RemotableAttributeError. Will not return null. 121 * @throws IllegalArgumentException if the kimTypeId is null or blank or the newAttributes or oldAttributes are null 122 */ 123 @WebMethod(operationName="validateAttributesAgainstExisting") 124 @XmlElementWrapper(name = "attributeErrors", required = true) 125 @XmlElement(name = "attributeError", required = false) 126 @WebResult(name = "attributeErrors") 127 List<RemotableAttributeError> validateAttributesAgainstExisting(@WebParam(name = "kimTypeId") 128 String kimTypeId, 129 @WebParam(name = "newAttributes") 130 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) 131 Map<String, String> newAttributes, 132 @WebParam(name = "oldAttributes") 133 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) 134 Map<String, String> oldAttributes) throws RiceIllegalArgumentException; 135 136 137 /** 138 * This method validates the passed in attributes for a kimTypeId generating a List of {@link RemotableAttributeError}. 139 * This method used the oldAttributes to aid in validation. This method specifically determines if attributes should be 140 * unique and verifying them against other attributes that have been set to determine uniqueness 141 * 142 * The order of the attribute errors in the list 143 * can be used as a hint to a ui framework consuming these errors as to how to organize these errors. 144 * 145 * @param kimTypeId the kimTypeId that is associated with the attributes. Cannot be null or blank. 146 * @param newAttributes the kim type attributes to validate. Cannot be null. 147 * @param oldAttributes the old kim type attributes to use for validation. Cannot be null. 148 * @return an immutable list of RemotableAttributeError. Will not return null. 149 * @throws IllegalArgumentException if the kimTypeId is null or blank or the newAttributes or oldAttributes are null 150 */ 151 @WebMethod(operationName="validateUniqueAttributes") 152 @XmlElementWrapper(name = "attributeErrors", required = true) 153 @XmlElement(name = "attributeError", required = false) 154 @WebResult(name = "attributeErrors") 155 List<RemotableAttributeError> validateUniqueAttributes(@WebParam(name = "kimTypeId") 156 String kimTypeId, 157 @WebParam(name = "newAttributes") 158 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) 159 Map<String, String> newAttributes, 160 @WebParam(name = "oldAttributes") 161 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) 162 Map<String, String> oldAttributes) 163 throws RiceIllegalArgumentException; 164 165 /** 166 * This method validates the passed in attributes for a kimTypeId generating a List of {@link RemotableAttributeError}. 167 * This method used the oldAttributes to aid in validation. This method specifically validates that the new attribute 168 * values have not been changed if they are unmodifiable. 169 * 170 * The order of the attribute errors in the list 171 * can be used as a hint to a ui framework consuming these errors as to how to organize these errors. 172 * 173 * @param kimTypeId the kimTypeId that is associated with the attributes. Cannot be null or blank. 174 * @param newAttributes the kim type attributes to validate. Cannot be null. 175 * @param originalAttributes the old kim type attributes to use for validation. Cannot be null. 176 * @return an immutable list of RemotableAttributeError. Will not return null. 177 * @throws IllegalArgumentException if the kimTypeId is null or blank or the newAttributes or oldAttributes are null 178 */ 179 @WebMethod(operationName="validateUnmodifiableAttributes") 180 @XmlElementWrapper(name = "attributeErrors", required = true) 181 @XmlElement(name = "attributeError", required = false) 182 @WebResult(name = "attributeErrors") 183 List<RemotableAttributeError> validateUnmodifiableAttributes(@WebParam(name = "kimTypeId") 184 String kimTypeId, 185 @WebParam(name = "originalAttributes") 186 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) 187 Map<String, String> originalAttributes, 188 @WebParam(name = "newAttributes") 189 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) 190 Map<String, String> newAttributes) 191 throws RiceIllegalArgumentException; 192} 193