View Javadoc
1   /*
2    * Copyright 2008 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.ole.sys.document.validation.impl;
17  
18  import org.kuali.ole.sys.document.validation.GenericValidation;
19  import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
20  import org.kuali.rice.kns.service.DictionaryValidationService;
21  import org.kuali.rice.krad.bo.PersistableBusinessObject;
22  
23  /**
24   * A validation to have the data dictionary perform its validations upon a business object
25   */
26  public class BusinessObjectDataDictionaryValidation extends GenericValidation {
27      private DictionaryValidationService dictionaryValidationService;
28      private PersistableBusinessObject businessObjectForValidation;
29  
30      /**
31       * Validates a business object against the data dictionary
32       * <strong>expects a business object to be the first parameter</strong>
33       * @see org.kuali.ole.sys.document.validation.GenericValidation#validate(java.lang.Object[])
34       */
35      public boolean validate(AttributedDocumentEvent event) {
36          return getDictionaryValidationService().isBusinessObjectValid(businessObjectForValidation);
37      }
38  
39      /**
40       * Gets the dictionaryValidationService attribute. 
41       * @return Returns the dictionaryValidationService.
42       */
43      public DictionaryValidationService getDictionaryValidationService() {
44          return dictionaryValidationService;
45      }
46  
47      /**
48       * Sets the dictionaryValidationService attribute value.
49       * @param dictionaryValidationService The dictionaryValidationService to set.
50       */
51      public void setDictionaryValidationService(DictionaryValidationService dictionaryValidationService) {
52          this.dictionaryValidationService = dictionaryValidationService;
53      }
54  
55      /**
56       * Gets the businessObjectForValidation attribute. 
57       * @return Returns the businessObjectForValidation.
58       */
59      public PersistableBusinessObject getBusinessObjectForValidation() {
60          return businessObjectForValidation;
61      }
62  
63      /**
64       * Sets the businessObjectForValidation attribute value.
65       * @param businessObjectForValidation The businessObjectForValidation to set.
66       */
67      public void setBusinessObjectForValidation(PersistableBusinessObject businessObjectForValidation) {
68          this.businessObjectForValidation = businessObjectForValidation;
69      }
70  }