001/**
002 * Copyright 2005-2016 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.kns.datadictionary.BusinessObjectEntry;
019import org.kuali.rice.krad.datadictionary.exporter.ExportMap;
020
021/**
022 * BusinessObjectEntryMapper
023 */
024@Deprecated
025public class BusinessObjectEntryMapper {
026
027    /**
028     * Default constructor
029     */
030    public BusinessObjectEntryMapper() {
031    }
032
033
034    /**
035     * @param entry
036     * @return Map containing a String- and Map-based representation of the given entry
037     */
038    public ExportMap mapEntry(BusinessObjectEntry entry) {
039        if (entry == null) {
040            throw new IllegalArgumentException("invalid (null) entry");
041        }
042
043        ExportMap entryMap = new ExportMap(entry.getJstlKey());
044        
045        // simple properties
046        entryMap.set("dataObjectClass", entry.getBusinessObjectClass().getName());
047        if (entry.getExporterClass() != null) {
048                entryMap.set("exporterClass", entry.getExporterClass().getName());
049        }
050        final String objectLabel = entry.getObjectLabel();
051        if (objectLabel != null) {
052            entryMap.set("objectLabel", objectLabel);
053        }
054        final String objectDescription = entry.getObjectDescription();
055        if (objectDescription != null) {
056            entryMap.set("objectDescription", objectDescription);
057        }
058
059        // complex properties
060        entryMap.setOptional(new InquiryMapBuilder().buildInquiryMap(entry));
061        entryMap.setOptional(new LookupMapBuilder().buildLookupMap(entry));
062        entryMap.set(new AttributesMapBuilder().buildAttributesMap(entry));
063        entryMap.set(new CollectionsMapBuilder().buildCollectionsMap(entry));
064        entryMap.set(new RelationshipsMapBuilder().buildRelationshipsMap(entry));
065
066        return entryMap;
067    }
068}