001/* 002 * Licensed to DuraSpace under one or more contributor license agreements. 003 * See the NOTICE file distributed with this work for additional information 004 * regarding copyright ownership. 005 * 006 * DuraSpace licenses this file to you under the Apache License, 007 * Version 2.0 (the "License"); you may not use this file except in 008 * compliance with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.fcrepo.kernel.modeshape.observer; 019 020import java.util.Map; 021 022import javax.jcr.RepositoryException; 023import javax.jcr.nodetype.NodeType; 024 025import org.modeshape.jcr.api.observation.Event; 026 027/** 028 * Wrap a Modeshape JCR Event so we can modify its event type. 029 * 030 * @author whikloj 031 * @since 2018-09-13 032 */ 033public class WrappedJcrEvent implements Event { 034 035 private final Event wrappedEvent; 036 037 private final int eventType; 038 039 /** 040 * Construct a wrapped Modeshape JCR Event 041 * 042 * @param event The original event. 043 * @param type The new event type. 044 */ 045 public WrappedJcrEvent(final Event event, final int type) { 046 this.wrappedEvent = event; 047 this.eventType = type; 048 } 049 050 @Override 051 public int getType() { 052 return this.eventType; 053 } 054 055 @Override 056 public String getPath() throws RepositoryException { 057 return wrappedEvent.getPath(); 058 } 059 060 @Override 061 public String getUserID() { 062 return wrappedEvent.getUserID(); 063 } 064 065 @Override 066 public String getIdentifier() throws RepositoryException { 067 return wrappedEvent.getIdentifier(); 068 } 069 070 @Override 071 public Map getInfo() throws RepositoryException { 072 return wrappedEvent.getInfo(); 073 } 074 075 @Override 076 public String getUserData() throws RepositoryException { 077 return wrappedEvent.getUserData(); 078 } 079 080 @Override 081 public long getDate() throws RepositoryException { 082 return wrappedEvent.getDate(); 083 } 084 085 @Override 086 public NodeType getPrimaryNodeType() throws RepositoryException { 087 return wrappedEvent.getPrimaryNodeType(); 088 } 089 090 @Override 091 public NodeType[] getMixinNodeTypes() throws RepositoryException { 092 return wrappedEvent.getMixinNodeTypes(); 093 } 094 095}