use of org.jboss.pnc.model.Project in project pnc by project-ncl.
the class Producers method project.
Project project() {
Project project = Project.Builder.newBuilder().name(randomAlphabetic(20)).build();
projectRepository.save(project);
return project;
}
use of org.jboss.pnc.model.Project in project pnc by project-ncl.
the class BuildConfigurationAuditedRepositoryImpl method searchIdRevForBuildConfigurationNameOrProjectName.
@Override
public List<IdRev> searchIdRevForBuildConfigurationNameOrProjectName(List<Project> projectsMatchingName, String name) {
AuditDisjunction disjunction = AuditEntity.disjunction();
projectsMatchingName.forEach(project -> disjunction.add(AuditEntity.relatedId("project").eq(project.getId())));
disjunction.add(AuditEntity.property("name").like(name));
List<Object[]> result = AuditReaderFactory.get(entityManager).createQuery().forRevisionsOfEntity(BuildConfiguration.class, false, false).add(disjunction).addOrder(AuditEntity.revisionNumber().desc()).getResultList();
return result.stream().map(o -> {
BuildConfiguration buildConfiguration = (BuildConfiguration) o[0];
DefaultRevisionEntity revisionEntity = (DefaultRevisionEntity) o[1];
return new IdRev(buildConfiguration.getId(), revisionEntity.getId());
}).collect(Collectors.toList());
}
use of org.jboss.pnc.model.Project in project pnc by project-ncl.
the class DatastoreAdapter method loadBuildConfigurations.
/**
* Fetch build configurations of project to be able access it outside transaction
*
* @param buildConfigAudited build config for which the build configurations are to be fetched
*/
private void loadBuildConfigurations(BuildConfigurationAudited buildConfigAudited) {
Project project = buildConfigAudited.getProject();
project.getBuildConfigurations().forEach(BuildConfiguration::getId);
}
Aggregations