private ManagedStatus getManagedStatus(final Repository repository) { if (repository.getEnvironment() != null) { final Boolean managed = (Boolean) repository.getEnvironment().get(MANAGED); if (Boolean.TRUE.equals(managed)) { return ManagedStatus.MANAGED; } else { return ManagedStatus.UNMANAGED; } } else { return ManagedStatus.UNKNOWN; } }
private ManagedStatus getManagedStatus(final Repository repository) { if (repository.getEnvironment() != null) { final Boolean managed = (Boolean) repository.getEnvironment().get(MANAGED); if (Boolean.TRUE.equals(managed)) { return ManagedStatus.MANAGED; } else { return ManagedStatus.UNMANAGED; } } else { return ManagedStatus.UNKNOWN; } }
public boolean isManaged(Repository value) { return value != null && value.getEnvironment() != null && Boolean.TRUE.equals(value.getEnvironment().get("managed")); }
@Override public String execute(CliContext context) { StringBuffer result = new StringBuffer(); WeldContainer container = context.getContainer(); RepositoryService repositoryService = container.instance().select(RepositoryService.class).get(); Collection<Repository> repositories = repositoryService.getRepositories(); result.append("Currently available repositories: \n"); for (Repository config : repositories) { result.append("\tRepository " + config.getAlias() + "\n"); result.append("\t scheme: " + config.getScheme() + "\n"); result.append("\t uri: " + config.getUri() + "\n"); result.append("\t environment: " + printEnvironment(config.getEnvironment()) + "\n"); result.append("\t groups: " + config.getGroups() + "\n"); } return result.toString(); }
@Override protected Repository resolveGitRepository(final ExampleRepository exampleRepository) { if (exampleRepository.equals(playgroundRepository)) { return clonedRepositories.stream().filter(r -> exampleRepository.getUrl().equals(r.getEnvironment().get("origin"))).findFirst().orElseGet(() -> cloneRepository(exampleRepository.getUrl())); } else { Credentials credentials = exampleRepository.getCredentials(); String username = null; String password = null; if (credentials != null) { username = credentials.getUsername(); password = credentials.getPassword(); } return cloneRepository(exampleRepository.getUrl(), username, password); } }
@Override public String execute( CliContext context ) { StringBuffer result = new StringBuffer(); WeldContainer container = context.getContainer(); OrganizationalUnitService organizationalUnitService = container.instance().select( OrganizationalUnitService.class ).get(); Collection<OrganizationalUnit> groups = organizationalUnitService.getOrganizationalUnits(); result.append( "Currently available Organizational Units: \n" ); for ( OrganizationalUnit config : groups ) { result.append( "\tOrganizational Unit " + config.getName() + "\n" ); result.append( "\towner: " + config.getOwner() + "\n" ); result.append( "\tgroups: " + config.getGroups() + "\n" ); result.append( "\trepositories: \n" ); for ( Repository repository : config.getRepositories() ) { result.append( "\t\tRepository " + repository.getAlias() + "\n" ); result.append( "\t\t\t scheme: " + repository.getScheme() + "\n" ); result.append( "\t\t\t uri: " + repository.getUri() + "\n" ); result.append( "\t\t\t environment: " + printEnvironment(repository.getEnvironment()) + "\n" ); result.append( "\t\t\t repository groups: " + repository.getGroups() + "\n" ); } } return result.toString(); }