Search in sources :

Example 6 with DefaultSortInfo

use of org.jboss.pnc.spi.datastore.repositories.api.impl.DefaultSortInfo in project pnc by project-ncl.

the class BuildRecordRepositoryImpl method getLatestSuccessfulBuildRecord.

@Override
public BuildRecord getLatestSuccessfulBuildRecord(IdRev idRev, boolean temporaryBuild) {
    PageInfo pageInfo = new DefaultPageInfo(0, 1);
    SortInfo sortInfo = new DefaultSortInfo(SortInfo.SortingDirection.DESC, BuildRecord_.id.getName());
    List<BuildRecord> buildRecords = queryWithPredicates(pageInfo, sortInfo, withBuildConfigurationIdRev(idRev), withSuccess(), includeTemporary(idRev, temporaryBuild));
    if (buildRecords.size() == 0) {
        return null;
    } else {
        return buildRecords.get(0);
    }
}
Also used : PageInfo(org.jboss.pnc.spi.datastore.repositories.api.PageInfo) DefaultPageInfo(org.jboss.pnc.spi.datastore.repositories.api.impl.DefaultPageInfo) DefaultPageInfo(org.jboss.pnc.spi.datastore.repositories.api.impl.DefaultPageInfo) DefaultSortInfo(org.jboss.pnc.spi.datastore.repositories.api.impl.DefaultSortInfo) BuildRecord(org.jboss.pnc.model.BuildRecord) SortInfo(org.jboss.pnc.spi.datastore.repositories.api.SortInfo) DefaultSortInfo(org.jboss.pnc.spi.datastore.repositories.api.impl.DefaultSortInfo)

Aggregations

DefaultSortInfo (org.jboss.pnc.spi.datastore.repositories.api.impl.DefaultSortInfo)6 BuildRecord (org.jboss.pnc.model.BuildRecord)5 PageInfo (org.jboss.pnc.spi.datastore.repositories.api.PageInfo)5 SortInfo (org.jboss.pnc.spi.datastore.repositories.api.SortInfo)5 DefaultPageInfo (org.jboss.pnc.spi.datastore.repositories.api.impl.DefaultPageInfo)5 ArrayList (java.util.ArrayList)1 SortingDirection (org.jboss.pnc.spi.datastore.repositories.api.SortInfo.SortingDirection)1