/** * Returns the ID of the project that contains this entity. This method won't return <code>null</code> * but the ID could be {@linkplain ID#NONE undefined}. */ @JsonIgnore default ID getProjectId() { return getProject().getId(); }
/** * 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); }); } } }
return structureService.buildSearch(project.getId(), form);
@Override public Event deleteProject(Project project) { return Event.of(DELETE_PROJECT) .with("project", project.getName()) .with("project_id", project.getId().toString()) .get(); }
protected Account doCreateAccountWithProjectRole(Project project, String role) throws Exception { Account account = doCreateAccount(); return asUser().with(project, ProjectAuthorisationMgt.class).call(() -> { accountService.saveProjectPermission( project.getId(), PermissionTargetType.ACCOUNT, account.id(), new PermissionInput(role) ); return accountService.withACL( AuthenticatedAccount.of(account) ); }); }
@Override public void saveProject(Project project) { getNamedParameterJdbcTemplate().update( "UPDATE PROJECTS SET NAME = :name, DESCRIPTION = :description, DISABLED = :disabled WHERE ID = :id", params("name", project.getName()) .addValue("description", project.getDescription()) .addValue("disabled", project.isDisabled()) .addValue("id", project.getId().getValue()) ); }
if (!projectSvnConfig.isEmpty() && repository.getConfiguration().getName().equals(projectSvnConfig.getValue().getConfiguration().getName())) { for (Branch branch : structureService.getBranchesForProject(project.getId())) {
@Override public List<Link> links(SVNChangeLog changeLog, ResourceContext resourceContext) { return resourceContext.links() .link("_revisions", on(SVNController.class).changeLogRevisions(changeLog.getUuid())) .link("_issues", on(SVNController.class).changeLogIssues(changeLog.getUuid()), changeLog.getRepository().getConfiguredIssueService() != null) .link("_files", on(SVNController.class).changeLogFiles(changeLog.getUuid())) .link("_changeLogFileFilters", on(SCMController.class).getChangeLogFileFilters(changeLog.getProject().getId())) .link("_diff", on(SVNController.class).diff(null)) .link("_exportFormats", on(SVNController.class).changeLogExportFormats(changeLog.getBranch().getId())) .link("_exportIssues", on(SVNController.class).changeLog(new IssueChangeLogExportRequest())) .page( "_page", "extension/svn/changelog?from=%d&to=%d", changeLog.getFrom().getBuild().id(), changeLog.getTo().getBuild().id() ) .build(); }