Example usage for org.hibernate.envers.query.criteria AuditDisjunction add

List of usage examples for org.hibernate.envers.query.criteria AuditDisjunction add

Introduction

In this page you can find the example usage for org.hibernate.envers.query.criteria AuditDisjunction add.

Prototype

@Override
    public AuditDisjunction add(AuditCriterion criterion) 

Source Link

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 w  ww  .j ava  2s  .  c  o 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);
}