2 * Copyright 2013 F.B.A. Scheper.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License. *
16 package org.bitbucket.fbascheper.tutorial.envers;
18 import org.hibernate.envers.RevisionListener;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
22 import java.util.Date;
25 * The {@link org.hibernate.envers.RevisionListener}-implementation used to initialize an {@link AuditRevision}.
27 * @author Erik-Berndt Scheper
31 public class AuditRevisionListener implements RevisionListener {
33 private final Logger logger = LoggerFactory.getLogger(this.getClass());
36 public void newRevision(Object revisionEntity) {
38 AuditRevision auditRevision = (AuditRevision) revisionEntity;
39 auditRevision.setRevisionTimeStamp(new Date());
41 auditRevision.setUserName("EXAMPLE_USER");