use of org.jboss.pnc.model.Operation 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;
}
use of org.jboss.pnc.model.Operation 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;
}
Aggregations