001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.lar;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.model.ClassedModel;
020    import com.liferay.portal.model.StagedModel;
021    
022    /**
023     * @author Mate Thurzo
024     */
025    @ProviderType
026    public class ExportImportClassedModelUtil {
027    
028            public static String getClassName(ClassedModel classedModel) {
029                    String modelClassName = classedModel.getModelClassName();
030    
031                    if (classedModel instanceof StagedModel) {
032                            StagedModel stagedModel = (StagedModel)classedModel;
033    
034                            StagedModelType stagedModelType = stagedModel.getStagedModelType();
035    
036                            modelClassName = stagedModelType.getClassName();
037                    }
038    
039                    return modelClassName;
040            }
041    
042            public static String getClassSimpleName(ClassedModel classedModel) {
043                    Class<?> modelClass = classedModel.getModelClass();
044    
045                    String modelClassSimpleName = modelClass.getSimpleName();
046    
047                    if (classedModel instanceof StagedModel) {
048                            StagedModel stagedModel = (StagedModel)classedModel;
049    
050                            StagedModelType stagedModelType = stagedModel.getStagedModelType();
051    
052                            modelClassSimpleName = stagedModelType.getClassSimpleName();
053                    }
054    
055                    return modelClassSimpleName;
056            }
057    
058    }