]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1283] remove legacy model intermediatary
authorBrett Porter <brett@apache.org>
Fri, 27 Nov 2009 23:39:42 +0000 (23:39 +0000)
committerBrett Porter <brett@apache.org>
Fri, 27 Nov 2009 23:39:42 +0000 (23:39 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/MRM-1025@885051 13f79535-47bb-0310-9956-ffa450edef68

13 files changed:
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/browse.jsp
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/browseArtifact.jsp [deleted file]
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/browseGroup.jsp [deleted file]
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactInfo.jspf
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectDependees.jspf
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/AbstractActionTestCase.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/BrowseActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/ShowArtifactActionTest.java
archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ProjectVersionMetadata.java
archiva-modules/plugins/metadata-repository-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java

index 520cc7b6129198284d5692f7515a2027914dee35..3ad7298efbcd1e5f56b026e2752ff52a416e5ef2 100644 (file)
@@ -32,16 +32,6 @@ import org.apache.archiva.metadata.repository.MetadataResolverException;
 import org.apache.archiva.metadata.repository.storage.maven2.MavenProjectFacet;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.database.browsing.BrowsingResults;
-import org.apache.maven.archiva.model.ArchivaProjectModel;
-import org.apache.maven.archiva.model.CiManagement;
-import org.apache.maven.archiva.model.Dependency;
-import org.apache.maven.archiva.model.IssueManagement;
-import org.apache.maven.archiva.model.License;
-import org.apache.maven.archiva.model.MailingList;
-import org.apache.maven.archiva.model.Organization;
-import org.apache.maven.archiva.model.Scm;
-import org.apache.maven.archiva.model.VersionedReference;
 import org.apache.maven.archiva.security.AccessDeniedException;
 import org.apache.maven.archiva.security.ArchivaSecurityException;
 import org.apache.maven.archiva.security.PrincipalNotFoundException;
@@ -67,17 +57,19 @@ public class BrowseAction
      */
     private UserRepositories userRepositories;
 
-    // TODO: eventually, move to just use the metadata directly, with minimal JSP changes
-    private BrowsingResults results;
-
     private String groupId;
 
     private String artifactId;
 
     private String repositoryId;
 
-    // TODO: eventually, move to just use the metadata directly, with minimal JSP changes, mostly for Maven specifics
-    private ArchivaProjectModel sharedModel;
+    private ProjectVersionMetadata sharedModel;
+
+    private Collection<String> namespaces;
+
+    private Collection<String> projectIds;
+
+    private Collection<String> projectVersions;
 
     public String browse()
     {
@@ -101,9 +93,7 @@ public class BrowseAction
             }
         }
 
-        this.results = new BrowsingResults();
-        results.setGroupIds( getSortedList( namespaces ) );
-        results.setSelectedRepositoryIds( selectedRepos );
+        this.namespaces = getSortedList( namespaces );
         return SUCCESS;
     }
 
@@ -160,10 +150,8 @@ public class BrowseAction
             projects.addAll( metadataResolver.getProjects( repoId, groupId ) );
         }
 
-        this.results = new BrowsingResults( groupId );
-        results.setGroupIds( getSortedList( namespaces ) );
-        results.setArtifacts( getSortedList( projects ) );
-        results.setSelectedRepositoryIds( selectedRepos );
+        this.namespaces = getSortedList( namespaces );
+        this.projectIds = getSortedList( projects );
         return SUCCESS;
     }
 
@@ -203,25 +191,27 @@ public class BrowseAction
             versions.addAll( metadataResolver.getProjectVersions( repoId, groupId, artifactId ) );
         }
 
-        this.results = new BrowsingResults( groupId, artifactId );
         // TODO: sort by known version ordering method
-        results.setVersions( new ArrayList<String>( versions ) );
-        results.setSelectedRepositoryIds( selectedRepos );
+        this.projectVersions = new ArrayList<String>( versions );
 
-        populateSharedModel( selectedRepos );
+        populateSharedModel( selectedRepos, versions );
 
         return SUCCESS;
     }
 
-    private void populateSharedModel( Collection<String> selectedRepos )
+    private void populateSharedModel( Collection<String> selectedRepos, Collection<String> projectVersions )
         throws MetadataResolverException
     {
-        sharedModel = new ArchivaProjectModel();
-        sharedModel.setGroupId( groupId );
-        sharedModel.setArtifactId( artifactId );
+        sharedModel = new ProjectVersionMetadata();
+
+        MavenProjectFacet mavenFacet = new MavenProjectFacet();
+        mavenFacet.setGroupId( groupId );
+        mavenFacet.setArtifactId( artifactId );
+        sharedModel.addFacet( mavenFacet );
+
         boolean isFirstVersion = true;
 
-        for ( String version : this.results.getVersions() )
+        for ( String version : projectVersions )
         {
             ProjectVersionMetadata versionMetadata = null;
             for ( String repoId : selectedRepos )
@@ -237,56 +227,59 @@ public class BrowseAction
                 continue;
             }
 
-            ArchivaProjectModel model = populateLegacyModel( versionMetadata );
-
             if ( isFirstVersion )
             {
-                sharedModel = model;
-                sharedModel.setVersion( null );
+                sharedModel = versionMetadata;
+                sharedModel.setId( null );
             }
             else
             {
-                if ( sharedModel.getPackaging() != null &&
-                    !StringUtils.equalsIgnoreCase( sharedModel.getPackaging(), model.getPackaging() ) )
+                MavenProjectFacet versionMetadataMavenFacet =
+                    (MavenProjectFacet) versionMetadata.getFacet( MavenProjectFacet.FACET_ID );
+                if ( versionMetadataMavenFacet != null )
                 {
-                    sharedModel.setPackaging( null );
+                    if ( mavenFacet.getPackaging() != null && !StringUtils.equalsIgnoreCase( mavenFacet.getPackaging(),
+                                                                                             versionMetadataMavenFacet.getPackaging() ) )
+                    {
+                        mavenFacet.setPackaging( null );
+                    }
                 }
 
                 if ( sharedModel.getName() != null &&
-                    !StringUtils.equalsIgnoreCase( sharedModel.getName(), model.getName() ) )
+                    !StringUtils.equalsIgnoreCase( sharedModel.getName(), versionMetadata.getName() ) )
                 {
                     sharedModel.setName( "" );
                 }
 
                 if ( sharedModel.getDescription() != null &&
-                    !StringUtils.equalsIgnoreCase( sharedModel.getDescription(), model.getDescription() ) )
+                    !StringUtils.equalsIgnoreCase( sharedModel.getDescription(), versionMetadata.getDescription() ) )
                 {
                     sharedModel.setDescription( null );
                 }
 
-                if ( sharedModel.getIssueManagement() != null && model.getIssueManagement() != null &&
-                    !StringUtils.equalsIgnoreCase( sharedModel.getIssueManagement().getIssueManagementUrl(),
-                                                   model.getIssueManagement().getIssueManagementUrl() ) )
+                if ( sharedModel.getIssueManagement() != null && versionMetadata.getIssueManagement() != null &&
+                    !StringUtils.equalsIgnoreCase( sharedModel.getIssueManagement().getUrl(),
+                                                   versionMetadata.getIssueManagement().getUrl() ) )
                 {
                     sharedModel.setIssueManagement( null );
                 }
 
-                if ( sharedModel.getCiManagement() != null && model.getCiManagement() != null &&
-                    !StringUtils.equalsIgnoreCase( sharedModel.getCiManagement().getCiUrl(),
-                                                   model.getCiManagement().getCiUrl() ) )
+                if ( sharedModel.getCiManagement() != null && versionMetadata.getCiManagement() != null &&
+                    !StringUtils.equalsIgnoreCase( sharedModel.getCiManagement().getUrl(),
+                                                   versionMetadata.getCiManagement().getUrl() ) )
                 {
                     sharedModel.setCiManagement( null );
                 }
 
-                if ( sharedModel.getOrganization() != null && model.getOrganization() != null &&
-                    !StringUtils.equalsIgnoreCase( sharedModel.getOrganization().getOrganizationName(),
-                                                   model.getOrganization().getOrganizationName() ) )
+                if ( sharedModel.getOrganization() != null && versionMetadata.getOrganization() != null &&
+                    !StringUtils.equalsIgnoreCase( sharedModel.getOrganization().getName(),
+                                                   versionMetadata.getOrganization().getName() ) )
                 {
                     sharedModel.setOrganization( null );
                 }
 
                 if ( sharedModel.getUrl() != null &&
-                    !StringUtils.equalsIgnoreCase( sharedModel.getUrl(), model.getUrl() ) )
+                    !StringUtils.equalsIgnoreCase( sharedModel.getUrl(), versionMetadata.getUrl() ) )
                 {
                     sharedModel.setUrl( null );
                 }
