use of org.jboss.pnc.dto.insights.BuildRecordInsights in project pnc by project-ncl.
the class BuildProviderImpl method getAllBuildRecordInsightsNewerThanTimestamp.
@Override
public Page<BuildRecordInsights> getAllBuildRecordInsightsNewerThanTimestamp(int pageIndex, int pageSize, Date lastupdatetime) {
logger.debug("Executing getAllBuildRecordInsightsNewerThanTimestamp with parameters pageIndex: {}, pageSize: {}, lastupdatetime: {}", pageIndex, pageSize, lastupdatetime);
int count = buildRecordRepository.countAllBuildRecordInsightsNewerThanTimestamp(lastupdatetime);
logger.debug("BuildRecordInsightsCount: {}", count);
int totalPages = (int) Math.ceil((count) / (double) pageSize);
logger.debug("TotalPages of BuildRecordInsightsCount: {}", totalPages);
List<BuildRecordInsights> content = new ArrayList<BuildRecordInsights>();
if (count > 0) {
int offset = pageIndex * pageSize;
logger.debug("offset: {}", offset);
List<Object[]> rawBuildInsights = buildRecordRepository.getAllBuildRecordInsightsNewerThanTimestamp(lastupdatetime, pageSize, offset);
for (Object[] rawBuildInsight : rawBuildInsights) {
Long buildRecordId = ((BigInteger) rawBuildInsight[0]).longValue();
String buildContentId = (String) rawBuildInsight[1];
buildContentId = StringUtils.isEmpty(buildContentId) ? LongBase32IdConverter.toString(buildRecordId) : buildContentId;
Date submitTime = (Date) rawBuildInsight[2];
Date startTime = (Date) rawBuildInsight[3];
Date endTime = (Date) rawBuildInsight[4];
Date lastTime = (Date) rawBuildInsight[5];
Integer submitYear = (Integer) rawBuildInsight[6];
Integer submitMonth = (Integer) rawBuildInsight[7];
Integer submitQuarter = (Integer) rawBuildInsight[8];
String status = (String) rawBuildInsight[9];
Boolean temporaryBuild = (Boolean) rawBuildInsight[10];
Boolean autoAlign = (Boolean) rawBuildInsight[11];
Boolean brewPullActive = (Boolean) rawBuildInsight[12];
String buildType = (String) rawBuildInsight[13];
String executionRootName = (String) rawBuildInsight[14];
String executionRootVersion = (String) rawBuildInsight[15];
Integer userId = (Integer) rawBuildInsight[16];
String username = (String) rawBuildInsight[17];
Integer buildConfigurationId = (Integer) rawBuildInsight[18];
Integer buildConfigurationRev = (Integer) rawBuildInsight[19];
String buildConfigurationName = (String) rawBuildInsight[20];
Integer buildConfigSetRecordId = (Integer) rawBuildInsight[21];
Integer productMilestoneId = (Integer) rawBuildInsight[22];
String productMilestoneVersion = (String) rawBuildInsight[23];
Integer projectId = (Integer) rawBuildInsight[24];
String projectName = (String) rawBuildInsight[25];
Integer productVersionId = (Integer) rawBuildInsight[26];
String productVersion = (String) rawBuildInsight[27];
Integer productId = (Integer) rawBuildInsight[28];
String productName = (String) rawBuildInsight[29];
BuildRecordInsights buildRecordInsights = BuildRecordInsights.builder().buildId(buildRecordId).buildContentId(buildContentId).submitTime(TimeUtils.toInstant(submitTime)).startTime(TimeUtils.toInstant(startTime)).endTime(TimeUtils.toInstant(endTime)).lastUpdateTime(TimeUtils.toInstant(lastTime)).submitYear(submitYear).submitMonth(submitMonth).submitQuarter(submitQuarter).status(status).temporarybuild(temporaryBuild).autoalign(autoAlign).brewpullactive(brewPullActive).buildType(buildType).executionRootName(executionRootName).executionRootVersion(executionRootVersion).userId(userId).username(username).buildConfigurationId(buildConfigurationId).buildConfigurationRev(buildConfigurationRev).buildConfigurationName(buildConfigurationName).buildConfigSetRecordId(buildConfigSetRecordId).productMilestoneId(productMilestoneId).productMilestoneVersion(productMilestoneVersion).projectId(projectId).projectName(projectName).productVersionId(productVersionId).productVersionVersion(productVersion).productId(productId).productName(productName).build();
content.add(buildRecordInsights);
}
}
return new Page<>(pageIndex, pageSize, totalPages, count, content);
}
Aggregations