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.krad.service;
017
018import org.kuali.rice.krad.datadictionary.validation.result.DictionaryValidationResult;
019import org.kuali.rice.krad.uif.view.View;
020import org.kuali.rice.krad.uif.view.ViewModel;
021
022
023/**
024 * Validation service for KRAD views
025 *
026 * @author Kuali Rice Team (rice.collab@kuali.org)
027 */
028public interface ViewValidationService {
029
030    /**
031     * This is the main validation method that should be used when validating Views
032     * Validates the view based on the model passed in, this will correctly use previousView by default
033     * as it automatically contains the generated data the validation requires.
034     * @param model
035     * @return DictionaryValidationResult that contains any errors/messages if any, messages will have already
036     * been added to the MessageMap
037     */
038    public DictionaryValidationResult validateView(ViewModel model);
039
040    /**
041     * Additional validation method when you want to explicitly define the View being validated.  Note
042     * that the view must have the correct binding information on its InputFields already generated by
043     * its lifecycle for this method to be used correctly.
044     * @param view
045     * @param model
046     * @return DictionaryValidationResult that contains any errors/messages if any,, messages will have already
047     * been added to the MessageMap
048     */
049    public DictionaryValidationResult validateView(View view, ViewModel model);
050
051}