001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.documentlibrary.model.impl;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portlet.documentlibrary.model.DLFileEntry;
020    import com.liferay.portlet.documentlibrary.model.DLFileVersion;
021    import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil;
022    import com.liferay.portlet.documentlibrary.util.DLUtil;
023    import com.liferay.portlet.expando.model.ExpandoBridge;
024    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
025    
026    /**
027     * @author Jorge Ferrer
028     */
029    public class DLFileVersionImpl
030            extends DLFileVersionModelImpl implements DLFileVersion {
031    
032            public DLFileVersionImpl() {
033            }
034    
035            public ExpandoBridge getExpandoBridge() {
036                    if (_expandoBridge == null) {
037                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(
038                                    getCompanyId(), DLFileEntry.class.getName(), getPrimaryKey());
039                    }
040    
041                    return _expandoBridge;
042            }
043    
044            public DLFileEntry getFileEntry() throws PortalException, SystemException {
045                    return DLFileEntryLocalServiceUtil.getFileEntry(
046                            getGroupId(), getFolderId(), getName());
047            }
048    
049            public String getIcon() {
050                    return DLUtil.getFileIcon(getExtension());
051            }
052    
053            private ExpandoBridge _expandoBridge;
054    
055    }