@@ -296,102 +289,6 @@ public class BrowseAction
         }
     }
 
-    private ArchivaProjectModel populateLegacyModel( ProjectVersionMetadata versionMetadata )
-    {
-        // TODO: eventually, move to just use the metadata directly, with minimal JSP changes, mostly for Maven specifics
-        ArchivaProjectModel model = new ArchivaProjectModel();
-        MavenProjectFacet projectFacet = (MavenProjectFacet) versionMetadata.getFacet( MavenProjectFacet.FACET_ID );
-        if ( projectFacet != null )
-        {
-            model.setGroupId( projectFacet.getGroupId() );
-            model.setArtifactId( projectFacet.getArtifactId() );
-            model.setPackaging( projectFacet.getPackaging() );
-            if ( projectFacet.getParent() != null )
-            {
-                VersionedReference parent = new VersionedReference();
-                parent.setGroupId( projectFacet.getParent().getGroupId() );
-                parent.setArtifactId( projectFacet.getParent().getArtifactId() );
-                parent.setVersion( projectFacet.getParent().getVersion() );
-                model.setParentProject( parent );
-            }
-        }
-
-        model.setVersion( versionMetadata.getId() );
-        model.setDescription( versionMetadata.getDescription() );
-        model.setName( versionMetadata.getName() );
-        model.setUrl( versionMetadata.getUrl() );
-        if ( versionMetadata.getOrganization() != null )
-        {
-            Organization organization = new Organization();
-            organization.setName( versionMetadata.getOrganization().getName() );
-            organization.setUrl( versionMetadata.getOrganization().getUrl() );
-            model.setOrganization( organization );
-        }
-        if ( versionMetadata.getCiManagement() != null )
-        {
-            CiManagement ci = new CiManagement();
-            ci.setSystem( versionMetadata.getCiManagement().getSystem() );
-            ci.setUrl( versionMetadata.getCiManagement().getUrl() );
-            model.setCiManagement( ci );
-        }
-        if ( versionMetadata.getIssueManagement() != null )
-        {
-            IssueManagement issueManagement = new IssueManagement();
-            issueManagement.setSystem( versionMetadata.getIssueManagement().getSystem() );
-            issueManagement.setUrl( versionMetadata.getIssueManagement().getUrl() );
-            model.setIssueManagement( issueManagement );
-        }
-        if ( versionMetadata.getScm() != null )
-        {
-            Scm scm = new Scm();
-            scm.setConnection( versionMetadata.getScm().getConnection() );
-            scm.setDeveloperConnection( versionMetadata.getScm().getDeveloperConnection() );
-            scm.setUrl( versionMetadata.getScm().getUrl() );
-            model.setScm( scm );
-        }
-        if ( versionMetadata.getLicenses() != null )
-        {
-            for ( org.apache.archiva.metadata.model.License l : versionMetadata.getLicenses() )
-            {
-                License license = new License();
-                license.setName( l.getName() );
-                license.setUrl( l.getUrl() );
-                model.addLicense( license );
-            }
-        }
-        if ( versionMetadata.getMailingLists() != null )
-        {
-            for ( org.apache.archiva.metadata.model.MailingList l : versionMetadata.getMailingLists() )
-            {
-                MailingList mailingList = new MailingList();
-                mailingList.setMainArchiveUrl( l.getMainArchiveUrl() );
-                mailingList.setName( l.getName() );
-                mailingList.setPostAddress( l.getPostAddress() );
-                mailingList.setSubscribeAddress( l.getSubscribeAddress() );
-                mailingList.setUnsubscribeAddress( l.getUnsubscribeAddress() );
-                mailingList.setOtherArchives( l.getOtherArchives() );
-                model.addMailingList( mailingList );
-            }
-        }
-        if ( versionMetadata.getDependencies() != null )
-        {
-            for ( org.apache.archiva.metadata.model.Dependency d : versionMetadata.getDependencies() )
-            {
-                Dependency dependency = new Dependency();
-                dependency.setScope( d.getScope() );
-                dependency.setSystemPath( d.getSystemPath() );
-                dependency.setType( d.getType() );
-                dependency.setVersion( d.getVersion() );
-                dependency.setArtifactId( d.getArtifactId() );
-                dependency.setClassifier( d.getClassifier() );
-                dependency.setGroupId( d.getGroupId() );
-                dependency.setOptional( d.isOptional() );
-                model.addDependency( dependency );
-            }
-        }
-        return model;
-    }
-
     private List<String> getObservableRepos()
     {
         try
@@ -434,9 +331,9 @@ public class BrowseAction
         this.artifactId = artifactId;
     }
 
-    public BrowsingResults getResults()
+    public Collection<String> getNamespaces()
     {
-        return results;
+        return namespaces;
     }
 
     public String getRepositoryId()
@@ -451,18 +348,23 @@ public class BrowseAction
         this.repositoryId = repositoryId;
     }
 
-    public ArchivaProjectModel getSharedModel()
+    public ProjectVersionMetadata getSharedModel()
     {
         return sharedModel;
     }
 
-    public void setSharedModel( ArchivaProjectModel sharedModel )
+    public MetadataResolver getMetadataResolver()
+    {
+        return metadataResolver;
+    }
+
+    public Collection<String> getProjectIds()
     {
-        this.sharedModel = sharedModel;
+        return projectIds;
     }
 
-    public MetadataResolver getMetadataResolver()
+    public Collection<String> getProjectVersions()
     {
-        return metadataResolver;
+        return projectVersions;
     }
 }
index 921c7a56e99586cfc187d296afe28b8443ab969d..6cdf233bfe5f9101c2dd0da8cfc6b59fd0aacc74 100644 (file)
@@ -24,23 +24,13 @@ import java.util.Collections;
 import java.util.List;
 
 import com.opensymphony.xwork2.Validateable;
+import org.apache.archiva.metadata.model.Dependency;
+import org.apache.archiva.metadata.model.MailingList;
 import org.apache.archiva.metadata.model.ProjectVersionMetadata;
 import org.apache.archiva.metadata.model.ProjectVersionReference;
 import org.apache.archiva.metadata.repository.MetadataResolver;
 import org.apache.archiva.metadata.repository.MetadataResolverException;
-import org.apache.archiva.metadata.repository.storage.maven2.MavenProjectFacet;
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.database.ArchivaDatabaseException;
-import org.apache.maven.archiva.database.ObjectNotFoundException;
-import org.apache.maven.archiva.model.ArchivaProjectModel;
-import org.apache.maven.archiva.model.CiManagement;
-import org.apache.maven.archiva.model.Dependency;
-import org.apache.maven.archiva.model.IssueManagement;
-import org.apache.maven.archiva.model.License;
-import org.apache.maven.archiva.model.MailingList;
-import org.apache.maven.archiva.model.Organization;
-import org.apache.maven.archiva.model.Scm;
-import org.apache.maven.archiva.model.VersionedReference;
 import org.apache.maven.archiva.security.AccessDeniedException;
 import org.apache.maven.archiva.security.ArchivaSecurityException;
 import org.apache.maven.archiva.security.PrincipalNotFoundException;
@@ -82,12 +72,12 @@ public class ShowArtifactAction
     /**
      * The model of this versioned project.
      */
-    private ArchivaProjectModel model;
+    private ProjectVersionMetadata model;
 
     /**
      * The list of artifacts that depend on this versioned project.
      */
-    private List<ArchivaProjectModel> dependees;
+    private List<ProjectVersionReference> dependees;
 
     private List<MailingList> mailingLists;
 
@@ -141,112 +131,15 @@ public class ShowArtifactAction
             addActionError( "Artifact not found" );
             return ERROR;
         }
-        model = populateLegacyModel( versionMetadata );
+        model = versionMetadata;
 
         return SUCCESS;
     }
 
