本文整理了Java中org.guvnor.structure.repositories.Repository.getContributors
方法的一些代码示例,展示了Repository.getContributors
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Repository.getContributors
方法的具体详情如下:
包路径:org.guvnor.structure.repositories.Repository
类名称:Repository
方法名:getContributors
暂无
代码示例来源:origin: kiegroup/appformer
private void checkChildrenRepositoryContributors(final OrganizationalUnit updatedOrganizationalUnit) {
repositoryService.getAllRepositories(updatedOrganizationalUnit.getSpace()).forEach(repository -> {
final List<Contributor> repositoryContributors = new ArrayList<>(repository.getContributors());
final boolean repositoryContributorsChanged = repositoryContributors.retainAll(updatedOrganizationalUnit.getContributors());
if (repositoryContributorsChanged) {
repositoryService.updateContributors(repository, repositoryContributors);
}
});
}
代码示例来源:origin: kiegroup/appformer
private void checkIfRepositoryContributorsIsNotSet(final ConfigGroup repoConfig,
final Repository repository,
final Space space) {
if (repoConfig.getConfigItem("contributors") == null) {
final Optional<ConfigGroup> spaceConfig = configurationService.getConfiguration(SPACE).stream().filter(s -> s.getName().equals(space.getName())).findFirst();
ConfigItem<List<Contributor>> spaceContributors = spaceConfig.get().getConfigItem("space-contributors");
if (spaceContributors != null) {
spaceContributors.getValue().forEach(c -> repository.getContributors().add(c));
repoConfig.addConfigItem(configurationFactory.newConfigItem("contributors", repository.getContributors()));
configurationService.updateConfiguration(repoConfig);
}
}
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-backend
private boolean userCanReadProject(final WorkspaceProject project) {
return authorizationManager.authorize(project.getRepository(), RepositoryAction.READ, sessionInfo.getIdentity())
|| project.getRepository().getContributors().stream().anyMatch(c -> c.getUsername().equals(sessionInfo.getIdentity().getIdentifier()));
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
@Override
public void getContributors(Consumer<List<Contributor>> contributorsConsumer) {
repositoryService.call((Repository repository) -> {
contributorsConsumer.accept(new ArrayList<>(repository.getContributors()));
}).getRepositoryFromSpace(libraryPlaces.getActiveSpace().getSpace(), libraryPlaces.getActiveWorkspace().getRepository().getAlias());
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
private WorkspaceProject getProject() {
final Repository repository = mock(Repository.class);
final List<Contributor> projectContributors = new ArrayList<>();
doReturn(projectContributors).when(repository).getContributors();
final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
final List<Contributor> organizationalUnitContributors = new ArrayList<>();
doReturn(organizationalUnitContributors).when(organizationalUnit).getContributors();
final Branch branch = mock(Branch.class);
doReturn("branch").when(branch).getName();
final WorkspaceProject project = mock(WorkspaceProject.class);
doReturn(repository).when(project).getRepository();
doReturn(organizationalUnit).when(project).getOrganizationalUnit();
doReturn(branch).when(project).getBranch();
doReturn(mock(Module.class)).when(project).getMainModule();
return project;
}
}
代码示例来源:origin: kiegroup/appformer
public void userRemoved(final @Observes UserDeletedEvent event) {
final String removedUserIdentifier = event.getIdentifier();
for (OrganizationalUnit organizationalUnit : getAllOrganizationalUnits()) {
final boolean userRemoved = organizationalUnit.getContributors().removeIf(c -> c.getUsername().equals(removedUserIdentifier));
if (userRemoved) {
updateOrganizationalUnit(organizationalUnit.getName(),
organizationalUnit.getDefaultGroupId(),
organizationalUnit.getContributors());
}
for (Repository repository : organizationalUnit.getRepositories()) {
final List<Contributor> updatedRepositoryContributors = new ArrayList<>(repository.getContributors());
final boolean repositoryContributorRemoved = updatedRepositoryContributors.removeIf(c -> c.getUsername().equals(removedUserIdentifier));
if (repositoryContributorRemoved) {
repositoryService.updateContributors(repository,
updatedRepositoryContributors);
}
}
}
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
@Test
public void getContributorsTest() {
final List<Contributor> contributors = new ArrayList<>();
contributors.add(new Contributor("owner", ContributorType.OWNER));
contributors.add(new Contributor("contributor", ContributorType.CONTRIBUTOR));
contributors.add(new Contributor("admin", ContributorType.ADMIN));
final Repository repository = mock(Repository.class);
doReturn(contributors).when(repository).getContributors();
doReturn(repository).when(repositoryService).getRepositoryFromSpace(any(), any());
service.getContributors(repositoryContributors -> {
assertEquals(3, repositoryContributors.size());
});
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
public boolean userCanDeleteBranch(final WorkspaceProject project) {
return (userIsAtLeast(ContributorType.ADMIN, project.getRepository().getContributors())
|| userIsAtLeast(ContributorType.ADMIN, project.getOrganizationalUnit().getContributors())
|| userCanDeleteProject(project))
&& !project.getBranch().getName().equals("master");
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
public boolean userCanDeleteProject(final WorkspaceProject project) {
return userIsAtLeast(ContributorType.OWNER, project.getRepository().getContributors())
|| userIsAtLeast(ContributorType.ADMIN, project.getOrganizationalUnit().getContributors())
|| projectController.canDeleteProject(project);
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
public boolean userCanBuildProject(final WorkspaceProject project) {
return (userIsAtLeast(ContributorType.ADMIN, project.getRepository().getContributors())
|| userIsAtLeast(ContributorType.CONTRIBUTOR, project.getOrganizationalUnit().getContributors())
|| projectController.canBuildProject(project))
&& project.getMainModule() != null;
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
public boolean userCanUpdateProject(final WorkspaceProject project) {
return (userIsAtLeast(ContributorType.ADMIN, project.getRepository().getContributors())
|| userIsAtLeast(ContributorType.CONTRIBUTOR, project.getOrganizationalUnit().getContributors())
|| projectController.canUpdateProject(project))
&& project.getMainModule() != null;
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
public boolean userCanDeployProject(final WorkspaceProject project) {
return (userIsAtLeast(ContributorType.ADMIN, project.getRepository().getContributors())
|| userIsAtLeast(ContributorType.ADMIN, project.getOrganizationalUnit().getContributors())
|| projectController.canBuildProject(project))
&& project.getMainModule() != null;
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
@Test
public void projectContributorCanDeployProjectTest() {
final WorkspaceProject project = getProject();
final Collection<Contributor> projectContributors = project.getRepository().getContributors();
doReturn(true).when(libraryPermissions).userIsAtLeast(eq(ContributorType.ADMIN), same(projectContributors));
assertTrue(libraryPermissions.userCanDeployProject(project));
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
@Test
public void projectContributorCanDeleteBranchTest() {
final WorkspaceProject project = getProject();
final Collection<Contributor> projectContributors = project.getRepository().getContributors();
doReturn(true).when(libraryPermissions).userIsAtLeast(eq(ContributorType.ADMIN), same(projectContributors));
assertTrue(libraryPermissions.userCanDeleteBranch(project));
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
@Test
public void projectContributorCanUpdateProjectTest() {
final WorkspaceProject project = getProject();
final Collection<Contributor> projectContributors = project.getRepository().getContributors();
doReturn(true).when(libraryPermissions).userIsAtLeast(eq(ContributorType.ADMIN), same(projectContributors));
assertTrue(libraryPermissions.userCanUpdateProject(project));
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
@Test
public void projectContributorCanDeleteProjectTest() {
final WorkspaceProject project = getProject();
final Collection<Contributor> projectContributors = project.getRepository().getContributors();
doReturn(true).when(libraryPermissions).userIsAtLeast(eq(ContributorType.OWNER), same(projectContributors));
assertTrue(libraryPermissions.userCanDeleteProject(project));
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
@Test
public void projectContributorCanBuildProjectTest() {
final WorkspaceProject project = getProject();
final Collection<Contributor> projectContributors = project.getRepository().getContributors();
doReturn(true).when(libraryPermissions).userIsAtLeast(eq(ContributorType.ADMIN), same(projectContributors));
assertTrue(libraryPermissions.userCanBuildProject(project));
}
代码示例来源:origin: kiegroup/appformer
if (contributors != null) {
for (Contributor contributor : contributors.getValue()) {
repository.getContributors().add(contributor);
内容来源于网络,如有侵权,请联系作者删除!