001/*
002 * (C) Copyright 2015 Nuxeo SA (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-2.1.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 *     Antoine Taillefer <ataillefer@nuxeo.com>
016 */
017package org.nuxeo.elasticsearch.audit;
018
019import java.io.Serializable;
020
021import org.nuxeo.ecm.platform.audit.api.ExtendedInfo;
022
023/**
024 * Extended info for the {@link ESAuditBackend}.
025 * 
026 * @since 7.10
027 */
028public class ESExtendedInfo implements ExtendedInfo {
029
030    private static final long serialVersionUID = -8946082235160679850L;
031
032    protected Serializable value;
033
034    public ESExtendedInfo(Serializable value) {
035        this.value = value;
036    }
037
038    @Override
039    public Long getId() {
040        throw new UnsupportedOperationException();
041    }
042
043    @Override
044    public void setId(Long id) {
045        throw new UnsupportedOperationException();
046    }
047
048    @Override
049    public Serializable getSerializableValue() {
050        return value;
051    }
052
053    @Override
054    public <T> T getValue(Class<T> clazz) {
055        return clazz.cast(getSerializableValue());
056    }
057
058}