001/**
002 * Copyright 2005-2018 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.datadictionary;
017
018import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
019import org.kuali.rice.krad.datadictionary.validator.ValidationTrace;
020
021/**
022 * Common base class for DataDictionaryDefinition types.
023 *
024 * @author Kuali Rice Team (rice.collab@kuali.org)
025 */
026abstract public class DataDictionaryDefinitionBase extends DictionaryBeanBase implements DataDictionaryDefinition {
027    private static final long serialVersionUID = -2003626577498716712L;
028
029    protected String id;
030    protected boolean embeddedDataObjectMetadata = false;
031    protected boolean generatedFromMetadata = false;
032
033    public DataDictionaryDefinitionBase() {
034    }
035
036    @Override
037    @BeanTagAttribute(name = "id")
038    public String getId() {
039        return this.id;
040    }
041
042    /**
043     * A unique identifier for this data dictionary element.
044     */
045    public void setId(String id) {
046        this.id = id;
047    }
048
049    /**
050     *
051     * Returns true if the given object contains an embedded KRAD Data metadata object
052     * which may be used for defaulting certain attributes.
053     */
054    public boolean hasEmbeddedDataObjectMetadata() {
055        return embeddedDataObjectMetadata;
056    }
057
058    /**
059     * Returns true if this data dictionary object was completely generated from
060     * KRAD Data metadata.
061     */
062    public boolean wasGeneratedFromMetadata() {
063        return generatedFromMetadata;
064    }
065
066    public void setEmbeddedDataObjectMetadata(boolean embeddedDataObjectMetadata) {
067        this.embeddedDataObjectMetadata = embeddedDataObjectMetadata;
068    }
069
070    public void setGeneratedFromMetadata(boolean generatedFromMetadata) {
071        this.generatedFromMetadata = generatedFromMetadata;
072    }
073
074    /**
075     * Default implementation so that all subclasses do not need to implement this deprecated method.
076     */
077    @Override
078    @Deprecated
079    public void completeValidation(Class<?> rootBusinessObjectClass, Class<?> otherBusinessObjectClass) {
080        completeValidation(rootBusinessObjectClass, otherBusinessObjectClass, new ValidationTrace());
081    }
082
083    /**
084     * Empty implementation so that all subclasses do not need to implement this method if they have no local validation to perform.
085     */
086    @Override
087    public void completeValidation(Class<?> rootBusinessObjectClass, Class<?> otherBusinessObjectClass, ValidationTrace tracer) {}
088}