Search in sources :

Example 1 with OrganizationalUnitRepositoryInfo

use of org.kie.workbench.common.screens.library.api.OrganizationalUnitRepositoryInfo in project kie-wb-common by kiegroup.

the class LibraryServiceImpl method getOrganizationalUnitRepositoryInfo.

@Override
public OrganizationalUnitRepositoryInfo getOrganizationalUnitRepositoryInfo(final OrganizationalUnit selectedOrganizationalUnit) {
    if (selectedOrganizationalUnit == null) {
        return null;
    }
    final List<OrganizationalUnit> organizationalUnits = getOrganizationalUnits();
    final OrganizationalUnit organizationalUnit = getOrganizationalUnit(selectedOrganizationalUnit.getIdentifier(), organizationalUnits).get();
    final List<Repository> repositories = new ArrayList<>(organizationalUnit.getRepositories());
    return new OrganizationalUnitRepositoryInfo(organizationalUnits, organizationalUnit, repositories);
}
Also used : ExampleRepository(org.kie.workbench.common.screens.examples.model.ExampleRepository) Repository(org.guvnor.structure.repositories.Repository) GitRepository(org.guvnor.structure.repositories.impl.git.GitRepository) OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) ExampleOrganizationalUnit(org.kie.workbench.common.screens.examples.model.ExampleOrganizationalUnit) OrganizationalUnitRepositoryInfo(org.kie.workbench.common.screens.library.api.OrganizationalUnitRepositoryInfo) ArrayList(java.util.ArrayList)

Example 2 with OrganizationalUnitRepositoryInfo

use of org.kie.workbench.common.screens.library.api.OrganizationalUnitRepositoryInfo in project kie-wb-common by kiegroup.

the class LibraryServiceImplTest method getDefaultOrganizationalUnitRepositoryInfoTest.

@Test
public void getDefaultOrganizationalUnitRepositoryInfoTest() {
    final OrganizationalUnitRepositoryInfo info = mock(OrganizationalUnitRepositoryInfo.class);
    doReturn(info).when(libraryService).getOrganizationalUnitRepositoryInfo(any(OrganizationalUnit.class));
    assertEquals(info, libraryService.getDefaultOrganizationalUnitRepositoryInfo());
}
Also used : OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) ExampleOrganizationalUnit(org.kie.workbench.common.screens.examples.model.ExampleOrganizationalUnit) OrganizationalUnitRepositoryInfo(org.kie.workbench.common.screens.library.api.OrganizationalUnitRepositoryInfo) Test(org.junit.Test)

Aggregations

OrganizationalUnit (org.guvnor.structure.organizationalunit.OrganizationalUnit)2 ExampleOrganizationalUnit (org.kie.workbench.common.screens.examples.model.ExampleOrganizationalUnit)2 OrganizationalUnitRepositoryInfo (org.kie.workbench.common.screens.library.api.OrganizationalUnitRepositoryInfo)2 ArrayList (java.util.ArrayList)1 Repository (org.guvnor.structure.repositories.Repository)1 GitRepository (org.guvnor.structure.repositories.impl.git.GitRepository)1 Test (org.junit.Test)1 ExampleRepository (org.kie.workbench.common.screens.examples.model.ExampleRepository)1