-    private ArchivaProjectModel populateLegacyModel( ProjectVersionMetadata versionMetadata )
-    {
-        // TODO: eventually, move to just use the metadata directly, with minimal JSP changes, mostly for Maven specifics
-        ArchivaProjectModel model = new ArchivaProjectModel();
-        MavenProjectFacet projectFacet = (MavenProjectFacet) versionMetadata.getFacet( MavenProjectFacet.FACET_ID );
-        if ( projectFacet != null )
-        {
-            model.setGroupId( projectFacet.getGroupId() );
-            model.setArtifactId( projectFacet.getArtifactId() );
-            model.setPackaging( projectFacet.getPackaging() );
-            if ( projectFacet.getParent() != null )
-            {
-                VersionedReference parent = new VersionedReference();
-                parent.setGroupId( projectFacet.getParent().getGroupId() );
-                parent.setArtifactId( projectFacet.getParent().getArtifactId() );
-                parent.setVersion( projectFacet.getParent().getVersion() );
-                model.setParentProject( parent );
-            }
-        }
-
-        model.setVersion( versionMetadata.getId() );
-        model.setDescription( versionMetadata.getDescription() );
-        model.setName( versionMetadata.getName() );
-        model.setUrl( versionMetadata.getUrl() );
-        if ( versionMetadata.getOrganization() != null )
-        {
-            Organization organization = new Organization();
-            organization.setName( versionMetadata.getOrganization().getName() );
-            organization.setUrl( versionMetadata.getOrganization().getUrl() );
-            model.setOrganization( organization );
-        }
-        if ( versionMetadata.getCiManagement() != null )
-        {
-            CiManagement ci = new CiManagement();
-            ci.setSystem( versionMetadata.getCiManagement().getSystem() );
-            ci.setUrl( versionMetadata.getCiManagement().getUrl() );
-            model.setCiManagement( ci );
-        }
-        if ( versionMetadata.getIssueManagement() != null )
-        {
-            IssueManagement issueManagement = new IssueManagement();
-            issueManagement.setSystem( versionMetadata.getIssueManagement().getSystem() );
-            issueManagement.setUrl( versionMetadata.getIssueManagement().getUrl() );
-            model.setIssueManagement( issueManagement );
-        }
-        if ( versionMetadata.getScm() != null )
-        {
-            Scm scm = new Scm();
-            scm.setConnection( versionMetadata.getScm().getConnection() );
-            scm.setDeveloperConnection( versionMetadata.getScm().getDeveloperConnection() );
-            scm.setUrl( versionMetadata.getScm().getUrl() );
-            model.setScm( scm );
-        }
-        if ( versionMetadata.getLicenses() != null )
-        {
-            for ( org.apache.archiva.metadata.model.License l : versionMetadata.getLicenses() )
-            {
-                License license = new License();
-                license.setName( l.getName() );
-                license.setUrl( l.getUrl() );
-                model.addLicense( license );
-            }
-        }
-        if ( versionMetadata.getMailingLists() != null )
-        {
-            for ( org.apache.archiva.metadata.model.MailingList l : versionMetadata.getMailingLists() )
-            {
-                MailingList mailingList = new MailingList();
-                mailingList.setMainArchiveUrl( l.getMainArchiveUrl() );
-                mailingList.setName( l.getName() );
-                mailingList.setPostAddress( l.getPostAddress() );
-                mailingList.setSubscribeAddress( l.getSubscribeAddress() );
-                mailingList.setUnsubscribeAddress( l.getUnsubscribeAddress() );
-                mailingList.setOtherArchives( l.getOtherArchives() );
-                model.addMailingList( mailingList );
-            }
-        }
-        if ( versionMetadata.getDependencies() != null )
-        {
-            for ( org.apache.archiva.metadata.model.Dependency d : versionMetadata.getDependencies() )
-            {
-                Dependency dependency = new Dependency();
-                dependency.setScope( d.getScope() );
-                dependency.setSystemPath( d.getSystemPath() );
-                dependency.setType( d.getType() );
-                dependency.setVersion( d.getVersion() );
-                dependency.setArtifactId( d.getArtifactId() );
-                dependency.setClassifier( d.getClassifier() );
-                dependency.setGroupId( d.getGroupId() );
-                dependency.setOptional( d.isOptional() );
-                model.addDependency( dependency );
-            }
-        }
-        return model;
-    }
-
     /**
      * Show the artifact information tab.
      */
     public String dependencies()
-        throws ObjectNotFoundException, ArchivaDatabaseException
     {
         ProjectVersionMetadata versionMetadata = null;
         for ( String repoId : getObservableRepos() )
@@ -270,7 +163,7 @@ public class ShowArtifactAction
             addActionError( "Artifact not found" );
             return ERROR;
         }
-        model = populateLegacyModel( versionMetadata );
+        model = versionMetadata;
 
         this.dependencies = model.getDependencies();
 
@@ -281,7 +174,6 @@ public class ShowArtifactAction
      * Show the mailing lists information tab.
      */
     public String mailingLists()
-        throws ObjectNotFoundException, ArchivaDatabaseException
     {
         ProjectVersionMetadata versionMetadata = null;
         for ( String repoId : getObservableRepos() )
@@ -305,7 +197,7 @@ public class ShowArtifactAction
             addActionError( "Artifact not found" );
             return ERROR;
         }
-        model = populateLegacyModel( versionMetadata );
+        model = versionMetadata;
 
         this.mailingLists = model.getMailingLists();
 
@@ -316,7 +208,6 @@ public class ShowArtifactAction
      * Show the reports tab.
      */
     public String reports()
-        throws ObjectNotFoundException, ArchivaDatabaseException
     {
         // TODO: hook up reports on project - this.reports = artifactsDatabase.findArtifactResults( groupId, artifactId,
         // version );
@@ -328,7 +219,6 @@ public class ShowArtifactAction
      * Show the dependees (other artifacts that depend on this project) tab.
      */
     public String dependees()
-        throws ObjectNotFoundException, ArchivaDatabaseException
     {
         ProjectVersionMetadata versionMetadata = null;
         for ( String repoId : getObservableRepos() )
@@ -352,7 +242,7 @@ public class ShowArtifactAction
             addActionError( "Artifact not found" );
             return ERROR;
         }
-        model = populateLegacyModel( versionMetadata );
+        model = versionMetadata;
 
         List<ProjectVersionReference> references = new ArrayList<ProjectVersionReference>();
         // TODO: what if we get duplicates across repositories?
@@ -362,17 +252,7 @@ public class ShowArtifactAction
             references.addAll( metadataResolver.getProjectReferences( repoId, groupId, artifactId, version ) );
         }
 
-        this.dependees = new ArrayList<ArchivaProjectModel>();
-        for ( ProjectVersionReference reference : references )
-        {
-            ArchivaProjectModel ref = new ArchivaProjectModel();
-
-            ref.setGroupId( reference.getNamespace() );
-            ref.setArtifactId( reference.getProjectId() );
-            ref.setVersion( reference.getProjectVersion() );
-
-            dependees.add( ref );
-        }
+        this.dependees = references;
 
         // TODO: may need to note on the page that references will be incomplete if the other artifacts are not yet stored in the content repository
         // (especially in the case of pre-population import)
@@ -384,7 +264,6 @@ public class ShowArtifactAction
      * Show the dependencies of this versioned project tab.
      */
     public String dependencyTree()
-        throws ObjectNotFoundException, ArchivaDatabaseException
     {
         // temporarily use this as we only need the model for the tag to perform, but we should be resolving the
         // graph here instead
@@ -436,7 +315,7 @@ public class ShowArtifactAction
         }
     }
 
-    public ArchivaProjectModel getModel()
+    public ProjectVersionMetadata getModel()
     {
         return model;
     }
@@ -481,7 +360,7 @@ public class ShowArtifactAction
         return dependencies;
     }
 
-    public List<ArchivaProjectModel> getDependees()
+    public List<ProjectVersionReference> getDependees()
     {
         return dependees;
     }
@@ -501,11 +380,6 @@ public class ShowArtifactAction
         return snapshotVersions;
     }
 
