001/* 002 * (C) Copyright 2006-2007 Nuxeo SAS (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Nuxeo - initial API and implementation 016 * 017 * $Id: MimetypeEntryImpl.java 21445 2007-06-26 14:47:16Z sfermigier $ 018 */ 019 020package org.nuxeo.ecm.platform.mimetype; 021 022import java.util.List; 023 024import org.nuxeo.ecm.platform.mimetype.interfaces.MimetypeEntry; 025 026/** 027 * MimetypeEntry. 028 * <p> 029 * A mimetype instance holds mimetype meta information. 030 * 031 * @see MimetypeEntry 032 * @author <a href="ja@nuxeo.com">Julien Anguenot</a> 033 */ 034public class MimetypeEntryImpl implements MimetypeEntry { 035 036 private static final long serialVersionUID = 5416098564564151631L; 037 038 protected final List<String> extensions; 039 040 protected final String iconPath; 041 042 protected final boolean binary; 043 044 protected final boolean onlineEditable; 045 046 protected final boolean oleSupported; 047 048 protected final List<String> mimetypes; 049 050 protected final String normalized; 051 052 public MimetypeEntryImpl(String normalized, List<String> mimetypes, List<String> extensions, String iconPath, 053 boolean binary, boolean onlineEditable, boolean oleSupported) { 054 this.normalized = normalized; 055 this.mimetypes = mimetypes; 056 this.extensions = extensions; 057 this.iconPath = iconPath; 058 this.binary = binary; 059 this.onlineEditable = onlineEditable; 060 this.oleSupported = oleSupported; 061 } 062 063 public List<String> getExtensions() { 064 return extensions; 065 } 066 067 public String getIconPath() { 068 return iconPath; 069 } 070 071 public List<String> getMimetypes() { 072 return mimetypes; 073 } 074 075 public String getMajor() { 076 return normalized.split("/")[0]; 077 } 078 079 public String getMinor() { 080 return normalized.split("/")[1]; 081 } 082 083 public String getNormalized() { 084 return normalized; 085 } 086 087 public boolean isBinary() { 088 return binary; 089 } 090 091 public boolean isOnlineEditable() { 092 return onlineEditable; 093 } 094 095 public boolean isOleSupported() { 096 return oleSupported; 097 } 098 099}