001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     Nuxeo - initial API and implementation
011 *
012 * $Id$
013 */
014
015package org.nuxeo.ecm.core.api.blobholder;
016
017import java.io.Serializable;
018import java.util.List;
019import java.util.Map;
020
021import org.nuxeo.ecm.core.api.Blob;
022
023public class SimpleBlobHolderWithProperties extends SimpleBlobHolder {
024
025    protected final Map<String, Serializable> properties;
026
027    public SimpleBlobHolderWithProperties(Blob blob, Map<String, Serializable> properties) {
028        super(blob);
029        this.properties = properties;
030    }
031
032    public SimpleBlobHolderWithProperties(List<Blob> blobs, Map<String, Serializable> properties) {
033        super(blobs);
034        this.properties = properties;
035    }
036
037    @Override
038    public Serializable getProperty(String name) {
039        if (properties == null) {
040            return null;
041        }
042        return properties.get(name);
043    }
044
045    @Override
046    public Map<String, Serializable> getProperties() {
047        return properties;
048    }
049
050}