-    public void setSnapshotVersions( List<String> snapshotVersions )
-    {
-        this.snapshotVersions = snapshotVersions;
-    }
-
     public MetadataResolver getMetadataResolver()
     {
         return metadataResolver;
index 54cb15da172832f39dadaead8bef6c073d860d28..7348617d30012c05fdd29ab6629b6da9cdfa7c1e 100644 (file)
 <h1>Browse Repository</h1>
 
 <div id="contentArea">
-  <c:if test="${not empty results.selectedGroupId}">
+  <c:if test="${not empty groupId}">
     <p>
-      <archiva:groupIdLink var="${results.selectedGroupId}" includeTop="true" />
-      <c:if test="${not empty results.selectedArtifactId}">
+      <archiva:groupIdLink var="${groupId}" includeTop="true" />
+      <c:if test="${not empty artifactId}">
         <strong>${artifactId}</strong>
       </c:if>      
     </p>
   </c:if>
 
-  <c:if test="${not empty results.groupIds}">
+  <c:if test="${not empty namespaces}">
     <div id="nameColumn">
       <h2>Groups</h2>
       <ul>
-        <c:forEach items="${results.groupIds}" var="groupId">
+        <c:forEach items="${namespaces}" var="groupId">
           <c:set var="url">
             <s:url action="browseGroup" namespace="/">
               <s:param name="groupId" value="%{#attr.groupId}"/>
     </div>
   </c:if>
   
-  <c:if test="${not empty results.artifacts}">
+  <c:if test="${not empty projectIds}">
     <div id="nameColumn">
       <h2>Artifacts</h2>
       <ul>
         <c:url var="rssFeedIconUrl" value="/images/icons/rss-feed.png"/>
-        <c:forEach items="${results.artifacts}" var="artifactId">
+        <c:forEach items="${projectIds}" var="artifactId">
           <c:set var="url">
             <s:url action="browseArtifact" namespace="/">
-              <s:param name="groupId" value="%{#attr.results.selectedGroupId}"/>
+              <s:param name="groupId" value="%{#attr.groupId}"/>
               <s:param name="artifactId" value="%{#attr.artifactId}"/>
             </s:url>
           </c:set>
     </div>
   </c:if>  
   
-  <c:if test="${not empty results.versions}">
-    <%-- show shared project information (MRM-1041) --%>    
-    
+  <c:if test="${not empty projectVersions}">
+    <%-- show shared project information (MRM-1041) TODO - share JSP code with artifactInfo.jspf --%>
+
+    <c:set var="mavenFacet" value="${sharedModel.facets['org.apache.archiva.metadata.repository.storage.maven2']}" />
     <h2>Versions</h2>
     <div id="nameColumn" class="versions">  
       <a class="expand" href="#">Artifact Info</a>      
       <table class="infoTable">        
         <tr>
           <th>Group ID</th>
-          <td>${sharedModel.groupId}</td>
+          <td>${mavenFacet.groupId}</td>
         </tr>
         <tr>
           <th>Artifact ID</th>
-          <td>${sharedModel.artifactId}</td>
+          <td>${mavenFacet.artifactId}</td>
         </tr>        
-        <c:if test="${(sharedModel.packaging != null) && (!empty sharedModel.packaging)}">
+        <c:if test="${(mavenFacet.packaging != null) && (!empty mavenFacet.packaging)}">
         <tr>
           <th>Packaging</th>
-          <td><code>${sharedModel.packaging}</code></td>
+          <td><code>${mavenFacet.packaging}</code></td>
         </tr>
         </c:if>
         <c:if test="${(sharedModel.name != null) && (!empty sharedModel.name)}">
           <td>
             <c:choose>
               <c:when test="${(sharedModel.organization.url != null) && (!empty sharedModel.organization.url)}">
-                <a href="${sharedModel.organization.url}">${sharedModel.organization.organizationName}</a>
+                <a href="${sharedModel.organization.url}">${sharedModel.organization.name}</a>
               </c:when>
               <c:otherwise>
-                ${sharedModel.organization.organizationName}
+                ${sharedModel.organization.name}
               </c:otherwise>
             </c:choose>
           </td>
           <th>Issue Tracker</th>
           <td>
             <c:choose>
-              <c:when test="${!empty (sharedModel.issueManagement.issueManagementUrl)}">
-                <a href="${sharedModel.issueManagement.issueManagementUrl}">${sharedModel.issueManagement.system}</a>
+              <c:when test="${!empty (sharedModel.issueManagement.url)}">
+                <a href="${sharedModel.issueManagement.url}">${sharedModel.issueManagement.system}</a>
               </c:when>
               <c:otherwise>
                 ${sharedModel.issueManagement.system}
           <th>Continuous Integration</th>
           <td>
             <c:choose>
-              <c:when test="${!empty (sharedModel.ciManagement.ciUrl)}">
-                <a href="${sharedModel.ciManagement.ciUrl}">${sharedModel.ciManagement.system}</a>
+              <c:when test="${!empty (sharedModel.ciManagement.url)}">
+                <a href="${sharedModel.ciManagement.url}">${sharedModel.ciManagement.system}</a>
               </c:when>
               <c:otherwise>
                 ${sharedModel.ciManagement.system}
     </div>      
 
     <ul>
-      <c:forEach items="${results.versions}" var="version">
+      <c:forEach items="${projectVersions}" var="version">
         <c:set var="url">
           <s:url action="showArtifact" namespace="/">
-            <s:param name="groupId" value="%{#attr.results.selectedGroupId}"/>
-            <s:param name="artifactId" value="%{#attr.results.selectedArtifactId}"/>
+            <s:param name="groupId" value="%{#attr.groupId}"/>
+            <s:param name="artifactId" value="%{#attr.artifactId}"/>
             <s:param name="version" value="%{#attr.version}"/>
           </s:url>
         </c:set>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/browseArtifact.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/browseArtifact.jsp
deleted file mode 100644 (file)
index 8cc91c0..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<%--
-  ~ Licensed to the Apache Software Foundation (ASF) under one
-  ~ or more contributor license agreements.  See the NOTICE file
-  ~ distributed with this work for additional information
-  ~ regarding copyright ownership.  The ASF licenses this file
-  ~ to you under the Apache License, Version 2.0 (the
-  ~ "License"); you may not use this file except in compliance
-  ~ with the License.  You may obtain a copy of the License at
-  ~
-  ~   http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing,
-  ~ software distributed under the License is distributed on an
-  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  ~ KIND, either express or implied.  See the License for the
-  ~ specific language governing permissions and limitations
-  ~ under the License.
-  --%>
-
-<%@ taglib prefix="s" uri="/struts-tags" %>
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<%@ taglib prefix="archiva"   uri="/WEB-INF/taglib.tld" %>
-
-<html>
-<head>
-  <title>Browse Repository</title>
-  <s:head/>
-</head>
-
-<body>
-
-<h1>Browse Repository</h1>
-
-<div id="contentArea">
-  <div id="nameColumn">
-    <p>
-      <archiva:groupIdLink var="${groupId}" includeTop="true" />
-      <strong>${artifactId}</strong>
-    </p>
-
-    <h2>Versions</h2>
-    <ul>
-      <s:set name="versions" value="versions"/>
-      <c:forEach items="${versions}" var="version">
-        <c:set var="url">
-          <s:url action="showArtifact" namespace="/">
-            <s:param name="groupId" value="%{#attr.groupId}"/>
-            <s:param name="artifactId" value="%{#attr.artifactId}"/>
-            <s:param name="version" value="%{'#attr.version}"/>
-          </s:url>
-        </c:set>
-        <li><a href="${url}">${version}/</a></li>
-      </c:forEach>
-    </ul>
-  </div>
-</div>
-
-</body>
-</html>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/browseGroup.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/browseGroup.jsp
deleted file mode 100644 (file)
index 113d558..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-<%--
-  ~ Licensed to the Apache Software Foundation (ASF) under one
-  ~ or more contributor license agreements.  See the NOTICE file
-  ~ distributed with this work for additional information
-  ~ regarding copyright ownership.  The ASF licenses this file
-  ~ to you under the Apache License, Version 2.0 (the
-  ~ "License"); you may not use this file except in compliance
-  ~ with the License.  You may obtain a copy of the License at
-  ~
-  ~   http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing,
-  ~ software distributed under the License is distributed on an
-  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  ~ KIND, either express or implied.  See the License for the
-  ~ specific language governing permissions and limitations
-  ~ under the License.
-  --%>
-
-<%@ taglib prefix="s" uri="/struts-tags" %>
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<%@ taglib prefix="archiva"   uri="/WEB-INF/taglib.tld" %>
-
-<html>
-<head>
-  <title>Browse Repository</title>
-  <s:head/>
-</head>
-
-<body>
-
-<h1>Browse Repository</h1>
-
-<div id="contentArea">
-  <p>
-    <archiva:groupIdLink var="${results.selectedGroupId}" includeTop="true" />
-  </p>
-
-  <div id="nameColumn">
-    <h2>Groups</h2>
-    <ul>
-      <c:forEach items="${results.groupIds}" var="groupId">
-        <c:set var="url">
-          <s:url action="browseGroup" namespace="/">
-            <s:param name="groupId" value="%{#attr.groupId}"/>
-          </s:url>
-        </c:set>
-        <li><a href="${url}">${groupId}/</a></li>
-      </c:forEach>
-    </ul>
-  </div>
-  
-  <c:if test="${not empty results.versions}">
-    <div id="nameColumn">
-      <h2>Versions</h2>
-      <ul>
-        <c:forEach items="${results.versions}" var="version">
-          <c:set var="url">
-            <s:url action="browseVersion" namespace="/">
-              <s:param name="groupId" value="%{#attr.results.selectedGroupId}"/>
-              <s:param name="version" value="%{#attr.version}"/>
-            </s:url>
-          </c:set>
-          <li><a href="${url}">${version}/</a></li>
-        </c:forEach>
-      </ul>
-    </div>
-  </c:if>  
-
-  <c:if test="${not empty results.artifacts}">
-    <div id="nameColumn">
-      <h2>Artifacts</h2>
-      <ul>
-        <c:forEach items="${results.artifacts}" var="artifactId">
-          <c:set var="url">
-            <s:url action="browseArtifact" namespace="/">
-              <s:param name="groupId" value="%{#attr.groupId}"/>
-              <s:param name="artifactId" value="%{#attr.artifactId}"/>
-            </s:url>
-          </c:set>
-          <li><a href="${url}">${artifactId}/</a></li>
-        </c:forEach>
-      </ul>
-    </div>
-  </c:if>  
-    
-
-</div>
-
-</body>
-</html>
index 981a980025075a8ef488e287982bb66c70e95367..71c6220b9d15570ba45256747461f1629562c519 100644 (file)
 <%@ taglib prefix="archiva"   uri="/WEB-INF/taglib.tld" %>
 
 <p>
-  <archiva:groupIdLink var="${model.groupId}" includeTop="true" />
+  <archiva:groupIdLink var="${groupId}" includeTop="true" />
   
   <c:set var="url">
     <s:url action="browseArtifact" namespace="/">
-      <s:param name="groupId" value="%{#attr.model.groupId}"/>
-      <s:param name="artifactId" value="%{#attr.model.artifactId}"/>
+      <s:param name="groupId" value="%{#attr.groupId}"/>
+      <s:param name="artifactId" value="%{#attr.artifactId}"/>
     </s:url>
   </c:set>
-  <a href="${url}">${model.artifactId}</a> /
+  <a href="${url}">${artifactId}</a> /
   <strong>${version}</strong>
 
   <%-- TODO: new versions?
@@ -43,6 +43,7 @@
   <blockquote>${model.description}</blockquote>
 </c:if>
 
+<c:set var="mavenFacet" value="${model.facets['org.apache.archiva.metadata.repository.storage.maven2']}" />
 <table class="infoTable">
   <tr>
     <th>Repository</th>
   </tr>
   <tr>
     <th>Group ID</th>
-    <td>${model.groupId}</td>
+    <td>${mavenFacet.groupId}</td>
   </tr>
   <tr>
     <th>Artifact ID</th>
-    <td>${model.artifactId}</td>
+    <td>${mavenFacet.artifactId}</td>
   </tr>
   <tr>
     <th>Version</th>
@@ -62,7 +63,7 @@
   </tr>
   <tr>
     <th>Packaging</th>
-    <td><code>${model.packaging}</code></td>
+    <td><code>${mavenFacet.packaging}</code></td>
   </tr>
   <%-- TODO: derivatives
     <tr>
       </td>
     </tr>
   --%>
-  <c:if test="${model.parentProject != null}">
+  <c:if test="${mavenFacet.parent != null}">
     <tr>
       <th>Parent</th>
       <td>
-          ${model.parentProject.groupId} ${model.parentProject.artifactId} ${model.parentProject.version}
+          ${mavenFacet.parent.groupId} ${mavenFacet.parent.artifactId} ${mavenFacet.parent.version}
         <c:set var="url">
           <s:url action="showArtifact" namespace="/">
-            <s:param name="groupId" value="%{#attr.model.parentProject.groupId}"/>
-            <s:param name="artifactId" value="%{#attr.model.parentProject.artifactId}"/>
-            <s:param name="version" value="%{#attr.model.parentProject.version}"/>
+            <s:param name="groupId" value="%{#attr.mavenFacet.parent.groupId}"/>
+            <s:param name="artifactId" value="%{#attr.mavenFacet.parent.artifactId}"/>
+            <s:param name="version" value="%{#attr.mavenFacet.parent.version}"/>
           </s:url>
         </c:set>
         (<a href="${url}">View</a>)
@@ -97,8 +98,8 @@
         <c:forEach items="${snapshotVersions}" var="snapshot">         
           <c:set var="url">
             <s:url action="showArtifact" namespace="/">
-              <s:param name="groupId" value="%{#attr.model.groupId}"/>
-              <s:param name="artifactId" value="%{#attr.model.artifactId}"/>
+              <s:param name="groupId" value="%{#attr.mavenFacet.groupId}"/>
+              <s:param name="artifactId" value="%{#attr.mavenFacet.artifactId}"/>
               <s:param name="version" value="%{#attr.snapshot}"/>
             </s:url>
           </c:set>
   --%>
 </table>
 
-<c:if test="${model.packaging != 'pom'}">
+<c:if test="${mavenFacet.packaging != 'pom'}">
   <h2>POM Snippet</h2>
   <c:choose>
-    <c:when test="${model.packaging == 'maven-plugin'}">
+    <c:when test="${mavenFacet.packaging == 'maven-plugin'}">
 <pre class="pom">
     &lt;plugin>
-      &lt;groupId>${model.groupId}&lt;/groupId>
-      &lt;artifactId>${model.artifactId}&lt;/artifactId>
+      &lt;groupId>${mavenFacet.groupId}&lt;/groupId>
+      &lt;artifactId>${mavenFacet.artifactId}&lt;/artifactId>
       &lt;version>${version}&lt;/version>
     &lt;/plugin>
 </pre>
     <c:otherwise>
 <pre class="pom">
     &lt;dependency>
-      &lt;groupId>${model.groupId}&lt;/groupId>
-      &lt;artifactId>${model.artifactId}&lt;/artifactId>
-      &lt;version>${version}&lt;/version><c:if test="${model.packaging != 'jar'}">
-      &lt;type>${model.packaging}&lt;/type></c:if>
+      &lt;groupId>${mavenFacet.groupId}&lt;/groupId>
+      &lt;artifactId>${mavenFacet.artifactId}&lt;/artifactId>
+      &lt;version>${version}&lt;/version><c:if test="${mavenFacet.packaging != 'jar'}">
+      &lt;type>${mavenFacet.packaging}&lt;/type></c:if>
     &lt;/dependency>
 </pre>
     </c:otherwise>
         <th>Organisation</th>
         <td>
           <c:choose>
-            <c:when test="${model.organization != null}">
-              <a href="${model.organization.url}">${model.organization.organizationName}</a>
+            <c:when test="${model.organization.url != null}">
+              <a href="${model.organization.url}">${model.organization.name}</a>
             </c:when>
             <c:otherwise>
               ${model.organization.name}
         <th>Issue Tracker</th>
         <td>
           <c:choose>
-            <c:when test="${!empty (model.issueManagement.issueManagementUrl)}">
-              <a href="${model.issueManagement.issueManagementUrl}">${model.issueManagement.system}</a>
+            <c:when test="${!empty (model.issueManagement.url)}">
+              <a href="${model.issueManagement.url}">${model.issueManagement.system}</a>
             </c:when>
             <c:otherwise>
               ${model.issueManagement.system}
         <th>Continuous Integration</th>
         <td>
           <c:choose>
-            <c:when test="${!empty (model.ciManagement.ciUrl)}">
-              <a href="${model.ciManagement.ciUrl}">${model.ciManagement.system}</a>
+            <c:when test="${!empty (model.ciManagement.url)}">
+              <a href="${model.ciManagement.url}">${model.ciManagement.system}</a>
             </c:when>
             <c:otherwise>
               ${model.ciManagement.system}
index fbf3ac0744b47e5a9b113c7c0df1985d45818310..aaefeb2e6c76a5cf9eeb605df6327feb544ab7ca 100644 (file)
 <%-- TODO: paginate [MRM-491] --%>
 <c:forEach items="${dependees}" var="project">
   <h3 class="artifact-title">
-    <my:showArtifactTitle groupId="${project.groupId}" artifactId="${project.artifactId}"
-                          version="${project.version}"/>
+    <my:showArtifactTitle groupId="${project.namespace}" artifactId="${project.projectId}"
+                          version="${project.projectVersion}"/>
 
   </h3>
 
   <p>
-    <my:showArtifactLink groupId="${project.groupId}" artifactId="${project.artifactId}"
-                         version="${project.version}"/>
+    <my:showArtifactLink groupId="${project.namespace}" artifactId="${project.projectId}"
+                         version="${project.projectVersion}"/>
   </p>
 </c:forEach>
 <c:if test="${empty (dependees)}">
index e7b3e9600f7f7af71c31efc961bcfa0d47808054..adf05e933b42cda7cb5c29589c9bca7e2734ee11 100644 (file)
 <body>
 
 <s:set name="model" value="model"/>
+<c:set var="mavenFacet" value="${model.facets['org.apache.archiva.metadata.repository.storage.maven2']}" />
+
 <c:choose>
-  <c:when test="${model.packaging == 'maven-plugin'}">
+  <c:when test="${mavenFacet.packaging == 'maven-plugin'}">
     <c:url var="imageUrl" value="/images/mavenplugin.gif"/>
     <c:set var="packageName">Maven Plugin</c:set>
   </c:when>
-  <c:when test="${model.packaging == 'pom'}">
+  <c:when test="${mavenFacet.packaging == 'pom'}">
     <c:url var="imageUrl" value="/images/pom.gif"/>
     <c:set var="packageName">POM</c:set>
   </c:when>
   <%-- These types aren't usually set in the POM yet, so we fudge them for the well known ones --%>
-  <c:when test="${model.packaging == 'maven-archetype' or model.groupId == 'org.apache.maven.archetypes'}">
+  <c:when test="${mavenFacet.packaging == 'maven-archetype' or mavenFacet.groupId == 'org.apache.maven.archetypes'}">
     <c:url var="imageUrl" value="/images/archetype.gif"/>
     <c:set var="packageName">Maven Archetype</c:set>
   </c:when>
-  <c:when test="${model.packaging == 'maven-skin' or model.groupId == 'org.apache.maven.skins'}">
+  <c:when test="${mavenFacet.packaging == 'maven-skin' or mavenFacet.groupId == 'org.apache.maven.skins'}">
     <c:url var="imageUrl" value="/images/skin.gif"/>
     <c:set var="packageName">Maven Skin</c:set>
   </c:when>
   <%-- Must be last so that the above get picked up if possible --%>
-  <c:when test="${model.packaging == 'jar'}">
+  <c:when test="${mavenFacet.packaging == 'jar'}">
     <c:url var="imageUrl" value="/images/jar.gif"/>
     <c:set var="packageName">JAR</c:set>
   </c:when>
@@ -65,7 +67,7 @@
 <h1>
   <c:choose>
     <c:when test="${empty (model.name)}">
-      ${model.artifactId}
+      ${mavenFacet.artifactId}
     </c:when>
     <c:otherwise>
       ${model.name}
   </div>
 
   <div class="sidebar3">
-    <archiva:downloadArtifact groupId="${model.groupId}" artifactId="${model.artifactId}" version="${model.version}"/>
+    <archiva:downloadArtifact groupId="${mavenFacet.groupId}" artifactId="${mavenFacet.artifactId}" version="${model.version}"/>
   </div>
 
   <%-- TODO: perhaps using ajax? --%>
index aa9f9a8400be633db704246388519c2331659a48..73ba58bca91bcc6e666d43d5f41f49c343e4e05c 100644 (file)
@@ -30,7 +30,6 @@ import org.apache.archiva.metadata.model.Scm;
 import org.apache.archiva.metadata.repository.memory.TestMetadataResolver;
 import org.apache.archiva.metadata.repository.storage.maven2.MavenProjectFacet;
 import org.apache.archiva.metadata.repository.storage.maven2.MavenProjectParent;
-import org.apache.maven.archiva.model.ArchivaProjectModel;
 import org.apache.maven.archiva.security.UserRepositories;
 import org.apache.maven.archiva.security.UserRepositoriesStub;
 import org.codehaus.plexus.spring.PlexusInSpringTestCase;
@@ -92,15 +91,13 @@ public abstract class AbstractActionTestCase
         repos.setObservableRepositoryIds( repoIds );
     }
 
