001    /**
002     * Copyright 2005-2012 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.rice.krad.datadictionary;
017    
018    import org.kuali.rice.krad.datadictionary.state.StateMapping;
019    import org.kuali.rice.krad.datadictionary.validator.ErrorReport;
020    import org.kuali.rice.krad.datadictionary.validator.TracerToken;
021    
022    import java.util.ArrayList;
023    import java.util.List;
024    
025    
026    /**
027     * Defines methods common to all DataDictionaryDefinition types.
028     * 
029     *     DD: The highest level objects in the data dictionary are of
030            the following types:
031            * BusinessObjectEntry
032            * MaintenanceDocumentEntry
033            * TransactionalDocumentEntry
034    
035        JSTL: The data dictionary is exposed as a Map which is accessed
036        by referring to the "DataDictionary" global constant.  This Map contains
037        the following kinds of entries keyed as indicated:
038            * Business Object Entries -
039                Key = dataObjectClass name
040                Value = Map created by BusinessObjectEntryMapper
041            * Maintenance Document entries -
042                Key = DocumentType name
043                Value = Map created by MaintenanceObjectEntryMapper
044            * Transactional Document entries -
045                Key = DocumentType name
046                Value = Map created by TransactionalDocumentEntryMapper
047    
048        All elements are exposed to JSTL as Maps (where the element has a
049        unique key by which they can be retrieved), or Strings.  For collections
050        of elements having no unique key, the entry's position in the list
051        (0, 1, etc.) is used as its index.
052    
053        All Maps (except the top-level DataDictionary one) are guaranteed to
054        present their entries with an iteration order identical to the order
055        in which the elements were defined in XML.
056    
057     */
058    public interface DataDictionaryEntry extends DictionaryBean {
059        /**
060         * @return String used as a globally-unique key for this entry's jstl-exported version
061         */
062        public String getJstlKey();
063    
064        /**
065         * Kicks off complete entry-wide validation which couldn't be done earlier.
066         * 
067         * @throws org.kuali.rice.krad.datadictionary.exception.CompletionException if a problem arises during validation-completion
068         */
069        public void completeValidation();
070    
071        /**
072         * Validates that the data objects created from the Spring Beans are correct
073         *
074         * @param tracer - Record of object's location
075         * @return  A list of ErrorReports detailing errors found within the data dictionary and referenced within it
076         */
077        ArrayList<ErrorReport> completeValidation(TracerToken tracer);
078    
079        /**
080         * @param attributeName
081         * @return AttributeDefinition with the given name, or null if none with that name exists
082         */
083        public AttributeDefinition getAttributeDefinition(String attributeName);
084    
085        /**
086         * Returns the full class name of the underlying object.
087         */
088        public String getFullClassName();
089        
090        /**
091         * @return a Map containing all RelationshipDefinitions associated with this BusinessObjectEntry, indexed by relationshipName
092         */
093        public List<RelationshipDefinition> getRelationships();
094    
095        /**
096         * StateMapping for this DataDictionaryEntry, this represents the states of this entry, their names, and where
097         * to find the state information on the model
098         * @return StateMapping object
099         */
100        public StateMapping getStateMapping();
101    
102        /**
103         * Set the StateMapping object which represents state information for this entry
104         * @param stateMapping StateMapping object
105         */
106        public void setStateMapping(StateMapping stateMapping);
107    }