use of org.jboss.pnc.dto.response.RepositoryCreationResponse in project pnc by project-ncl.
the class SCMRepositoryProviderImpl method createSCMRepository.
@Override
public RepositoryCreationResponse createSCMRepository(String scmUrl, String revision, Boolean preBuildSyncEnabled, JobNotificationType jobType, Consumer<RepositoryCreated> consumer, Optional<BuildConfiguration> buildConfiguration) {
log.trace("Received request to start RC creation with url autodetect: " + scmUrl + " (sync enabled? " + preBuildSyncEnabled + ")");
if (StringUtils.isEmpty(scmUrl))
throw new InvalidEntityException("You must specify the SCM URL.");
if (scmUrl.contains(config.getInternalScmAuthority())) {
// validation phase
validateInternalRepository(scmUrl);
validateRepositoryWithInternalURLDoesNotExist(scmUrl, null);
SCMRepository scmRepository = createSCMRepositoryFromValues(null, scmUrl, false);
consumer.accept(new RepositoryCreated(null, Integer.valueOf(scmRepository.getId())));
return new RepositoryCreationResponse(scmRepository);
} else {
validateRepositoryWithExternalURLDoesNotExist(scmUrl, null);
boolean sync = preBuildSyncEnabled == null || preBuildSyncEnabled;
Integer taskId = startRCreationTask(scmUrl, revision, sync, jobType, consumer, buildConfiguration);
return new RepositoryCreationResponse(taskId);
}
}
Aggregations