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;
022import org.kuali.rice.krms.api.repository.rule.RuleDefinition;
023import org.kuali.rice.krms.framework.engine.Rule;
024
025import javax.jws.WebParam;
026import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
027import java.util.List;
028import java.util.Map;
029
030/**
031 * {@link ValidationRule} Service
032 * 
033 * @see ValidationRule
034 * @author Kuali Rice Team (rice.collab@kuali.org)
035 */
036public interface ValidationRuleTypeService extends RuleTypeService {
037    /**
038     * VALIDATIONS_RULE_TYPE_CODE_ATTRIBUTE - Database krms_attr_defn_t NM value
039     */
040    static public final String VALIDATIONS_RULE_TYPE_CODE_ATTRIBUTE = "ruleTypeCode"; // Database krms_attr_defn_t NM value
041
042    @Override
043    public Rule loadRule(RuleDefinition validationRuleDefinition);
044
045    @Override
046    public List<RemotableAttributeField> getAttributeFields(@WebParam(name = "krmsTypeId") String krmsTypeId)
047            throws RiceIllegalArgumentException;
048
049    @Override
050    public List<RemotableAttributeError> validateAttributesAgainstExisting(
051            @WebParam(name = "krmsTypeId") String krmsTypeId, @WebParam(name = "newAttributes") @XmlJavaTypeAdapter(
052            value = MapStringStringAdapter.class) Map<String, String> newAttributes, @WebParam(name = "oldAttributes") @XmlJavaTypeAdapter(
053            value = MapStringStringAdapter.class) Map<String, String> oldAttributes) throws RiceIllegalArgumentException;
054
055    @Override
056    public List<RemotableAttributeError> validateAttributes(@WebParam(name = "krmsTypeId") String krmsTypeId, @WebParam(name = "attributes") @XmlJavaTypeAdapter(
057            value = MapStringStringAdapter.class) Map<String, String> attributes) throws RiceIllegalArgumentException;
058}