]> source.dussan.org Git - archiva.git/commitdiff
[MRM-694] display the groups in the repositories page
authorBrett Porter <brett@apache.org>
Fri, 18 Apr 2008 10:40:45 +0000 (10:40 +0000)
committerBrett Porter <brett@apache.org>
Fri, 18 Apr 2008 10:40:45 +0000 (10:40 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@649453 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/repositories.jsp

index 041e3b8f2eb870d2a8e4da9c302c324d2beb1a86..57770b885bd680af4bf5220ad0c1f4c690e01191 100644 (file)
         </field>
       </fields>
       <codeSegments>
+        <codeSegment>
+          <version>1.2.0+</version>
+          <code><![CDATA[
+    private java.util.Map<String, java.util.List<String>> repositoryToGroupMap; 
+    
+    public java.util.Map<String, java.util.List<String>> getRepositoryToGroupMap()
+    {
+        if ( repositoryToGroupMap == null )
+        {
+            java.util.Map<String, java.util.List<String>> map = new java.util.HashMap<String, java.util.List<String>>();
+            
+            for ( RepositoryGroupConfiguration group : (java.util.List<RepositoryGroupConfiguration>) repositoryGroups )
+            {
+                for ( String repositoryId : (java.util.List<String>) group.getRepositories() )
+                {
+                    java.util.List<String> groups = map.get( repositoryId );
+                    if ( groups == null )
+                    {
+                        groups = new java.util.ArrayList<String>();
+                        map.put( repositoryId, groups );
+                    }
+                    groups.add( group.getId() );
+                }
+            }
+            
+            repositoryToGroupMap = map;
+        }
+        return repositoryToGroupMap;
+    }
+          ]]></code>
+        </codeSegment>
         <codeSegment>
           <version>1.0.0+</version>
           <code><![CDATA[
index 0962df6166ab4d6e3767e819ec391fb69bc276b2..3dda6d7d52b8a378e134334e33d447dcdaca5a70 100644 (file)
@@ -65,6 +65,8 @@ public class RepositoriesAction
     private List<RemoteRepositoryConfiguration> remoteRepositories;
 
     private Map<String, RepositoryContentStatistics> repositoryStatistics;
+    
+    private Map<String, List<String>> repositoryToGroupMap;
 
     /**
      * @plexus.requirement role-hint="jdo"
@@ -99,6 +101,7 @@ public class RepositoriesAction
 
         remoteRepositories = new ArrayList<RemoteRepositoryConfiguration>( config.getRemoteRepositories() );
         managedRepositories = new ArrayList<ManagedRepositoryConfiguration>( config.getManagedRepositories() );
+        repositoryToGroupMap = config.getRepositoryToGroupMap();
 
         Collections.sort( managedRepositories, new RepositoryConfigurationComparator() );
         Collections.sort( remoteRepositories, new RepositoryConfigurationComparator() );
@@ -134,4 +137,9 @@ public class RepositoriesAction
     {
         return baseUrl;
     }
+
+    public Map<String, List<String>> getRepositoryToGroupMap()
+    {
+        return repositoryToGroupMap;
+    }
 }
index fcd72989afe9c15d726171d22b1159ad35dfafb1..eb77e6f48203af3750a7e9434cf668a2452decba 100644 (file)
   <th>Directory</th>
   <td>${repository.location}</td>
 </tr>
-<tr>
-  <th>Index Directory</th>
-  <td>${repository.indexDir}</td>
-</tr>
+<c:if test="${!empty(repository.indexDir)}">
+       <tr>
+         <th>Index Directory</th>
+         <td>${repository.indexDir}</td>
+       </tr>
+</c:if>
 <tr>
   <th>WebDAV URL</th>
   <td><a href="${baseUrl}/${repository.id}/">${baseUrl}/${repository.id}/</a></td>
     </c:choose>
   </td>
 </tr>
+<c:if test="${!empty(repositoryToGroupMap[repository.id])}">
+  <tr>
+    <th>Groups</th>
+    <td>
+      <c:forEach items="${repositoryToGroupMap[repository.id]}" varStatus="i" var="group">
+        ${group}<c:if test="${!i.last}">,</c:if>        
+      </c:forEach>
+    </td>
+  </tr>
+</c:if>
 <tr>
   <th>Releases Included</th>
   <td class="${repository.releases ? 'donemark' : 'errormark'} booleanIcon"> </td>