001 /*
002 * Copyright 2011 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 */
016 package org.kuali.kfs.sys.document.validation.impl;
017
018 import org.kuali.kfs.sys.document.validation.GenericValidation;
019 import org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent;
020 import org.kuali.rice.kns.bo.PersistableBusinessObject;
021 import org.kuali.rice.kns.service.DictionaryValidationService;
022
023 /**
024 * A validation to have the data dictionary perform its validations upon a business object
025 */
026 public class BusinessObjectDataDictionaryValidation extends GenericValidation {
027 private DictionaryValidationService dictionaryValidationService;
028 private PersistableBusinessObject businessObjectForValidation;
029
030 /**
031 * Validates a business object against the data dictionary
032 * <strong>expects a business object to be the first parameter</strong>
033 * @see org.kuali.kfs.sys.document.validation.GenericValidation#validate(java.lang.Object[])
034 */
035 public boolean validate(AttributedDocumentEvent event) {
036 return getDictionaryValidationService().isBusinessObjectValid(businessObjectForValidation);
037 }
038
039 /**
040 * Gets the dictionaryValidationService attribute.
041 * @return Returns the dictionaryValidationService.
042 */
043 public DictionaryValidationService getDictionaryValidationService() {
044 return dictionaryValidationService;
045 }
046
047 /**
048 * Sets the dictionaryValidationService attribute value.
049 * @param dictionaryValidationService The dictionaryValidationService to set.
050 */
051 public void setDictionaryValidationService(DictionaryValidationService dictionaryValidationService) {
052 this.dictionaryValidationService = dictionaryValidationService;
053 }
054
055 /**
056 * Gets the businessObjectForValidation attribute.
057 * @return Returns the businessObjectForValidation.
058 */
059 public PersistableBusinessObject getBusinessObjectForValidation() {
060 return businessObjectForValidation;
061 }
062
063 /**
064 * Sets the businessObjectForValidation attribute value.
065 * @param businessObjectForValidation The businessObjectForValidation to set.
066 */
067 public void setBusinessObjectForValidation(PersistableBusinessObject businessObjectForValidation) {
068 this.businessObjectForValidation = businessObjectForValidation;
069 }
070 }