<commit_before>package org.openregistry.core.repository.jpa;

import org.openregistry.core.repository.ReferenceRepository;
import org.openregistry.core.domain.*;
import org.openregistry.core.domain.jpa.*;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import javax.persistence.PersistenceContext;
import javax.persistence.EntityManager;
import java.util.List;

/**
 * Default implementation of temporary repository. 
 */
@Repository
public final class JpaReferenceRepositoryImpl implements ReferenceRepository {

    @PersistenceContext
    private EntityManager entityManager;

    @Transactional
    public List<Person> getPeople() {
        return (List<Person>) this.entityManager.createQuery("select p from person p order by p.preferredName.family, p.preferredName.given").getResultList();
    }

    @Transactional
    public List<Department> getDepartments() {
        return (List<Department>) this.entityManager.createQuery("select d from department d order by d.name").getResultList(); 
    }

    @Transactional
    public Department getDepartmentById(final Long id) {
        return this.entityManager.find(JpaDepartmentImpl.class, id);
    }

    @Transactional
    public List<Campus> getCampuses() {
        return (List<Campus>) this.entityManager.createQuery("select c from campus c order by c.name").getResultList();
    }

    @Transactional
    public Campus getCampusById(final Long id) {
        return this.entityManager.find(JpaCampusImpl.class, id);
    }

    @Transactional
    public Country getCountryById(final Long id) {
        return this.entityManager.find(JpaCountryImpl.class, id);
    }

    @Transactional
    public List<Country> getCountries() {
        return (List<Country>) this.entityManager.createQuery("select c from country c").getResultList();
    }

    @Transactional
    public List<RoleInfo> getRoleInfos() {
        return (List<RoleInfo>) this.entityManager.createQuery("select r from roleInfo r order by r.title");
    }

    @Transactional
    public RoleInfo getRoleInfo(final Long id) {
        return this.entityManager.find(JpaRoleInfoImpl.class, id);
    }

    @Transactional
    public List<Region> getRegions() {
        return (List<Region>) this.entityManager.createQuery("select r from region r").getResultList();
    }

    @Transactional
    public List<Type> getPersonStatus() {
        return (List<Type>) this.entityManager.createQuery("select r from type r where dataType='Status'").getResultList();
    }


}<commit_msg>NOJIRA<commit_after>package org.openregistry.core.repository.jpa;

import org.openregistry.core.repository.ReferenceRepository;
import org.openregistry.core.domain.*;
import org.openregistry.core.domain.jpa.*;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import javax.persistence.PersistenceContext;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import java.util.List;

/**
 * Default implementation of temporary repository. 
 */
@Repository
public final class JpaReferenceRepositoryImpl implements ReferenceRepository {

    @PersistenceContext
    private EntityManager entityManager;

    @Transactional
    public List<Person> getPeople() {
        return (List<Person>) this.entityManager.createQuery("select p from person p order by p.preferredName.family, p.preferredName.given").getResultList();
    }

    @Transactional
    public List<Department> getDepartments() {
        return (List<Department>) this.entityManager.createQuery("select d from department d order by d.name").getResultList(); 
    }

    @Transactional
    public Department getDepartmentById(final Long id) {
        return this.entityManager.find(JpaDepartmentImpl.class, id);
    }

    @Transactional
    public List<Campus> getCampuses() {
        return (List<Campus>) this.entityManager.createQuery("select c from campus c order by c.name").getResultList();
    }

    @Transactional
    public Campus getCampusById(final Long id) {
        return this.entityManager.find(JpaCampusImpl.class, id);
    }

    @Transactional
    public Country getCountryById(final Long id) {
        return this.entityManager.find(JpaCountryImpl.class, id);
    }

    @Transactional
    public List<Country> getCountries() {
        return (List<Country>) this.entityManager.createQuery("select c from country c").getResultList();
    }

    @Transactional
    public List<RoleInfo> getRoleInfos() {
        return (List<RoleInfo>) this.entityManager.createQuery("select r from roleInfo r order by r.title");
    }

    @Transactional
    public RoleInfo getRoleInfo(final Long id) {
        return this.entityManager.find(JpaRoleInfoImpl.class, id);
    }

    @Transactional
    public List<Region> getRegions() {
        return (List<Region>) this.entityManager.createQuery("select r from region r").getResultList();
    }

    @Transactional
    public List<Type> getPersonStatus() {
        return (List<Type>) this.entityManager.createQuery("select r from type r where dataType='Status'").getResultList();
    }

    @Transactional
    public List<Type> getEmailTypes() {
        return (List<Type>) this.entityManager.createQuery("select r from type r where dataType='EmailAddress'").getResultList();
    }

    @Transactional
    public List<Type> getAddressTypes() {
        return (List<Type>) this.entityManager.createQuery("select r from type r where dataType='Address'").getResultList();
    }

    @Transactional
    public List<Type> getPhoneTypes() {
        return (List<Type>) this.entityManager.createQuery("select r from type r where dataType='Phone'").getResultList();
    }

    @Transactional
    public Type findType(String data_type, String description) {
        Query q = this.entityManager.createQuery("select distinct r from type r where dataType=:data_type and description=:description");
        q.setParameter("data_type", data_type);
        q.setParameter("description", description);
        List<Type> res = q.getResultList();
        if (res != null && res.size() > 0) return(res.get(0));
        return null;
    }

}
{'fraction_non_alphanumeric': 0.10493128536782538, 'fraction_numerical': 0.00032336297493936947, 'mean_word_length': 3.956730769230769, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 39, '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': '7065569', 'n_tokens_mistral': 1712, 'n_tokens_neox': 1667, 'n_words': 399}