-    protected void assertDefaultModel( ArchivaProjectModel model, String version )
+    protected void assertDefaultModel( ProjectVersionMetadata model, String version )
     {
         assertDefaultModel( model, TEST_GROUP_ID, TEST_ARTIFACT_ID, version );
     }
 
-    protected void assertDefaultModel( ArchivaProjectModel model, String groupId, String artifactId, String version )
+    protected void assertDefaultModel( ProjectVersionMetadata model, String groupId, String artifactId, String version )
     {
-        assertEquals( groupId, model.getGroupId() );
-        assertEquals( artifactId, model.getArtifactId() );
         assertEquals( version, model.getVersion() );
         assertEquals( TEST_URL, model.getUrl() );
         assertEquals( TEST_NAME, model.getName() );
@@ -108,7 +105,7 @@ public abstract class AbstractActionTestCase
         assertEquals( TEST_ORGANIZATION_NAME, model.getOrganization().getName() );
         assertEquals( TEST_ORGANIZATION_URL, model.getOrganization().getUrl() );
         assertEquals( 2, model.getLicenses().size() );
-        org.apache.maven.archiva.model.License l = model.getLicenses().get( 0 );
+        License l = model.getLicenses().get( 0 );
         assertEquals( TEST_LICENSE_NAME, l.getName() );
         assertEquals( TEST_LICENSE_URL, l.getUrl() );
         l = model.getLicenses().get( 1 );
@@ -122,10 +119,13 @@ public abstract class AbstractActionTestCase
         assertEquals( TEST_SCM_DEV_CONNECTION, model.getScm().getDeveloperConnection() );
         assertEquals( TEST_SCM_URL, model.getScm().getUrl() );
 
-        assertEquals( TEST_PACKAGING, model.getPackaging() );
-        assertEquals( TEST_PARENT_GROUP_ID, model.getParentProject().getGroupId() );
-        assertEquals( TEST_PARENT_ARTIFACT_ID, model.getParentProject().getArtifactId() );
-        assertEquals( TEST_PARENT_VERSION, model.getParentProject().getVersion() );
+        MavenProjectFacet mavenFacet = (MavenProjectFacet) model.getFacet( MavenProjectFacet.FACET_ID );
+        assertEquals( groupId, mavenFacet.getGroupId() );
+        assertEquals( artifactId, mavenFacet.getArtifactId() );
+        assertEquals( TEST_PACKAGING, mavenFacet.getPackaging() );
+        assertEquals( TEST_PARENT_GROUP_ID, mavenFacet.getParent().getGroupId() );
+        assertEquals( TEST_PARENT_ARTIFACT_ID, mavenFacet.getParent().getArtifactId() );
+        assertEquals( TEST_PARENT_VERSION, mavenFacet.getParent().getVersion() );
     }
 
     protected ProjectVersionMetadata createProjectModel( String version )
index 72a1811ae2a5d968bb39785cc58b512690083c63..427d9f689cede0fd5646930715c07866193c1498 100644 (file)
@@ -27,9 +27,6 @@ import com.opensymphony.xwork2.Action;
 import org.apache.archiva.metadata.model.ProjectVersionMetadata;
 import org.apache.archiva.metadata.repository.MetadataResolverException;
 import org.apache.archiva.metadata.repository.memory.TestMetadataResolver;
-import org.apache.maven.archiva.database.ArchivaDatabaseException;
-import org.apache.maven.archiva.database.browsing.BrowsingResults;
-import org.apache.maven.archiva.model.ArchivaProjectModel;
 
 public class BrowseActionTest
     extends AbstractActionTestCase
@@ -54,14 +51,9 @@ public class BrowseActionTest
         String result = action.browse();
         assertSuccessResult( result );
 
-        BrowsingResults results = action.getResults();
-        assertNotNull( results );
-        assertEquals( Arrays.asList( TEST_REPO ), results.getSelectedRepositoryIds() );
-        assertEquals( Arrays.asList( "com", "commons-lang", "org.apache", "repeat.repeat" ), results.getGroupIds() );
-        assertNull( results.getArtifacts() );
-        assertNull( results.getSelectedArtifactId() );
-        assertNull( results.getSelectedGroupId() );
-        assertNull( results.getVersions() );
+        assertEquals( Arrays.asList( "com", "commons-lang", "org.apache", "repeat.repeat" ), action.getNamespaces() );
+        assertNull( action.getProjectIds() );
+        assertNull( action.getProjectVersions() );
 
         assertNull( action.getGroupId() );
         assertNull( action.getArtifactId() );
@@ -89,7 +81,9 @@ public class BrowseActionTest
         assertNoAccessResult( result );
 
         assertEquals( selectedGroupId, action.getGroupId() );
-        assertNull( action.getResults() );
+        assertNull( action.getNamespaces() );
+        assertNull( action.getProjectIds() );
+        assertNull( action.getProjectVersions() );
         assertNull( action.getArtifactId() );
         assertNull( action.getRepositoryId() );
         assertNull( action.getSharedModel() );
@@ -109,7 +103,9 @@ public class BrowseActionTest
 
         assertEquals( selectedGroupId, action.getGroupId() );
         assertEquals( selectedArtifactId, action.getArtifactId() );
-        assertNull( action.getResults() );
+        assertNull( action.getNamespaces() );
+        assertNull( action.getProjectIds() );
+        assertNull( action.getProjectVersions() );
         assertNull( action.getRepositoryId() );
         assertNull( action.getSharedModel() );
     }
@@ -131,14 +127,9 @@ public class BrowseActionTest
         String result = action.browseGroup();
         assertSuccessResult( result );
 
-        BrowsingResults results = action.getResults();
-        assertNotNull( results );
-        assertEquals( Arrays.asList( TEST_REPO ), results.getSelectedRepositoryIds() );
-        assertEquals( Collections.singletonList( "org.apache" ), results.getGroupIds() );
-        assertEquals( Collections.<String>emptyList(), results.getArtifacts() );
-        assertNull( results.getSelectedArtifactId() );
-        assertEquals( selectedGroupId, results.getSelectedGroupId() );
-        assertNull( results.getVersions() );
+        assertEquals( Collections.singletonList( "org.apache" ), action.getNamespaces() );
+        assertEquals( Collections.<String>emptyList(), action.getProjectIds() );
+        assertNull( action.getProjectVersions() );
 
         assertEquals( selectedGroupId, action.getGroupId() );
         assertNull( action.getArtifactId() );
@@ -158,14 +149,9 @@ public class BrowseActionTest
         String result = action.browseGroup();
         assertSuccessResult( result );
 
-        BrowsingResults results = action.getResults();
-        assertNotNull( results );
-        assertEquals( Arrays.asList( TEST_REPO ), results.getSelectedRepositoryIds() );
-        assertEquals( groups, results.getGroupIds() );
-        assertEquals( Collections.singletonList( artifacts ), results.getArtifacts() );
-        assertNull( results.getSelectedArtifactId() );
-        assertEquals( selectedGroupId, results.getSelectedGroupId() );
-        assertNull( results.getVersions() );
+        assertEquals( groups, action.getNamespaces() );
+        assertEquals( Collections.singletonList( artifacts ), action.getProjectIds() );
+        assertNull( action.getProjectVersions() );
 
         assertEquals( selectedGroupId, action.getGroupId() );
         assertNull( action.getArtifactId() );
@@ -184,14 +170,9 @@ public class BrowseActionTest
         String result = action.browse();
         assertSuccessResult( result );
 
-        BrowsingResults results = action.getResults();
-        assertNotNull( results );
-        assertEquals( Arrays.asList( TEST_REPO ), results.getSelectedRepositoryIds() );
-        assertEquals( Collections.singletonList( "org.apache" ), results.getGroupIds() );
-        assertNull( results.getArtifacts() );
-        assertNull( results.getSelectedArtifactId() );
-        assertNull( results.getSelectedGroupId() );
-        assertNull( results.getVersions() );
+        assertEquals( Collections.singletonList( "org.apache" ), action.getNamespaces() );
+        assertNull( action.getProjectIds() );
+        assertNull( action.getProjectVersions() );
 
         assertNull( action.getGroupId() );
         assertNull( action.getArtifactId() );
@@ -213,14 +194,9 @@ public class BrowseActionTest
         String result = action.browseGroup();
         assertSuccessResult( result );
 
-        BrowsingResults results = action.getResults();
-        assertNotNull( results );
-        assertEquals( Arrays.asList( TEST_REPO ), results.getSelectedRepositoryIds() );
-        assertEquals( Collections.singletonList( "org.apache.archiva" ), results.getGroupIds() );
-        assertEquals( Collections.singletonList( artifacts ), results.getArtifacts() );
-        assertNull( results.getSelectedArtifactId() );
-        assertEquals( selectedGroupId, results.getSelectedGroupId() );
-        assertNull( results.getVersions() );
+        assertEquals( Collections.singletonList( "org.apache.archiva" ), action.getNamespaces() );
+        assertEquals( Collections.singletonList( artifacts ), action.getProjectIds() );
+        assertNull( action.getProjectVersions() );
 
         assertEquals( selectedGroupId, action.getGroupId() );
         assertNull( action.getArtifactId() );
@@ -237,7 +213,9 @@ public class BrowseActionTest
         String result = action.browseArtifact();
         assertErrorResult( result );
 
-        assertNull( action.getResults() );
+        assertNull( action.getNamespaces() );
+        assertNull( action.getProjectIds() );
+        assertNull( action.getProjectVersions() );
         assertNull( action.getGroupId() );
         assertEquals( selectedArtifactId, action.getArtifactId() );
         assertNull( action.getRepositoryId() );
@@ -253,7 +231,9 @@ public class BrowseActionTest
         String result = action.browseArtifact();
         assertErrorResult( result );
 
-        assertNull( action.getResults() );
+        assertNull( action.getNamespaces() );
+        assertNull( action.getProjectIds() );
+        assertNull( action.getProjectVersions() );
         assertEquals( selectedGroupId, action.getGroupId() );
         assertNull( action.getArtifactId() );
         assertNull( action.getRepositoryId() );
@@ -261,7 +241,7 @@ public class BrowseActionTest
     }
 
     public void testBrowseArtifact()
-        throws ArchivaDatabaseException, MetadataResolverException
+        throws MetadataResolverException
     {
         String selectedGroupId = "org.apache";
         String selectedArtifactId = "apache";
@@ -285,21 +265,16 @@ public class BrowseActionTest
         assertEquals( selectedArtifactId, action.getArtifactId() );
         assertNull( action.getRepositoryId() );
 
-        BrowsingResults results = action.getResults();
-        assertNotNull( results );
-        assertEquals( Arrays.asList( TEST_REPO ), results.getSelectedRepositoryIds() );
-        assertNull( results.getGroupIds() );
-        assertNull( results.getArtifacts() );
-        assertEquals( selectedGroupId, results.getSelectedGroupId() );
-        assertEquals( selectedArtifactId, results.getSelectedArtifactId() );
-        assertEquals( versions, results.getVersions() );
+        assertNull( action.getNamespaces() );
+        assertNull( action.getProjectIds() );
+        assertEquals( versions, action.getProjectVersions() );
 
-        ArchivaProjectModel model = action.getSharedModel();
+        ProjectVersionMetadata model = action.getSharedModel();
         assertDefaultModel( model, selectedGroupId, selectedArtifactId, null );
     }
 
     public void testBrowseArtifactWithSnapshots()
-        throws ArchivaDatabaseException, MetadataResolverException
+        throws MetadataResolverException
     {
         String selectedGroupId = "org.apache";
         String selectedArtifactId = "apache";
@@ -327,16 +302,11 @@ public class BrowseActionTest
         assertEquals( selectedArtifactId, action.getArtifactId() );
         assertNull( action.getRepositoryId() );
 
-        BrowsingResults results = action.getResults();
-        assertNotNull( results );
-        assertEquals( Arrays.asList( TEST_REPO ), results.getSelectedRepositoryIds() );
-        assertNull( results.getGroupIds() );
-        assertNull( results.getArtifacts() );
-        assertEquals( selectedGroupId, results.getSelectedGroupId() );
-        assertEquals( selectedArtifactId, results.getSelectedArtifactId() );
-        assertEquals( versions, results.getVersions() );
+        assertNull( action.getNamespaces() );
+        assertNull( action.getProjectIds() );
+        assertEquals( versions, action.getProjectVersions() );
 
-        ArchivaProjectModel model = action.getSharedModel();
+        ProjectVersionMetadata model = action.getSharedModel();
         assertDefaultModel( model, selectedGroupId, selectedArtifactId, null );
     }
 
@@ -368,7 +338,9 @@ public class BrowseActionTest
 
     private void assertNoOutputVariables()
     {
-        assertNull( action.getResults() );
+        assertNull( action.getNamespaces() );
+        assertNull( action.getProjectIds() );
+        assertNull( action.getProjectVersions() );
         assertNull( action.getGroupId() );
         assertNull( action.getArtifactId() );
         assertNull( action.getRepositoryId() );
index 8c8139f9b64ff4f90fa311928d70482825498f56..84beb7508dee6af702c3d7dbed0c2ee468cc5f38 100644 (file)
@@ -29,8 +29,6 @@ import org.apache.archiva.metadata.model.MailingList;
 import org.apache.archiva.metadata.model.ProjectVersionMetadata;
 import org.apache.archiva.metadata.model.ProjectVersionReference;
 import org.apache.archiva.metadata.repository.memory.TestMetadataResolver;
-import org.apache.maven.archiva.database.ArchivaDatabaseException;
-import org.apache.maven.archiva.model.ArchivaProjectModel;
 
 public class ShowArtifactActionTest
     extends AbstractActionTestCase
@@ -67,7 +65,7 @@ public class ShowArtifactActionTest
         assertActionSuccess( action, result );
 
         assertActionParameters( action );
-        ArchivaProjectModel model = action.getModel();
+        ProjectVersionMetadata model = action.getModel();
         assertDefaultModel( model );
 
         assertEquals( TEST_REPO, action.getRepositoryId() );
@@ -96,7 +94,7 @@ public class ShowArtifactActionTest
         assertEquals( TEST_GROUP_ID, action.getGroupId() );
         assertEquals( TEST_ARTIFACT_ID, action.getArtifactId() );
         assertEquals( TEST_SNAPSHOT_VERSION, action.getVersion() );
-        ArchivaProjectModel model = action.getModel();
+        ProjectVersionMetadata model = action.getModel();
         assertDefaultModel( model, TEST_SNAPSHOT_VERSION );
 
         assertEquals( TEST_REPO, action.getRepositoryId() );
@@ -126,7 +124,7 @@ public class ShowArtifactActionTest
         assertEquals( TEST_GROUP_ID, action.getGroupId() );
         assertEquals( TEST_ARTIFACT_ID, action.getArtifactId() );
         assertEquals( TEST_TS_SNAPSHOT_VERSION, action.getVersion() );
-        ArchivaProjectModel model = action.getModel();
+        ProjectVersionMetadata model = action.getModel();
         assertDefaultModel( model, TEST_TS_SNAPSHOT_VERSION );
 
         assertEquals( TEST_REPO, action.getRepositoryId() );
@@ -191,7 +189,7 @@ public class ShowArtifactActionTest
         assertActionSuccess( action, result );
 
         assertActionParameters( action );
-        ArchivaProjectModel model = action.getModel();
+        ProjectVersionMetadata model = action.getModel();
         assertDefaultModel( model );
 
         assertEquals( TEST_REPO, action.getRepositoryId() );
@@ -217,7 +215,7 @@ public class ShowArtifactActionTest
         assertActionSuccess( action, result );
 
         assertActionParameters( action );
-        ArchivaProjectModel model = action.getModel();
+        ProjectVersionMetadata model = action.getModel();
         assertDefaultModel( model );
 
         assertEquals( TEST_REPO, action.getRepositoryId() );
@@ -243,7 +241,7 @@ public class ShowArtifactActionTest
         assertActionSuccess( action, result );
 
         assertActionParameters( action );
-        ArchivaProjectModel model = action.getModel();
+        ProjectVersionMetadata model = action.getModel();
         assertDefaultModel( model );
 
         assertEquals( TEST_REPO, action.getRepositoryId() );
@@ -271,7 +269,7 @@ public class ShowArtifactActionTest
         assertActionSuccess( action, result );
 
         assertActionParameters( action );
-        ArchivaProjectModel model = action.getModel();
+        ProjectVersionMetadata model = action.getModel();
         assertEquals( TEST_VERSION, model.getVersion() );
         assertEquals( TEST_URL, model.getUrl() );
         assertEquals( TEST_NAME, model.getName() );
@@ -286,7 +284,6 @@ public class ShowArtifactActionTest
     }
 
     public void testGetMailingLists()
-        throws ArchivaDatabaseException
     {
         ProjectVersionMetadata versionMetadata = createProjectModel( TEST_VERSION );
         MailingList ml1 = createMailingList( "Users List", "users" );
@@ -301,7 +298,7 @@ public class ShowArtifactActionTest
         assertActionSuccess( action, result );
 
         assertActionParameters( action );
-        ArchivaProjectModel model = action.getModel();
+        ProjectVersionMetadata model = action.getModel();
         assertDefaultModel( model );
 
         assertNotNull( action.getMailingLists() );
@@ -315,7 +312,6 @@ public class ShowArtifactActionTest
     }
 
     public void testGetDependencies()
-        throws ArchivaDatabaseException
     {
         ProjectVersionMetadata versionMetadata = createProjectModel( TEST_VERSION );
         Dependency dependency1 = createDependencyBasic( "artifactId1" );
@@ -330,7 +326,7 @@ public class ShowArtifactActionTest
         assertActionSuccess( action, result );
 
         assertActionParameters( action );
-        ArchivaProjectModel model = action.getModel();
+        ProjectVersionMetadata model = action.getModel();
         assertDefaultModel( model );
 
         assertNotNull( action.getDependencies() );
@@ -344,7 +340,6 @@ public class ShowArtifactActionTest
     }
 
     public void testGetDependees()
-        throws ArchivaDatabaseException
     {
         ProjectVersionMetadata versionMetadata = createProjectModel( TEST_VERSION );
         metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID, versionMetadata );
@@ -360,7 +355,7 @@ public class ShowArtifactActionTest
         assertActionSuccess( action, result );
 
         assertActionParameters( action );
-        ArchivaProjectModel model = action.getModel();
+        ProjectVersionMetadata model = action.getModel();
         assertDefaultModel( model );
 
         assertNotNull( action.getDependees() );
@@ -383,21 +378,21 @@ public class ShowArtifactActionTest
         return reference;
     }
 
-    private void assertCoordinate( ArchivaProjectModel dependee, String artifactId )
+    private void assertCoordinate( ProjectVersionReference dependee, String artifactId )
     {
-        assertEquals( artifactId, dependee.getArtifactId() );
-        assertEquals( "groupId", dependee.getGroupId() );
-        assertEquals( "version", dependee.getVersion() );
+        assertEquals( artifactId, dependee.getProjectId() );
+        assertEquals( "groupId", dependee.getNamespace() );
+        assertEquals( "version", dependee.getProjectVersion() );
     }
 
-    private void assertDependencyBasic( org.apache.maven.archiva.model.Dependency dependency, String artifactId )
+    private void assertDependencyBasic( Dependency dependency, String artifactId )
     {
         assertEquals( artifactId, dependency.getArtifactId() );
         assertEquals( "groupId", dependency.getGroupId() );
         assertEquals( "version", dependency.getVersion() );
     }
 
-    private void assertDependencyExtended( org.apache.maven.archiva.model.Dependency dependency, String artifactId )
+    private void assertDependencyExtended( Dependency dependency, String artifactId )
     {
         assertDependencyBasic( dependency, artifactId );
         assertEquals( true, dependency.isOptional() );
@@ -427,7 +422,7 @@ public class ShowArtifactActionTest
         return dependency;
     }
 
-    private void assertMailingList( org.apache.maven.archiva.model.MailingList mailingList, String name, String prefix )
+    private void assertMailingList( MailingList mailingList, String name, String prefix )
     {
         assertEquals( name, mailingList.getName() );
         assertEquals( prefix + "-post@", mailingList.getPostAddress() );
@@ -466,7 +461,7 @@ public class ShowArtifactActionTest
         assertEquals( 1, action.getActionErrors().size() );
     }
 
-    private void assertDefaultModel( ArchivaProjectModel model )
+    private void assertDefaultModel( ProjectVersionMetadata model )
     {
         assertDefaultModel( model, TEST_VERSION );
     }
index 5e4626f9464eae2937f7e6c6440cbc13ab57aa11..f6a2bfb95005c233284313fa5f40ed7470e5ee95 100644 (file)
@@ -56,6 +56,11 @@ public class ProjectVersionMetadata
         return id;
     }
 
+    public String getVersion()
+    {
+        return id;
+    }
+
     public void setId( String id )
     {
         this.id = id;
@@ -146,9 +151,9 @@ public class ProjectVersionMetadata
         this.licenses.add( license );
     }
 
-    public void addFacet( ProjectVersionFacet mavenProjectFacet )
+    public void addFacet( ProjectVersionFacet projectVersionFacet )
     {
-        this.facets.put( mavenProjectFacet.getFacetId(), mavenProjectFacet );
+        this.facets.put( projectVersionFacet.getFacetId(), projectVersionFacet );
     }
 
     public ProjectVersionFacet getFacet( String facetId )
@@ -156,12 +161,17 @@ public class ProjectVersionMetadata
         return this.facets.get( facetId );
     }
 
-    public Collection<ProjectVersionFacet> getAllFacets()
+    public Map<String, ProjectVersionFacet> getFacets()
+    {
+        return facets;
+    }
+
+    public Collection<ProjectVersionFacet> getFacetList()
     {
         return this.facets.values();
     }
 
-    public Collection<String> getAllFacetIds()
+    public Collection<String> getFacetIds()
     {
         return this.facets.keySet();
     }
index bec509ae4f3fb9ca58bd38f2203f761626846a34..04fdf69150c24ddcc32568f73e5d36204bad8cba 100644 (file)
@@ -176,8 +176,8 @@ public class FileMetadataRepository
             setProperty( properties, "dependency." + i + ".type", dependency.getType() );
             i++;
         }
-        properties.setProperty( "facetIds", join( versionMetadata.getAllFacetIds() ) );
-        for ( ProjectVersionFacet facet : versionMetadata.getAllFacets() )
+        properties.setProperty( "facetIds", join( versionMetadata.getFacetIds() ) );
+        for ( ProjectVersionFacet facet : versionMetadata.getFacetList() )
         {
             properties.putAll( facet.toProperties() );
         }
@@ -343,8 +343,8 @@ public class FileMetadataRepository
             if ( issueSystem != null || issueUrl != null )
             {
                 IssueManagement issueManagement = new IssueManagement();
-                issueManagement.setSystem( ciSystem );
-                issueManagement.setUrl( ciUrl );
+                issueManagement.setSystem( issueSystem );
+                issueManagement.setUrl( issueUrl );
                 versionMetadata.setIssueManagement( issueManagement );
             }
 
@@ -451,7 +451,7 @@ public class FileMetadataRepository
                 }
             }
 
-            for ( ProjectVersionFacet facet : versionMetadata.getAllFacets() )
+            for ( ProjectVersionFacet facet : versionMetadata.getFacetList() )
             {
                 properties.putAll( facet.toProperties() );
             }