org.guvnor.structure.repositories.Repository.getIdentifier()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(12.9k)|赞(0)|评价(0)|浏览(99)

本文整理了Java中org.guvnor.structure.repositories.Repository.getIdentifier方法的一些代码示例,展示了Repository.getIdentifier的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Repository.getIdentifier方法的具体详情如下:
包路径:org.guvnor.structure.repositories.Repository
类名称:Repository
方法名:getIdentifier

Repository.getIdentifier介绍

暂无

代码示例

代码示例来源:origin: org.guvnor/guvnor-structure-backend

@Override
  public Collection<Repository> searchById(Collection<String> ids) {
    List<Repository> results = new ArrayList<>();
    for (Repository repo : repositoryService.getAllRepositories()) {
      if (ids.contains(repo.getIdentifier())) {
        results.add(repo);
      }
    }
    return results;
  }
}

代码示例来源:origin: kiegroup/appformer

public String getEncodedIdentifier() {
  return URIUtil.encodeQueryString(repository.getIdentifier());
}

代码示例来源:origin: org.uberfire/uberfire-project-api

public String getEncodedIdentifier() {
  return URIUtil.encodeQueryString(repository.getIdentifier());
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client

private boolean isRepoForActiveProject(RepositoryRemovedEvent repositoryRemovedEvent) {
  return projectContext.getActiveWorkspaceProject()
      .filter(project -> {
        Repository activeRepo = project.getRepository();
        Repository eventRepo = repositoryRemovedEvent.getRepository();
        return activeRepo.getIdentifier().equals(eventRepo.getIdentifier());
      })
      .isPresent();
}

代码示例来源:origin: kiegroup/appformer

@Override
  public Collection<Repository> searchById(Collection<String> ids) {
    List<Repository> results = new ArrayList<>();
    for (Space space : orgUnitService.getAllUserSpaces()) {
      for (Repository repo : repositoryService.getAllRepositories(space)) {
        if (ids.contains(repo.getIdentifier())) {
          results.add(repo);
        }
      }
    }
    return results;
  }
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client

public void onAssetListUpdated(@Observes @Routed ProjectAssetListUpdated event) {
  if (event.getProject().getRepository().getIdentifier().equals(workspaceProject.getRepository().getIdentifier())) {
    this.showAssets();
  }
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client

public void onAssetListUpdated(@Observes @Routed ProjectAssetListUpdated event) {
  if (event.getProject().getRepository().getIdentifier().equals(workspaceProject.getRepository().getIdentifier())) {
    update();
  }
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-backend

private static String projectIdentifierFrom(final ProjectAssetsQuery query) {
  return Optional.ofNullable(query.getProject().getRepository())
      .map(repo -> repo.getIdentifier())
      .orElseGet(() -> query.getProject().getName());
}

代码示例来源:origin: org.guvnor/guvnor-structure-backend

@Before
public void setUp() throws Exception {
  when(itemA.getIdentifier()).thenReturn("itemA");
  when(itemB.getIdentifier()).thenReturn("itemB");
  when(itemA.getAlias()).thenReturn("Item A");
  when(itemB.getAlias()).thenReturn("Item B");
  when(resourceService.getAllRepositories()).thenReturn(Arrays.asList(itemA,
                                    itemB));
  searchService = new RepositorySearchServiceImpl(resourceService);
}

代码示例来源:origin: org.uberfire/uberfire-structure-backend

@Before
public void setUp() throws Exception {
  space = new Space("test-realm");
  when(orgUnitService.getAllUserSpaces()).thenReturn(Collections.singletonList(space));
  when(itemA.getIdentifier()).thenReturn("itemA");
  when(itemB.getIdentifier()).thenReturn("itemB");
  when(itemA.getAlias()).thenReturn("Item A");
  when(itemB.getAlias()).thenReturn("Item B");
  when(resourceService.getAllRepositories(space)).thenReturn(Arrays.asList(itemA,
                                    itemB));
  searchService = new RepositorySearchServiceImpl(resourceService, orgUnitService);
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client

@Test
public void onClosedProjectDeleted() {
  doReturn(PlaceStatus.OPEN).when(placeManager).getStatus(anyString());
  final Repository anotherRepository = mock(Repository.class);
  doReturn("anotherRepository").when(anotherRepository).getIdentifier();
  libraryPlaces.onProjectDeleted(new RepositoryRemovedEvent(anotherRepository));
  verify(projectContextChangeEvent, never()).fire(any());
  verify(libraryPlaces, never()).closeAllPlaces();
  verify(libraryPlaces, never()).goToLibrary();
  verify(notificationEvent, never()).fire(any());
}

代码示例来源:origin: kiegroup/appformer

@Before
public void setUp() throws Exception {
  space = new Space("test-realm");
  when(orgUnitService.getAllUserSpaces()).thenReturn(Collections.singletonList(space));
  when(itemA.getIdentifier()).thenReturn("itemA");
  when(itemB.getIdentifier()).thenReturn("itemB");
  when(itemA.getAlias()).thenReturn("Item A");
  when(itemB.getAlias()).thenReturn("Item B");
  when(resourceService.getAllRepositories(space)).thenReturn(Arrays.asList(itemA,
                                    itemB));
  searchService = new RepositorySearchServiceImpl(resourceService, orgUnitService);
}

代码示例来源:origin: org.uberfire/uberfire-project-backend

private void setUpRepositories() {
  doReturn(Optional.of(mock(Branch.class))).when(repository1).getDefaultBranch();
  doReturn("repository1").when(repository1).getAlias();
  doReturn("space1/repository1").when(repository1).getIdentifier();
  doReturn(Optional.of(mock(Branch.class))).when(repository2).getDefaultBranch();
  doReturn("repository-with-same-alias").when(repository2).getAlias();
  doReturn("space1/repository-with-same-alias").when(repository2).getIdentifier();
  doReturn(Optional.of(mock(Branch.class))).when(repository3).getDefaultBranch();
  doReturn("repository-with-same-alias").when(repository3).getAlias();
  doReturn("space2/repository-with-same-alias").when(repository3).getIdentifier();
  allRepositories = new ArrayList<>();
  allRepositories.add(repository1);
  allRepositories.add(repository2);
  allRepositories.add(repository3);
  doReturn(allRepositories).when(repositoryService).getAllRepositoriesFromAllUserSpaces();
  doReturn(allRepositories).when(repositoryService).getAllRepositoriesFromAllUserSpaces();
  doReturn(Arrays.asList(repository1,
              repository2)).when(repositoryService).getRepositories(Mockito.eq(space1));
  doReturn(Arrays.asList(repository1,
              repository2)).when(repositoryService).getAllRepositories(Mockito.eq(space1));
  doReturn(Arrays.asList(repository3)).when(repositoryService).getAllRepositories(Mockito.eq(space2));
  doReturn(Collections.singletonList(repository3)).when(repositoryService).getRepositories(Mockito.eq(space2));
}

代码示例来源:origin: kiegroup/appformer

private void setUpRepositories() {
  doReturn(Optional.of(mock(Branch.class))).when(repository1).getDefaultBranch();
  doReturn("repository1").when(repository1).getAlias();
  doReturn("space1/repository1").when(repository1).getIdentifier();
  doReturn(Optional.of(mock(Branch.class))).when(repository2).getDefaultBranch();
  doReturn("repository-with-same-alias").when(repository2).getAlias();
  doReturn("space1/repository-with-same-alias").when(repository2).getIdentifier();
  doReturn(Optional.of(mock(Branch.class))).when(repository3).getDefaultBranch();
  doReturn("repository-with-same-alias").when(repository3).getAlias();
  doReturn("space2/repository-with-same-alias").when(repository3).getIdentifier();
  allRepositories = new ArrayList<>();
  allRepositories.add(repository1);
  allRepositories.add(repository2);
  allRepositories.add(repository3);
  doReturn(allRepositories).when(repositoryService).getAllRepositoriesFromAllUserSpaces();
  doReturn(allRepositories).when(repositoryService).getAllRepositoriesFromAllUserSpaces();
  doReturn(Arrays.asList(repository1,
              repository2)).when(repositoryService).getRepositories(Mockito.eq(space1));
  doReturn(Arrays.asList(repository1,
              repository2)).when(repositoryService).getAllRepositories(Mockito.eq(space1));
  doReturn(Arrays.asList(repository3)).when(repositoryService).getAllRepositories(Mockito.eq(space2));
  doReturn(Collections.singletonList(repository3)).when(repositoryService).getRepositories(Mockito.eq(space2));
}

代码示例来源:origin: kiegroup/appformer

@Before
public void setup() {
  permissionManager = new DefaultPermissionManager();
  treeProvider = new RepositoryTreeProvider(permissionManager,
                       new CallerMock<>(searchService));
  rootNode = treeProvider.buildRootNode();
  rootNode.setPermissionTree(permissionTree);
  when(repo1.getIdentifier()).thenReturn("r1");
  when(repo2.getIdentifier()).thenReturn("r2");
  when(repo1.getAlias()).thenReturn("r1");
  when(repo2.getAlias()).thenReturn("r2");
  when(repo1.getResourceType()).thenReturn(Repository.RESOURCE_TYPE);
  when(repo2.getResourceType()).thenReturn(Repository.RESOURCE_TYPE);
  when(permissionTree.getChildrenResourceIds(any())).thenReturn(null);
  when(searchService.searchByAlias(anyString(),
                   anyInt(),
                   anyBoolean())).thenReturn(Arrays.asList(repo1,
                                       repo2));
}

代码示例来源:origin: org.guvnor/guvnor-structure-client

@Before
public void setup() {
  permissionManager = new DefaultPermissionManager();
  treeProvider = new RepositoryTreeProvider(permissionManager,
                       new CallerMock<>(searchService));
  rootNode = treeProvider.buildRootNode();
  rootNode.setPermissionTree(permissionTree);
  when(repo1.getIdentifier()).thenReturn("r1");
  when(repo2.getIdentifier()).thenReturn("r2");
  when(repo1.getAlias()).thenReturn("r1");
  when(repo2.getAlias()).thenReturn("r2");
  when(repo1.getResourceType()).thenReturn(Repository.RESOURCE_TYPE);
  when(repo2.getResourceType()).thenReturn(Repository.RESOURCE_TYPE);
  when(permissionTree.getChildrenResourceIds(any())).thenReturn(null);
  when(searchService.searchByAlias(anyString(),
                   anyInt(),
                   anyBoolean())).thenReturn(Arrays.asList(repo1,
                                       repo2));
}

代码示例来源:origin: org.guvnor/guvnor-services-backend

@Before
public void setUp() {
  permissionManager = new DefaultPermissionManager();
  authorizationPolicy = permissionManager.newAuthorizationPolicy().build();
  migrationTool = spy(new ACLMigrationTool(organizationalUnitService,
                       repositoryService,
                       mock(Instance.class),
                       permissionManager,
                       policyStorage));
  when(migrationTool.getProjectService()).thenReturn(projectService);
  when(organizationalUnitService.getAllOrganizationalUnits()).thenReturn(Collections.singleton(orgUnit1));
  when(repositoryService.getAllRepositories()).thenReturn(Collections.singleton(repo1));
  when(projectService.getAllProjects(repo1,
                    "master")).thenReturn(Collections.singleton(project1));
  when(orgUnit1.getIdentifier()).thenReturn("orgUnit1");
  when(orgUnit1.getResourceType()).thenReturn(OrganizationalUnit.RESOURCE_TYPE);
  when(orgUnit1.getGroups()).thenReturn(Collections.singleton("group1"));
  when(repo1.getIdentifier()).thenReturn("repo1");
  when(repo1.getResourceType()).thenReturn(Repository.RESOURCE_TYPE);
  when(repo1.getGroups()).thenReturn(Collections.singleton("group1"));
  when(project1.getIdentifier()).thenReturn("project1");
  when(project1.getResourceType()).thenReturn(Project.RESOURCE_TYPE);
  when(project1.getGroups()).thenReturn(Collections.singleton("group2"));
}

代码示例来源:origin: org.uberfire/uberfire-services-backend

@Before
public void setUp() {
  permissionManager = new DefaultPermissionManager();
  authorizationPolicy = permissionManager.newAuthorizationPolicy().build();
  migrationTool = spy(new ACLMigrationTool(organizationalUnitService,
                       repositoryService,
                       permissionManager,
                       policyStorage));
  final Path repo1root = mock(Path.class);
  when(organizationalUnitService.getAllOrganizationalUnits()).thenReturn(Collections.singleton(orgUnit1));
  when(repositoryService.getAllRepositoriesFromAllUserSpaces()).thenReturn(Collections.singleton(repo1));
  when(orgUnit1.getIdentifier()).thenReturn("orgUnit1");
  when(orgUnit1.getResourceType()).thenReturn(OrganizationalUnit.RESOURCE_TYPE);
  when(orgUnit1.getGroups()).thenReturn(Collections.singleton("group1"));
  when(repo1.getIdentifier()).thenReturn("repo1");
  final Branch master = new Branch("master",
                repo1root);
  when(repo1.getBranch("master")).thenReturn(Optional.of(master));
  when(repo1.getDefaultBranch()).thenReturn(Optional.of(master));
  when(repo1.getResourceType()).thenReturn(Repository.RESOURCE_TYPE);
  final ArrayList<String> groupList = new ArrayList<>();
  groupList.add("group1");
  groupList.add("group2");
  when(repo1.getGroups()).thenReturn(groupList);
}

代码示例来源:origin: org.guvnor/guvnor-structure-backend

public RepositoryInfo getRepositoryInfo(final String alias) {
  final Repository repo = getRepository(alias);
  String ouName = null;
  for (final OrganizationalUnit ou : organizationalUnitService.getAllOrganizationalUnits()) {
    for (Repository repository : ou.getRepositories()) {
      if (repository.getAlias().equals(alias)) {
        ouName = ou.getName();
      }
    }
  }
  return new RepositoryInfo(repo.getIdentifier(),
               alias,
               ouName,
               repo.getRoot(),
               repo.getPublicURIs(),
               getRepositoryHistory(alias,
                          0,
                          HISTORY_PAGE_SIZE));
}

代码示例来源:origin: kiegroup/appformer

@Override
public RepositoryInfo getRepositoryInfo(final Space space,
                    final String alias) {
  Repository repo = getRepositoryFromSpace(space,
                       alias);
  return new RepositoryInfo(repo.getIdentifier(),
               alias,
               repo.getSpace().getName(),
               getRepositoryRootPath(repo),
               repo.getPublicURIs(),
               getRepositoryHistory(repo.getSpace(),
                          alias,
                          0,
                          HISTORY_PAGE_SIZE));
}

相关文章