Example usage for org.hibernate.envers.query AuditEntity disjunction

List of usage examples for org.hibernate.envers.query AuditEntity disjunction

Introduction

In this page you can find the example usage for org.hibernate.envers.query AuditEntity disjunction.

Prototype

public static AuditDisjunction disjunction() 

Source Link

Document

Group criterions together in a single disjunction (A or B or C...).

Usage

From source file:org.jboss.pnc.rest.provider.BuildRecordProvider.java

License:Open Source License

public CollectionInfo<BuildRecordRest> getAllForConfigurationOrProjectName(int pageIndex, int pageSize,
        String sortingRsql, String query, String name) {

    List<Project> projectsMatchingName = projectRepository
            .queryWithPredicates(ProjectPredicates.searchByProjectName(name));

    AuditDisjunction disjunction = AuditEntity.disjunction();
    projectsMatchingName.forEach(project -> {
        disjunction.add(AuditEntity.relatedId("project").eq(project.getId()));
    });//from   ww w.  j av  a2  s  . co m
    disjunction.add(AuditEntity.property("name").like(name));

    List<Object[]> buildConfigurationRevisions = AuditReaderFactory.get(entityManager).createQuery()
            .forRevisionsOfEntity(BuildConfiguration.class, false, false).add(disjunction)
            .addOrder(AuditEntity.revisionNumber().desc()).getResultList();

    return queryForBuildRecords(pageIndex, pageSize, sortingRsql, query, buildConfigurationRevisions);
}