/** * Gets the list of all branches, for all projects, which are properly configured for SVN. */ protected Stream<Branch> getSVNConfiguredBranches() { return structureService.getProjectList() .stream() // ...which have a SVN configuration .filter(project -> propertyService.hasProperty(project, SVNProjectConfigurationPropertyType.class)) // ...gets all their branches .flatMap(project -> structureService.getBranchesForProject(project.getId()).stream()) // ...which have a SVN configuration .filter(branch -> propertyService.hasProperty(branch, SVNBranchConfigurationPropertyType.class)); } }
@Override public Stream<JobRegistration> collectJobRegistrations() { if (artifactoryConfProperties.isBuildSyncDisabled()) { return Stream.empty(); } else { return securityService.asAdmin(() -> // For all projects... structureService.getProjectList().stream() // ... and their branches .flatMap(project -> structureService.getBranchesForProject(project.getId()).stream()) // ... only if not a template .filter(branch -> branch.getType() != BranchType.TEMPLATE_DEFINITION) // ... gets those with the sync. property .filter(branch -> propertyService.hasProperty(branch, ArtifactoryPromotionSyncPropertyType.class)) // ... creates the job .map(this::scheduleArtifactoryBuildSync) ); } }
@Override public void forEachConfiguredBranch( Predicate<SVNProjectConfigurationProperty> projectConfigurationPredicate, BiConsumer<Branch, SVNBranchConfigurationProperty> branchConsumer) { // Loops over all authorised branches for (Project project : structureService.getProjectList()) { // Filter on SVN configuration: must be present and equal to the one the revision info is looked into Property<SVNProjectConfigurationProperty> projectSvnConfig = propertyService.getProperty(project, SVNProjectConfigurationPropertyType.class); if (!projectSvnConfig.isEmpty() && projectConfigurationPredicate.test(projectSvnConfig.getValue())) { structureService.getBranchesForProject(project.getId()).stream() .filter(branch -> propertyService.hasProperty(branch, SVNBranchConfigurationPropertyType.class)) .forEach(branch -> { // Branch configuration SVNBranchConfigurationProperty branchConfiguration = propertyService.getProperty(branch, SVNBranchConfigurationPropertyType.class).getValue(); // OK branchConsumer.accept(branch, branchConfiguration); }); } } }
Collection<BranchStatusView> branchStatusViews = new ArrayList<>(); for (Project project : structureService.getProjectList()) {