Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.keycloak.audit.jpa;
 
 

Author(s):
Stian Thorgersen
public class JpaAuditProviderFactory implements AuditProviderFactory {
    public static final String ID = "jpa";
    private EntityManagerFactory emf;
    private Set<EventTypeincludedEvents = new HashSet<EventType>();
    @Override
    public AuditProvider create(ProviderSession providerSession) {
        return new JpaAuditProvider(.createEntityManager(), );
    }
    @Override
    public void init(Config.Scope config) {
         = Persistence.createEntityManagerFactory("jpa-keycloak-audit-store");
        String[] include = config.getArray("include-events");
        if (include != null) {
            for (String i : include) {
                .add(EventType.valueOf(i.toUpperCase()));
            }
        } else {
            for (EventType i : EventType.values()) {
                .add(i);
            }
        }
        String[] exclude = config.getArray("exclude-events");
        if (exclude != null) {
            for (String e : exclude) {
                .remove(EventType.valueOf(e.toUpperCase()));
            }
        }
    }
    @Override
    public void close() {
        .close();
    }
    @Override
    public String getId() {
        return ;
    }
New to GrepCode? Check out our FAQ X