View Javadoc

1   /**
2    * Copyright 2005-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.krad.service;
17  
18  import org.kuali.rice.krad.datadictionary.validation.result.DictionaryValidationResult;
19  import org.kuali.rice.krad.uif.view.View;
20  import org.kuali.rice.krad.uif.view.ViewModel;
21  
22  /**
23   * Validation service for KRAD views
24   *
25   * @author Kuali Rice Team (rice.collab@kuali.org)
26   */
27  public interface ViewValidationService {
28  
29      /**
30       * This is the main validation method that should be used when validating Views
31       * Validates the view based on the model passed in, this will correctly use previousView by default
32       * as it automatically contains the generated data the validation requires. Validates against the current state if
33       * state based validation
34       * is setup.
35       *
36       * @param model
37       * @return DictionaryValidationResult that contains any errors/messages if any, messages will have already
38       *         been added to the MessageMap
39       */
40      public DictionaryValidationResult validateView(ViewModel model);
41  
42      /**
43       * Additional validation method when you want to explicitly define the View being validated.  Note
44       * that the view must have the correct binding information on its InputFields already generated by
45       * its lifecycle for this method to be used correctly.  Validates against the current state if state based
46       * validation
47       * is setup.
48       *
49       * @param view
50       * @param model
51       * @return DictionaryValidationResult that contains any errors/messages if any,, messages will have already
52       *         been added to the MessageMap
53       */
54      public DictionaryValidationResult validateView(View view, ViewModel model);
55  
56      /**
57       * Validate the view against the specific validationState instead of the default (current state).  If
58       * forcedValidationState
59       * is null, validates against the current state if state validation is setup.
60       *
61       * @param view
62       * @param model
63       * @param forcedValidationState
64       * @return that contains any errors/messages if any,, messages will have already
65       *         been added to the MessageMap
66       */
67      public DictionaryValidationResult validateView(View view, ViewModel model, String forcedValidationState);
68  
69      /**
70       * Validate the view against the next state based on the order of the states in the views StateMapping.  This
71       * will validate against current state + 1.  If there is no next state, this will validate against the current
72       * state.
73       *
74       * @param view
75       * @param model
76       * @return that contains any errors/messages if any,, messages will have already
77       *         been added to the MessageMap
78       */
79      public DictionaryValidationResult validateViewAgainstNextState(View view, ViewModel model);
80  
81      /**
82       * Simulate view validation - this will run all validations against all states from the current state to
83       * the last state in the list of states in the view's stateMapping.  Validation errors received for the current
84       * state will be added as errors to the MessageMap. Validation errors for future states will be warnings.
85       *
86       * @param view
87       * @param model
88       */
89      public void validateViewSimulation(View view, ViewModel model);
90  
91      /**
92       * Simulate view validation - this will run all validations against all states from the current state to
93       * the untilState specified in the list of states in the view's stateMapping.  Validation errors received for the
94       * current state will be added as errors to the MessageMap. Validation errors for future states will be warnings.
95       *
96       * @param view
97       * @param model
98       * @param untilState
99       */
100     public void validateViewSimulation(View view, ViewModel model, String untilState);
101 
102 }