All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ec.gob.senescyt.sniese.commons.bundles.audit.AuditoriaMethodDispatcher Maven / Gradle / Ivy

There is a newer version: 2.0.5
Show newest version
package ec.gob.senescyt.sniese.commons.bundles.audit;

import com.sun.jersey.api.core.HttpContext;
import com.sun.jersey.spi.dispatch.RequestDispatcher;
import ec.gob.senescyt.sniese.commons.security.PrincipalProvider;

public class AuditoriaMethodDispatcher implements RequestDispatcher {

    private RequestDispatcher dispatcher;
    private AuditoriaWriter auditoriaWriter;
    private PrincipalProvider principalProvider;

    public AuditoriaMethodDispatcher(RequestDispatcher dispatcher, AuditoriaWriter auditoriaWriter, PrincipalProvider principalProvider) {
        this.dispatcher = dispatcher;
        this.auditoriaWriter = auditoriaWriter;
        this.principalProvider = principalProvider;
    }

    @Override
    public void dispatch(Object resource, HttpContext context) {
        dispatcher.dispatch(resource, context);
        ModeloAuditable modeloAuditable = new ModeloAuditable(context, principalProvider.obtenerUsuario());
        if (modeloAuditable.esAuditable()){
            auditoriaWriter.escribir(modeloAuditable);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy