]> source.dussan.org Git - archiva.git/commitdiff
[MRM-817]
authorMaria Odea B. Ching <oching@apache.org>
Fri, 25 Jul 2008 11:57:38 +0000 (11:57 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Fri, 25 Jul 2008 11:57:38 +0000 (11:57 +0000)
submitted by Gwen Harold Autencio
-in the artifact information tab, display the repo id where the artifact came from

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@679767 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/browsing/DefaultRepositoryBrowsing.java
archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/browsing/RepositoryBrowsing.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactInfo.jspf

index 2e87bcf8e8d6c6f1a9bbc474597df207c0eb8038..65a8a054615b663790b22377cbbf6620cb89cd8c 100644 (file)
@@ -130,7 +130,17 @@ public class DefaultRepositoryBrowsing
 
         return model;
     }
+    
+    public String getRepositoryId( String principle, List<String> observableRepositoryIds, String groupId,
+                                   String artifactId, String version )
+        throws ObjectNotFoundException, ArchivaDatabaseException
+    {
+        ArchivaArtifact pomArchivaArtifact =
+            getArtifact( principle, observableRepositoryIds, groupId, artifactId, version );
 
+        return pomArchivaArtifact.getModel().getRepositoryId();
+    }
+    
     private ArchivaArtifact getArtifact( String principle, List<String> observableRepositoryIds, String groupId,
                                          String artifactId, String version )
         throws ObjectNotFoundException, ArchivaDatabaseException
@@ -295,5 +305,5 @@ public class DefaultRepositoryBrowsing
             throw e;
         }
     }
-
+    
 }
index 4cea469419251bdb4bd0053a0ebc1c78699f1530..ef4d8ed8e4be4c883f6dec913d09c531a5ab023b 100644 (file)
@@ -85,4 +85,9 @@ public interface RepositoryBrowsing
     public List<ArchivaProjectModel> getUsedBy( String principle, List<String> observableRepositoryIds, String groupId,
                                                 String artifactId, String version )
         throws ArchivaDatabaseException;
+
+    
+    public String getRepositoryId( String principle, List<String> observableRepositoryIds, String groupId,
+                                       String artifactId, String version )
+        throws ObjectNotFoundException, ArchivaDatabaseException;
 }
index fc0f4757dd22acc0a0c406764fb9c7084c312c39..7dee82270565ea6783018de9361b680a4fb3965d 100644 (file)
@@ -57,6 +57,8 @@ public class BrowseAction
     private String groupId;
 
     private String artifactId;
+    
+    private String repositoryId;
 
     public String browse()
     {
@@ -168,4 +170,14 @@ public class BrowseAction
     {
         return results;
     }
+    
+    public String getRepositoryId(){
+       
+       return repositoryId;
+    }
+    
+    public void setRepositoryId(String repositoryId){
+       
+       this.repositoryId = repositoryId;
+    }
 }
index 286d32561805af46d001b365e6a94320d348abc7..97dca610eb09c739c17fb899250257121ed7c8f0 100644 (file)
@@ -38,9 +38,10 @@ import com.opensymphony.xwork.ActionContext;
 import com.opensymphony.xwork.Validateable;
 
 /**
- * Browse the repository.
- *
+ * Browse the repository. 
+ * 
  * TODO change name to ShowVersionedAction to conform to terminology.
+ * 
  * @plexus.component role="com.opensymphony.xwork.Action" role-hint="showArtifactAction"
  */
 public class ShowArtifactAction
@@ -53,12 +54,12 @@ public class ShowArtifactAction
      * @plexus.requirement role-hint="default"
      */
     private RepositoryBrowsing repoBrowsing;
-    
+
     /**
      * @plexus.requirement
      */
     private UserRepositories userRepositories;
-    
+
     /* .\ Input Parameters \.________________________________________ */
 
     private String groupId;
@@ -67,6 +68,8 @@ public class ShowArtifactAction
 
     private String version;
 
+    private String repositoryId;
+
     /* .\ Exposed Output Objects \.__________________________________ */
 
     /**
@@ -89,16 +92,17 @@ public class ShowArtifactAction
     private List dependencies;
 
     /**
-     * Show the versioned project information tab.
-     * 
-     * TODO: Change name to 'project'
+     * Show the versioned project information tab. TODO: Change name to 'project'
      */
     public String artifact()
         throws ObjectNotFoundException, ArchivaDatabaseException
     {
         try
         {
-            this.model = repoBrowsing.selectVersion( getPrincipal(), getObservableRepos(), groupId, artifactId, version );
+            this.model =
+                repoBrowsing.selectVersion( getPrincipal(), getObservableRepos(), groupId, artifactId, version );
+            this.repositoryId =
+                repoBrowsing.getRepositoryId( getPrincipal(), getObservableRepos(), groupId, artifactId, version );
         }
         catch ( ObjectNotFoundException oe )
         {
@@ -142,7 +146,8 @@ public class ShowArtifactAction
         throws ObjectNotFoundException, ArchivaDatabaseException
     {
         System.out.println( "#### In reports." );
-        // TODO: hook up reports on project - this.reports = artifactsDatabase.findArtifactResults( groupId, artifactId, version );
+        // TODO: hook up reports on project - this.reports = artifactsDatabase.findArtifactResults( groupId, artifactId,
+        // version );
         System.out.println( "#### Found " + reports.size() + " reports." );
 
         return SUCCESS;
@@ -171,12 +176,12 @@ public class ShowArtifactAction
 
         return SUCCESS;
     }
-    
+
     private String getPrincipal()
     {
         return ArchivaXworkUser.getActivePrincipal( ActionContext.getContext().getSession() );
     }
-    
+
     private List<String> getObservableRepos()
     {
         try
@@ -271,4 +276,15 @@ public class ShowArtifactAction
     {
         return dependees;
     }
+
+    public String getRepositoryId()
+    {
+        return repositoryId;
+    }
+
+    public void setRepositoryId( String repositoryId )
+    {
+        this.repositoryId = repositoryId;
+    }
+
 }
index 124968aa526df99ebe296c31f5f28be454240129..c440fea846e095905753f3bc590b5fe60dcd4215 100644 (file)
 </c:if>
 
 <table class="infoTable">
+  <tr>
+    <th>Repository</th>
+    <td>${repositoryId}</td>
+  </tr>
   <tr>
     <th>Group ID</th>
     <td>${model.groupId}</td>