use of org.jboss.pnc.model.BuildRecord_ in project pnc by project-ncl.
the class BuildConfigurationAuditedRepositoryImpl method getBuildRecords.
/**
* @param buildConfigurationId
* @return List of BuildRecords where only id is fetched
*/
private List<BuildRecord> getBuildRecords(Integer buildConfigurationId) {
CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaQuery<Base32LongID> query = cb.createQuery(Base32LongID.class);
Root<BuildRecord> root = query.from(BuildRecord.class);
query.select(root.get(BuildRecord_.id));
query.where(cb.equal(root.get(BuildRecord_.buildConfigurationId), buildConfigurationId));
List<Base32LongID> buildRecordIds = entityManager.createQuery(query).getResultList();
return buildRecordIds.stream().map(id -> BuildRecord.Builder.newBuilder().id(id).build()).collect(Collectors.toList());
}
use of org.jboss.pnc.model.BuildRecord_ in project pnc by project-ncl.
the class BuildConfigurationAuditedRepositoryImpl method getBuildRecords.
/**
* @param idRev
* @return List of BuildRecords where only id is fetched
*/
private List<BuildRecord> getBuildRecords(IdRev idRev) {
CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaQuery<Base32LongID> query = cb.createQuery(Base32LongID.class);
Root<BuildRecord> root = query.from(BuildRecord.class);
query.select(root.get(BuildRecord_.id));
query.where(cb.and(cb.equal(root.get(BuildRecord_.buildConfigurationId), idRev.getId()), cb.equal(root.get(BuildRecord_.buildConfigurationRev), idRev.getRev())));
List<Base32LongID> buildRecordIds = entityManager.createQuery(query).getResultList();
return buildRecordIds.stream().map(id -> BuildRecord.Builder.newBuilder().id(id).build()).collect(Collectors.toList());
}
Aggregations