Search in sources :

Example 6 with DeliverableAnalyzerOperation

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

the class OperationsManagerImpl method newDeliverableAnalyzerOperation.

@Override
public DeliverableAnalyzerOperation newDeliverableAnalyzerOperation(String milestoneId, Map<String, String> inputParams) {
    ProductMilestone milestone = productMilestoneRepository.queryById(ProductMilestoneMapper.idMapper.toEntity(milestoneId));
    if (milestone == null) {
        throw new EmptyEntityException("Milestone with id " + milestoneId + " doesn't exist");
    }
    String operationId = Sequence.nextBase32Id();
    MDCUtils.addProcessContext(operationId);
    org.jboss.pnc.model.DeliverableAnalyzerOperation operation = org.jboss.pnc.model.DeliverableAnalyzerOperation.Builder.newBuilder().progressStatus(ProgressStatus.NEW).submitTime(Date.from(Instant.now())).productMilestone(milestone).operationParameters(inputParams).user(userService.currentUser()).id(operationId).build();
    repository.save(operation);
    analysisStatusChangedEventNotifier.fire(new OperationChangedEvent(operation, null));
    return operation;
}
Also used : EmptyEntityException(org.jboss.pnc.facade.validation.EmptyEntityException) DeliverableAnalyzerOperation(org.jboss.pnc.model.DeliverableAnalyzerOperation) ProductMilestone(org.jboss.pnc.model.ProductMilestone)

Aggregations

DeliverableAnalyzerOperation (org.jboss.pnc.model.DeliverableAnalyzerOperation)6 HashMap (java.util.HashMap)3 Base32LongID (org.jboss.pnc.model.Base32LongID)3 Serializable (java.io.Serializable)2 Date (java.util.Date)2 GenericEntity (org.jboss.pnc.model.GenericEntity)2 Before (org.junit.Before)2 Test (org.junit.Test)2 Calendar (java.util.Calendar)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 TransactionAttribute (javax.ejb.TransactionAttribute)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Condition (org.assertj.core.api.Condition)1 ProgressStatus (org.jboss.pnc.api.enums.ProgressStatus)1 Page (org.jboss.pnc.dto.response.Page)1 UserService (org.jboss.pnc.facade.util.UserService)1 EmptyEntityException (org.jboss.pnc.facade.validation.EmptyEntityException)1 DeliverableAnalyzerOperationMapper (org.jboss.pnc.mapper.api.DeliverableAnalyzerOperationMapper)1 Artifact (org.jboss.pnc.model.Artifact)1