<commit_before>package org.oregami.data;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;

import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.persist.Transactional;
import org.hibernate.envers.AuditReader;
import org.hibernate.envers.AuditReaderFactory;
import org.joda.time.LocalDateTime;
import org.oregami.data.GenericDAOUUID;
import org.oregami.entities.BaseEntityUUID;
import org.oregami.entities.CustomRevisionEntity;
import org.oregami.entities.CustomRevisionListener;
import org.oregami.entities.TopLevelEntity;
import org.oregami.service.ServiceCallContext;

public abstract class GenericDAOUUIDImpl<E extends BaseEntityUUID, P> implements
        GenericDAOUUID<E, P> {

    private final Provider<EntityManager> emf;

    @Inject
    public GenericDAOUUIDImpl(Provider<EntityManager> emf) {
        this.emf=emf;
    }

    Class<E> entityClass;

    @Override
    @Transactional
    @SuppressWarnings("unchecked")
    public P save(E entity) {
        emf.get().persist(entity);
        updateRevisionListener(entity);
        entity.setChangeTime(new LocalDateTime());
        return (P) entity.getId();
    }

    @Override<commit_msg>imports<commit_after>package org.oregami.data;

import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.persist.Transactional;
import org.hibernate.envers.AuditReader;
import org.hibernate.envers.AuditReaderFactory;
import org.joda.time.LocalDateTime;
import org.oregami.entities.BaseEntityUUID;
import org.oregami.entities.CustomRevisionEntity;
import org.oregami.entities.CustomRevisionListener;
import org.oregami.entities.TopLevelEntity;
import org.oregami.service.ServiceCallContext;

import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

public abstract class GenericDAOUUIDImpl<E extends BaseEntityUUID, P> implements
        GenericDAOUUID<E, P> {

    private final Provider<EntityManager> emf;

    @Inject
    public GenericDAOUUIDImpl(Provider<EntityManager> emf) {
        this.emf=emf;
    }

    Class<E> entityClass;

    @Override
    @Transactional
    @SuppressWarnings("unchecked")
    public P save(E entity) {
        emf.get().persist(entity);
        updateRevisionListener(entity);
        entity.setChangeTime(new LocalDateTime());
        return (P) entity.getId();
    }

    @Override
{'fraction_non_alphanumeric': 0.0977076287110109, 'fraction_numerical': 0.0, 'mean_word_length': 4.67590618336887, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5559476', 'n_tokens_mistral': 810, 'n_tokens_neox': 809, 'n_words': 145}