001/* 002 * (C) Copyright 2006-2007 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache 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.apache.org/licenses/LICENSE-2.0 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 * 016 * Contributors: 017 * Nuxeo - initial API and implementation 018 * 019 * $Id: MimetypeEntryImpl.java 21445 2007-06-26 14:47:16Z sfermigier $ 020 */ 021 022package org.nuxeo.ecm.platform.mimetype; 023 024import java.util.List; 025 026import org.nuxeo.ecm.platform.mimetype.interfaces.MimetypeEntry; 027 028/** 029 * MimetypeEntry. 030 * <p> 031 * A mimetype instance holds mimetype meta information. 032 * 033 * @see MimetypeEntry 034 * @author <a href="ja@nuxeo.com">Julien Anguenot</a> 035 */ 036public class MimetypeEntryImpl implements MimetypeEntry { 037 038 private static final long serialVersionUID = 5416098564564151631L; 039 040 protected final List<String> extensions; 041 042 protected final String iconPath; 043 044 protected final boolean binary; 045 046 protected final boolean onlineEditable; 047 048 protected final boolean oleSupported; 049 050 protected final List<String> mimetypes; 051 052 protected final String normalized; 053 054 public MimetypeEntryImpl(String normalized, List<String> mimetypes, List<String> extensions, String iconPath, 055 boolean binary, boolean onlineEditable, boolean oleSupported) { 056 this.normalized = normalized; 057 this.mimetypes = mimetypes; 058 this.extensions = extensions; 059 this.iconPath = iconPath; 060 this.binary = binary; 061 this.onlineEditable = onlineEditable; 062 this.oleSupported = oleSupported; 063 } 064 065 public List<String> getExtensions() { 066 return extensions; 067 } 068 069 public String getIconPath() { 070 return iconPath; 071 } 072 073 public List<String> getMimetypes() { 074 return mimetypes; 075 } 076 077 public String getMajor() { 078 return normalized.split("/")[0]; 079 } 080 081 public String getMinor() { 082 return normalized.split("/")[1]; 083 } 084 085 public String getNormalized() { 086 return normalized; 087 } 088 089 public boolean isBinary() { 090 return binary; 091 } 092 093 public boolean isOnlineEditable() { 094 return onlineEditable; 095 } 096 097 public boolean isOleSupported() { 098 return oleSupported; 099 } 100 101}