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