Search in sources :

Example 16 with IdRev

use of org.jboss.pnc.model.IdRev in project pnc by project-ncl.

the class ArtifactProviderImpl method getRevision.

@Override
public ArtifactRevision getRevision(String id, Integer rev) {
    IdRev idRev = new IdRev(Integer.valueOf(id), rev);
    ArtifactAudited auditedArtifact = artifactAuditedRepository.queryById(idRev);
    return artifactRevisionMapper.toDTO(auditedArtifact);
}
Also used : IdRev(org.jboss.pnc.model.IdRev) ArtifactAudited(org.jboss.pnc.model.ArtifactAudited)

Example 17 with IdRev

use of org.jboss.pnc.model.IdRev in project pnc by project-ncl.

the class BuildConfigurationProviderImpl method getRevision.

@Override
public BuildConfigurationRevision getRevision(String id, Integer rev) {
    IdRev idRev = new IdRev(Integer.valueOf(id), rev);
    BuildConfigurationAudited auditedBuildConfig = buildConfigurationAuditedRepository.queryById(idRev);
    return buildConfigurationRevisionMapper.toDTO(auditedBuildConfig);
}
Also used : BuildConfigurationAudited(org.jboss.pnc.model.BuildConfigurationAudited) IdRev(org.jboss.pnc.model.IdRev)

Example 18 with IdRev

use of org.jboss.pnc.model.IdRev in project pnc by project-ncl.

the class BuildTriggererImpl method doTriggerBuild.

private BuildSetTask doTriggerBuild(final int buildConfigId, OptionalInt buildConfigurationRevision, BuildOptions buildOptions) throws BuildConflictException, CoreException {
    BuildSetTask buildSetTask;
    if (buildConfigurationRevision.isPresent()) {
        final BuildConfigurationAudited buildConfigurationAudited = buildConfigurationAuditedRepository.queryById(new IdRev(buildConfigId, buildConfigurationRevision.getAsInt()));
        Preconditions.checkArgument(buildConfigurationAudited != null, "Can't find Build Configuration with id=" + buildConfigId + ", rev=" + buildConfigurationRevision.getAsInt());
        buildSetTask = buildCoordinator.build(hibernateLazyInitializer.initializeBuildConfigurationAuditedBeforeTriggeringIt(buildConfigurationAudited), user.currentUser(), buildOptions);
    } else {
        final BuildConfiguration buildConfiguration = buildConfigurationRepository.queryById(buildConfigId);
        Preconditions.checkArgument(buildConfiguration != null, "Can't find Build Configuration with id=" + buildConfigId);
        buildSetTask = buildCoordinator.build(hibernateLazyInitializer.initializeBuildConfigurationBeforeTriggeringIt(buildConfiguration), user.currentUser(), buildOptions);
    }
    logger.info("Started build of Build Configuration {}. Build Tasks: {}", buildConfigId, buildSetTask.getBuildTasks().stream().map(BuildTask::getId).collect(Collectors.joining()));
    return buildSetTask;
}
Also used : BuildConfiguration(org.jboss.pnc.model.BuildConfiguration) BuildConfigurationAudited(org.jboss.pnc.model.BuildConfigurationAudited) BuildTask(org.jboss.pnc.spi.coordinator.BuildTask) BuildSetTask(org.jboss.pnc.spi.coordinator.BuildSetTask) IdRev(org.jboss.pnc.model.IdRev)

Aggregations

IdRev (org.jboss.pnc.model.IdRev)18 BuildConfigurationAudited (org.jboss.pnc.model.BuildConfigurationAudited)14 BuildConfiguration (org.jboss.pnc.model.BuildConfiguration)9 BuildRecord (org.jboss.pnc.model.BuildRecord)7 List (java.util.List)5 Map (java.util.Map)5 Set (java.util.Set)5 Collectors (java.util.stream.Collectors)5 Stateless (javax.ejb.Stateless)5 Inject (javax.inject.Inject)5 Base32LongID (org.jboss.pnc.model.Base32LongID)5 BuildConfigurationAuditedRepository (org.jboss.pnc.spi.datastore.repositories.BuildConfigurationAuditedRepository)5 Logger (org.slf4j.Logger)5 LoggerFactory (org.slf4j.LoggerFactory)5 EntityManager (javax.persistence.EntityManager)4 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)4 CriteriaQuery (javax.persistence.criteria.CriteriaQuery)4 Root (javax.persistence.criteria.Root)4 AuditReaderFactory (org.hibernate.envers.AuditReaderFactory)4 DefaultRevisionEntity (org.hibernate.envers.DefaultRevisionEntity)4