Search in sources :

Example 6 with BuildPushResult

use of org.jboss.pnc.dto.BuildPushResult in project pnc by project-ncl.

the class BrewPusherImpl method getBrewPushResult.

@Override
public BuildPushResult getBrewPushResult(String buildId) {
    Base32LongID id = BuildMapper.idMapper.toEntity(buildId);
    BuildPushResult result = null;
    Optional<InProgress.Context> pushContext = buildResultPushManager.getContext(id);
    if (pushContext.isPresent()) {
        result = BuildPushResult.builder().buildId(buildId).status(BuildPushStatus.ACCEPTED).logContext(pushContext.get().getPushResultId()).build();
    } else {
        BuildRecordPushResult latestForBuildRecord = buildRecordPushResultRepository.getLatestForBuildRecord(id);
        if (latestForBuildRecord != null) {
            return buildPushResultMapper.toDTO(latestForBuildRecord);
        }
    }
    return result;
}
Also used : Base32LongID(org.jboss.pnc.model.Base32LongID) BuildPushResult(org.jboss.pnc.dto.BuildPushResult) BuildRecordPushResult(org.jboss.pnc.model.BuildRecordPushResult)

Aggregations

BuildPushResult (org.jboss.pnc.dto.BuildPushResult)6 BuildPushParameters (org.jboss.pnc.dto.requests.BuildPushParameters)3 AlreadyRunningException (org.jboss.pnc.facade.validation.AlreadyRunningException)2 OperationNotAllowedException (org.jboss.pnc.facade.validation.OperationNotAllowedException)2 BuildRecord (org.jboss.pnc.model.BuildRecord)2 BuildRecordPushResult (org.jboss.pnc.model.BuildRecordPushResult)2 ProcessException (org.jboss.pnc.spi.coordinator.ProcessException)2 HashSet (java.util.HashSet)1 PncBuild (org.jboss.pnc.bacon.pig.impl.pnc.PncBuild)1 BuildPushOperation (org.jboss.pnc.bpm.causeway.BuildPushOperation)1 Result (org.jboss.pnc.bpm.causeway.Result)1 BuildClient (org.jboss.pnc.client.BuildClient)1 RemoteResourceException (org.jboss.pnc.client.RemoteResourceException)1 Build (org.jboss.pnc.dto.Build)1 InvalidEntityException (org.jboss.pnc.facade.validation.InvalidEntityException)1 Artifact (org.jboss.pnc.model.Artifact)1 Base32LongID (org.jboss.pnc.model.Base32LongID)1 AdvancedBuildClient (org.jboss.pnc.restclient.AdvancedBuildClient)1 InconsistentDataException (org.jboss.pnc.spi.datastore.InconsistentDataException)1 ContainerTest (org.jboss.pnc.test.category.ContainerTest)1