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.portlet.documentlibrary.model.impl;
016    
017    import com.liferay.portal.kernel.exception.SystemException;
018    import com.liferay.portal.kernel.language.LanguageUtil;
019    import com.liferay.portlet.documentlibrary.model.DLFileEntryTypeConstants;
020    import com.liferay.portlet.dynamicdatamapping.model.DDMStructure;
021    import com.liferay.portlet.dynamicdatamapping.service.DDMStructureLocalServiceUtil;
022    
023    import java.util.List;
024    import java.util.Locale;
025    
026    /**
027     * @author Alexander Chow
028     * @author Mate Thurzo
029     */
030    public class DLFileEntryTypeImpl extends DLFileEntryTypeBaseImpl {
031    
032            public DLFileEntryTypeImpl() {
033            }
034    
035            @Override
036            public List<DDMStructure> getDDMStructures() throws SystemException {
037                    return DDMStructureLocalServiceUtil.getDLFileEntryTypeStructures(
038                            getFileEntryTypeId());
039            }
040    
041            @Override
042            public String getName(Locale locale) {
043                    String name = super.getName(locale);
044    
045                    if (getFileEntryTypeId() ==
046                                    DLFileEntryTypeConstants.FILE_ENTRY_TYPE_ID_BASIC_DOCUMENT) {
047    
048                            name = LanguageUtil.get(locale, name);
049                    }
050    
051                    return name;
052            }
053    
054            @Override
055            public boolean isExportable() {
056                    if (getFileEntryTypeId() ==
057                                    DLFileEntryTypeConstants.FILE_ENTRY_TYPE_ID_BASIC_DOCUMENT) {
058    
059                            return false;
060                    }
061    
062                    return true;
063            }
064    
065    }