Search in sources :

Example 1 with ProgressStatus

use of org.jboss.pnc.api.enums.ProgressStatus in project pnc by project-ncl.

the class OperationsManagerImpl method setResult.

@Override
public Operation setResult(Base32LongID id, OperationResult result) {
    Operation operation = repository.queryById(id);
    if (operation.getEndTime() != null) {
        throw new InvalidEntityException("Operation " + operation + " is already finished!");
    }
    log.debug("Updating result of operation " + operation + " to " + result);
    ProgressStatus previousProgress = operation.getProgressStatus();
    operation.setResult(result);
    operation.setEndTime(Date.from(Instant.now()));
    analysisStatusChangedEventNotifier.fire(new OperationChangedEvent(operation, previousProgress));
    return operation;
}
Also used : ProgressStatus(org.jboss.pnc.api.enums.ProgressStatus) Operation(org.jboss.pnc.model.Operation) DeliverableAnalyzerOperation(org.jboss.pnc.model.DeliverableAnalyzerOperation) InvalidEntityException(org.jboss.pnc.facade.validation.InvalidEntityException)

Example 2 with ProgressStatus

use of org.jboss.pnc.api.enums.ProgressStatus in project pnc by project-ncl.

the class OperationsManagerImpl method updateProgress.

@Override
public Operation updateProgress(Base32LongID id, ProgressStatus status) {
    Operation operation = repository.queryById(id);
    if (operation.getEndTime() != null) {
        throw new InvalidEntityException("Operation " + operation + " is already finished!");
    }
    log.debug("Updating progress of operation " + operation + " to " + status);
    if (operation.getStartTime() == null && status == ProgressStatus.IN_PROGRESS) {
        operation.setStartTime(Date.from(Instant.now()));
    }
    ProgressStatus previousProgress = operation.getProgressStatus();
    operation.setProgressStatus(status);
    analysisStatusChangedEventNotifier.fire(new OperationChangedEvent(operation, previousProgress));
    return operation;
}
Also used : ProgressStatus(org.jboss.pnc.api.enums.ProgressStatus) Operation(org.jboss.pnc.model.Operation) DeliverableAnalyzerOperation(org.jboss.pnc.model.DeliverableAnalyzerOperation) InvalidEntityException(org.jboss.pnc.facade.validation.InvalidEntityException)

Aggregations

ProgressStatus (org.jboss.pnc.api.enums.ProgressStatus)2 InvalidEntityException (org.jboss.pnc.facade.validation.InvalidEntityException)2 DeliverableAnalyzerOperation (org.jboss.pnc.model.DeliverableAnalyzerOperation)2 Operation (org.jboss.pnc.model.Operation)2