1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.service.impl;
17
18 import org.kuali.rice.krad.datadictionary.validation.ViewAttributeValueReader;
19 import org.kuali.rice.krad.datadictionary.validation.result.DictionaryValidationResult;
20 import org.kuali.rice.krad.service.DictionaryValidationService;
21 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
22 import org.kuali.rice.krad.service.ViewValidationService;
23 import org.kuali.rice.krad.uif.view.View;
24 import org.kuali.rice.krad.uif.view.ViewModel;
25
26
27
28
29
30
31
32
33 public class ViewValidationServiceImpl implements ViewValidationService {
34
35 protected DictionaryValidationService dictionaryValidationService;
36
37 @Override
38 public DictionaryValidationResult validateView(ViewModel model) {
39 return validateView(model.getPostedView(), model);
40 }
41
42 @Override
43 public DictionaryValidationResult validateView(View view, ViewModel model) {
44 return getDictionaryValidationService().validate(new ViewAttributeValueReader(view, model), true);
45 }
46
47 public DictionaryValidationService getDictionaryValidationService() {
48 if (dictionaryValidationService == null) {
49 this.dictionaryValidationService = KRADServiceLocatorWeb.getDictionaryValidationService();
50 }
51 return dictionaryValidationService;
52 }
53
54 public void setDictionaryValidationService(DictionaryValidationService dictionaryValidationService) {
55 this.dictionaryValidationService = dictionaryValidationService;
56 }
57 }