Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add member repositories getter

Signed-off-by: Alin Dreghiciu <adreghiciu@gmail.com>
  • Loading branch information...
commit 096c9a56e25109136dbba6f3d35af02e91dc6729 1 parent ea17031
Alin Dreghiciu authored October 31, 2012
4  ...nexus-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/repository/GroupRepository.java
@@ -12,6 +12,8 @@
12 12
  */
13 13
 package org.sonatype.nexus.client.core.subsystem.repository;
14 14
 
  15
+import java.util.List;
  16
+
15 17
 /**
16 18
  * A Nexus group {@link Repository}.
17 19
  *
@@ -21,6 +23,8 @@
21 23
     extends Repository<T, RepositoryStatus>
22 24
 {
23 25
 
  26
+    List<String> memberRepositories();
  27
+
24 28
     /**
25 29
      * Configures member repositories. Provided member repositories will replace exiting members (if any).
26 30
      *
25  ...main/java/org/sonatype/nexus/client/internal/rest/jersey/subsystem/repository/JerseyGroupRepository.java
@@ -12,12 +12,18 @@
12 12
  */
13 13
 package org.sonatype.nexus.client.internal.rest.jersey.subsystem.repository;
14 14
 
  15
+import java.util.Collections;
  16
+import java.util.List;
  17
+import javax.annotation.Nullable;
  18
+
15 19
 import org.sonatype.nexus.client.core.subsystem.repository.GroupRepository;
16 20
 import org.sonatype.nexus.client.core.subsystem.repository.RepositoryStatus;
17 21
 import org.sonatype.nexus.client.rest.jersey.JerseyNexusClient;
18 22
 import org.sonatype.nexus.rest.model.RepositoryGroupMemberRepository;
19 23
 import org.sonatype.nexus.rest.model.RepositoryGroupResource;
20 24
 import org.sonatype.nexus.rest.model.RepositoryGroupResourceResponse;
  25
+import com.google.common.base.Function;
  26
+import com.google.common.collect.Lists;
21 27
 
22 28
 /**
23 29
  * Jersey based {@link GroupRepository} implementation.
@@ -103,6 +109,25 @@ RepositoryGroupResource doUpdate()
103 109
     }
104 110
 
105 111
     @Override
  112
+    public List<String> memberRepositories()
  113
+    {
  114
+        final List<RepositoryGroupMemberRepository> memberRepositories = settings().getRepositories();
  115
+        if ( memberRepositories == null )
  116
+        {
  117
+            return Collections.emptyList();
  118
+        }
  119
+        return Collections.unmodifiableList(
  120
+            Lists.transform( memberRepositories, new Function<RepositoryGroupMemberRepository, String>()
  121
+            {
  122
+                @Override
  123
+                public String apply( @Nullable final RepositoryGroupMemberRepository member )
  124
+                {
  125
+                    return member == null ? null : member.getId();
  126
+                }
  127
+            } ) );
  128
+    }
  129
+
  130
+    @Override
106 131
     public T ofRepositories( final String... memberRepositoryIds )
107 132
     {
108 133
         for ( final String memberRepositoryId : memberRepositoryIds )

0 notes on commit 096c9a5

Please sign in to comment.
Something went wrong with that request. Please try again.