001/**
002 * Copyright 2005-2017 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.kns.datadictionary.exporter;
017
018import org.kuali.rice.krad.datadictionary.CollectionDefinition;
019import org.kuali.rice.krad.datadictionary.DataDictionaryEntryBase;
020import org.kuali.rice.krad.datadictionary.exporter.ExportMap;
021
022/**
023 * CollectionsMapBuilder
024 * 
025 * @deprecated Only used by KNS classes, no replacement.
026 */
027@Deprecated
028public class CollectionsMapBuilder {
029
030    /**
031     * Default constructor
032     */
033    public CollectionsMapBuilder() {
034    }
035
036
037    /**
038     * @param entry
039     * @return ExportMap containing the standard entries for the entry's CollectionsDefinition
040     */
041    public ExportMap buildCollectionsMap(DataDictionaryEntryBase entry) {
042        ExportMap collectionsMap = new ExportMap("collections");
043
044        for ( CollectionDefinition collection : entry.getCollections() ) {
045            collectionsMap.set(buildCollectionMap(collection));
046        }
047
048        return collectionsMap;
049    }
050
051    private ExportMap buildCollectionMap(CollectionDefinition collection) {
052        ExportMap collectionMap = new ExportMap(collection.getName());
053
054        collectionMap.set("name", collection.getName());
055        collectionMap.set("label", collection.getLabel());
056        collectionMap.set("shortLabel", collection.getShortLabel());
057        if (collection.getSummary() != null) {
058            collectionMap.set("summary", collection.getSummary());
059        }
060        if (collection.getDescription() != null) {
061            collectionMap.set("description", collection.getDescription());
062        }
063
064        return collectionMap;
065    }
066
067}