]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1157] and [MRM-1176] (also related to MRM-836)
authorMaria Odea B. Ching <oching@apache.org>
Sun, 24 May 2009 10:58:49 +0000 (10:58 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Sun, 24 May 2009 10:58:49 +0000 (10:58 +0000)
o added new column for Organization, IssueManagement, CiManagement and Individual tables to hold the actual values

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

13 files changed:
archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java
archiva-modules/archiva-base/archiva-model/pom.xml
archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java
archiva-modules/archiva-base/archiva-model/src/main/mdo/archiva-base.xml
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelMerge.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilter.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionFilter.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel300Reader.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/writers/ProjectModel400Writer.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/webapp/WEB-INF/jsp/browse.jsp
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactInfo.jspf

index f06f866ea73ef2e353ca062e2df51dff6d1e9ed3..396b7e3a467dfd7c7b860b31abd73f06d6a20c00 100644 (file)
@@ -34,7 +34,10 @@ import org.apache.maven.archiva.database.updater.DatabaseUnprocessedArtifactCons
 import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.model.ArchivaModelCloner;
 import org.apache.maven.archiva.model.ArchivaProjectModel;
+import org.apache.maven.archiva.model.CiManagement;
+import org.apache.maven.archiva.model.IssueManagement;
 import org.apache.maven.archiva.model.Keys;
+import org.apache.maven.archiva.model.Organization;
 import org.apache.maven.archiva.model.RepositoryProblem;
 import org.apache.maven.archiva.reporting.artifact.CorruptArtifactReport;
 import org.apache.maven.archiva.repository.ManagedRepositoryContent;
@@ -154,6 +157,24 @@ public class ProjectModelToDatabaseConsumer
         {
             model = reader.read( artifactFile );
 
+            Organization organization = model.getOrganization();
+            if( organization != null )
+            {
+                log.info( "++++ [AfterRead] organization NAME --> " + organization.getName() + " : " + organization.getOrganizationName() );
+            }
+            
+            IssueManagement iM = model.getIssueManagement();
+            if( iM != null )
+            {
+                log.info( "++++ [AfterRead] issueMgnt url --> " + iM.getUrl() + " : " + iM.getIssueManagementUrl() );
+            }
+            
+            CiManagement ci = model.getCiManagement();
+            if( ci != null )
+            {
+                log.info( "++++ [AfterRead] ci url --> " + ci.getUrl() + " : " + ci.getCiUrl() );
+            }
+            
             // The version should be updated to the artifact/filename version if it is a unique snapshot
             if ( VersionUtil.isUniqueSnapshot( artifact.getVersion() ) )
             {
@@ -162,6 +183,24 @@ public class ProjectModelToDatabaseConsumer
 
             // Resolve the project model (build effective model, resolve expressions)
             model = effectiveModelFilter.filter( model );
+            
+            organization = model.getOrganization();
+            if( organization != null )
+            {
+                log.info( "++++ [AfterFilter] organization NAME --> " + organization.getName() + " : " + organization.getOrganizationName() );
+            }
+            
+            iM = model.getIssueManagement();
+            if( iM != null )
+            {
+                log.info( "++++ [AfterFilter] issueMgnt url --> " + iM.getUrl() + " : " + iM.getIssueManagementUrl() );
+            }
+            
+            ci = model.getCiManagement();
+            if( ci != null )
+            {
+                log.info( "++++ [AfterFilter] ci url --> " + ci.getUrl() + " : " + ci.getCiUrl() );
+            }
 
             if ( isValidModel( model, repo, artifact ) )
             {
@@ -170,6 +209,25 @@ public class ProjectModelToDatabaseConsumer
                 // Clone model, since DAO while detachingCopy resets its contents
                 // This changes contents of the cache in EffectiveProjectModelFilter
                 model = ArchivaModelCloner.clone( model );
+                
+                organization = model.getOrganization();
+                if( organization != null )
+                {
+                    log.info( "++++ [AfterClone] organization NAME --> " + organization.getName() + " : " + organization.getOrganizationName() );
+                }
+                
+                iM = model.getIssueManagement();
+                if( iM != null )
+                {
+                    log.info( "++++ [AfterClone] issueMgnt url --> " + iM.getUrl() + " : " + iM.getIssueManagementUrl() );
+                }
+                
+                ci = model.getCiManagement();
+                if( ci != null )
+                {
+                    log.info( "++++ [AfterClone] ci url --> " + ci.getUrl() + " : " + ci.getCiUrl() );
+                }
+                
                 dao.getProjectModelDAO().saveProjectModel( model );
             }
             else
index aa2d2a90cf82574f77b8b0c24cc03b5ce7261bbb..9fd40f050f98383eb646d2bec5e133f339c3cbe6 100755 (executable)
@@ -50,7 +50,7 @@
         <groupId>org.codehaus.modello</groupId>
         <artifactId>modello-maven-plugin</artifactId>
         <configuration>
-          <version>1.2.0</version>
+          <version>1.2.1</version>
           <packageWithVersion>false</packageWithVersion>
           <models>
             <model>src/main/mdo/archiva-base.xml</model>
index a4bfed13b1b2a9608fe7271247f436b78854b508..66af52d93a0398b1c1cbe2c34efcd1c599045833 100644 (file)
@@ -99,6 +99,7 @@ public class ArchivaModelCloner
 
         cloned.setSystem( ciManagement.getSystem() );
         cloned.setUrl( ciManagement.getUrl() );
+        cloned.setCiUrl( ciManagement.getCiUrl() );
 
         return cloned;
     }
@@ -139,6 +140,7 @@ public class ArchivaModelCloner
 
         IssueManagement cloned = new IssueManagement();
 
+        cloned.setIssueManagementUrl( issueManagement.getIssueManagementUrl() );
         cloned.setSystem( issueManagement.getSystem() );
         cloned.setUrl( issueManagement.getUrl() );
 
@@ -176,6 +178,7 @@ public class ArchivaModelCloner
         cloned.setFavicon( organization.getFavicon() );
         cloned.setName( organization.getName() );
         cloned.setUrl( organization.getUrl() );
+        cloned.setOrganizationName( organization.getOrganizationName() );
 
         return cloned;
     }
@@ -333,6 +336,7 @@ public class ArchivaModelCloner
             cloned.setOrganizationUrl( individual.getOrganizationUrl() );
             cloned.setUrl( individual.getUrl() );
             cloned.setTimezone( individual.getTimezone() );
+            cloned.setIndividualEmail( individual.getIndividualEmail() );
 
             cloned.setRoles( cloneRoles( individual.getRoles() ) );
             cloned.setProperties( clone( individual.getProperties() ) );
index 87efdb007f34ed0c545922a699514dde22b6eb0a..7a77aa31d873bfdbb815d7af0d55a0f4f64d198f 100644 (file)
@@ -5,7 +5,7 @@
        xsd.target-namespace="http://archiva.apache.org/model/1.2.0">
   <id>archiva-base-model</id>
   <name>ArchivaBaseModel</name>
-  <version>1.2.0</version>
+  <version>1.2.1</version>
   <description>Archiva Model</description>
   <defaults>
     <default>
           <name>name</name>
           <identifier>true</identifier>
           <version>1.0.0+</version>
-          <description><![CDATA[The full name of the organization.]]></description>
+          <description><![CDATA[The generated id of the organization object. Due to problems in upgrading, 
+          we cannot unset this as the identifier and we cannot rename this as well.]]></description>
           <type>String</type>
         </field>
+        <field stash.maxSize="250" null-value="default">
+          <name>organizationName</name>
+          <version>1.2.1+</version>
+          <description><![CDATA[The full name of the organization.]]></description>
+          <type>String</type>          
+        </field>
         <field stash.maxSize="250">
           <name>url</name>
           <version>1.0.0+</version>
           <name>url</name>
           <identifier>true</identifier>
           <version>1.0.0+</version>
+          <description><![CDATA[The generated id for the issue management object. Due to problems in upgrading, 
+          we cannot unset this as the identifier and we cannot rename this as well.]]></description>
+          <type>String</type>
+        </field>
+        <field stash.maxSize="250" null-value="default">
+          <name>issueManagementUrl</name>
+          <version>1.2.1+</version>
           <description><![CDATA[URL for the issue management system used by the project.]]></description>
           <type>String</type>
         </field>
           <name>url</name>
           <version>1.0.0+</version>
           <identifier>true</identifier>
+          <description>
+            <![CDATA[The generated id for the CI management object. Due to problems in upgrading, 
+          we cannot unset this as the identifier and we cannot rename this as well.]]></description>
+          <type>String</type>
+        </field>
+        <field stash.maxSize="250" null-value="default">
+          <name>ciUrl</name>
+          <version>1.2.1+</version>
           <description>
             <![CDATA[URL for the continuous integration system used by the project if it has a web interface.]]></description>
           <type>String</type>
           <name>email</name>
           <identifier>true</identifier>
           <version>1.0.0+</version>
+          <description><![CDATA[The generated id for the object. Due to problems in upgrading, 
+          we cannot unset this as the identifier and we cannot rename this as well.]]></description>
+          <type>String</type>
+        </field>
+        <field stash.maxSize="250" null-value="default">
+          <name>individualEmail</name>
+          <version>1.2.1+</version>
           <description><![CDATA[The email address of the individual.]]></description>
           <type>String</type>
         </field>
index f84d9f48f68947a50924ddaac6ec810434b57ef7..01d8e9f2815e6acde9dc9fa00d205fc7d3b75c7a 100644 (file)
@@ -230,6 +230,7 @@ public class ProjectModelMerge
 
         merged.setSystem( merge( mainCim.getSystem(), parentCim.getSystem() ) );
         merged.setUrl( merge( mainCim.getUrl(), parentCim.getUrl() ) );
+        merged.setCiUrl( merge( mainCim.getCiUrl(), parentCim.getCiUrl() ) );
 
         return merged;
     }
@@ -289,7 +290,8 @@ public class ProjectModelMerge
 
         merged.setSystem( merge( mainIssueManagement.getSystem(), parentIssueManagement.getSystem() ) );
         merged.setUrl( merge( mainIssueManagement.getUrl(), parentIssueManagement.getUrl() ) );
-
+        merged.setIssueManagementUrl( merge( mainIssueManagement.getIssueManagementUrl(), parentIssueManagement.getIssueManagementUrl() ) );
+        
         return merged;
     }
 
@@ -308,6 +310,7 @@ public class ProjectModelMerge
         Organization merged = new Organization();
 
         merged.setFavicon( merge( mainOrganization.getFavicon(), parentOrganization.getFavicon() ) );
+        merged.setOrganizationName( merge( mainOrganization.getOrganizationName(), parentOrganization.getOrganizationName() ) );
         merged.setName( merge( mainOrganization.getName(), parentOrganization.getName() ) );
         merged.setUrl( merge( mainOrganization.getUrl(), parentOrganization.getUrl() ) );
 
index 876fb418b6a7a649e63ee00fd296ce9e7e44b7b4..186b7d1a40c792245841ff73218789b7d9ce375b 100644 (file)
@@ -24,6 +24,7 @@ import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.model.ArchivaModelCloner;
 import org.apache.maven.archiva.model.ArchivaProjectModel;
 import org.apache.maven.archiva.model.Dependency;
+import org.apache.maven.archiva.model.IssueManagement;
 import org.apache.maven.archiva.model.VersionedReference;
 import org.apache.maven.archiva.repository.project.ProjectModelException;
 import org.apache.maven.archiva.repository.project.ProjectModelFilter;
@@ -98,6 +99,14 @@ public class EffectiveProjectModelFilter
 
         // Clone submitted project (so that we don't mess with it) 
         effectiveProject = ArchivaModelCloner.clone( project );
+        
+        System.out.println( "++++[EFFECTIVE Project] effectiveProject --> " + effectiveProject  );
+        IssueManagement iM = effectiveProject.getIssueManagement();
+        if( iM != null )
+        {
+            System.out.println( "++++[EFFECTIVE Project] issue mgnt URL --> " + iM.getUrl() + " $$ " +
+                iM.getIssueManagementUrl() );
+        }
 
         DEBUG( "Starting build of effective with: " + effectiveProject );
 
index 02c3b41574fb89986890bae83d75b827bb2a433b..26277dec60acfc2db65e41164ffccaf2bf6dc3ed 100644 (file)
@@ -215,6 +215,7 @@ public class ProjectModelExpressionFilter
 
         ciManagement.setSystem( eval.expand( ciManagement.getSystem() ) );
         ciManagement.setUrl( eval.expand( ciManagement.getUrl() ) );
+        ciManagement.setCiUrl( eval.expand( ciManagement.getCiUrl() ) );
     }
 
     private void evaluateDependencyList( ExpressionEvaluator eval, List<Dependency> dependencies )
@@ -270,6 +271,7 @@ public class ProjectModelExpressionFilter
             individual.setOrganization( eval.expand( individual.getOrganization() ) );
             individual.setOrganizationUrl( eval.expand( individual.getOrganizationUrl() ) );
             individual.setUrl( eval.expand( individual.getUrl() ) );
+            individual.setIndividualEmail( eval.expand( individual.getIndividualEmail() ) );
 
             evaluateProperties( eval, individual.getProperties() );
             evaluateStringList( eval, individual.getRoles() );
@@ -286,6 +288,7 @@ public class ProjectModelExpressionFilter
 
         issueManagement.setSystem( eval.expand( issueManagement.getSystem() ) );
         issueManagement.setUrl( eval.expand( issueManagement.getUrl() ) );
+        issueManagement.setIssueManagementUrl( eval.expand( issueManagement.getIssueManagementUrl() ) );
     }
 
     private void evaluateLicenses( ExpressionEvaluator eval, List<License> licenses )
@@ -332,6 +335,7 @@ public class ProjectModelExpressionFilter
             return;
         }
 
+        organization.setOrganizationName( eval.expand( organization.getOrganizationName() ) );
         organization.setName( eval.expand( organization.getName() ) );
         organization.setUrl( eval.expand( organization.getUrl() ) );
         organization.setFavicon( eval.expand( organization.getFavicon() ) );
index 74ebf1be86f9f02f6c0d94dfd0e4dfd05b0a5cf6..863a55d42224713a83d3495fe2cec7d082591391 100644 (file)
@@ -227,6 +227,7 @@ public class ProjectModel300Reader
             individual.setOrganizationUrl( elemPerson.elementTextTrim( "organizationUrl" ) );
             individual.setUrl( elemPerson.elementTextTrim( "url" ) );
             individual.setTimezone( elemPerson.elementTextTrim( "timezone" ) );
+            individual.setIndividualEmail( elemPerson.elementTextTrim( "email" ) );
 
             // Roles
             Element elemRoles = elemPerson.element( "roles" );
@@ -268,7 +269,8 @@ public class ProjectModel300Reader
 
         IssueManagement issueMgmt = new IssueManagement();
         issueMgmt.setUrl( issueTrackingUrl );
-
+        issueMgmt.setIssueManagementUrl( issueTrackingUrl );
+        
         return issueMgmt;
     }
 
@@ -345,6 +347,7 @@ public class ProjectModel300Reader
         {
             Organization org = new Organization();
 
+            org.setOrganizationName( elemOrg.elementTextTrim( "name" ) );
             org.setName( elemOrg.elementTextTrim( "name" ) );
             org.setUrl( elemOrg.elementTextTrim( "url" ) );
             // TODO: Handle <logo />
index d946ef31770ca4da9a673326c758dcb23f021886..399fcbfa1faf007e90e126f6018da376de822907 100644 (file)
@@ -153,6 +153,7 @@ public class ProjectModel400Reader
             CiManagement ciManagement = new CiManagement();
             ciManagement.setSystem( elemCiMgmt.elementTextTrim( "system" ) );
             ciManagement.setUrl( elemCiMgmt.elementTextTrim( "url" ) );
+            ciManagement.setCiUrl( elemCiMgmt.elementTextTrim( "url" ) );
             return ciManagement;
         }
 
@@ -282,6 +283,7 @@ public class ProjectModel400Reader
             individual.setOrganizationUrl( elemPerson.elementTextTrim( "organizationUrl" ) );
             individual.setUrl( elemPerson.elementTextTrim( "url" ) );
             individual.setTimezone( elemPerson.elementTextTrim( "timezone" ) );
+            individual.setIndividualEmail( elemPerson.elementTextTrim( "email" ) );
 
             // Roles
             Element elemRoles = elemPerson.element( "roles" );
@@ -315,7 +317,8 @@ public class ProjectModel400Reader
 
             issueMgmt.setSystem( elemIssueMgmt.elementTextTrim( "system" ) );
             issueMgmt.setUrl( elemIssueMgmt.elementTextTrim( "url" ) );
-
+            issueMgmt.setIssueManagementUrl( elemIssueMgmt.elementTextTrim( "url" ) );
+            
             return issueMgmt;
         }
 
@@ -393,6 +396,7 @@ public class ProjectModel400Reader
         {
             Organization org = new Organization();
 
+            org.setOrganizationName( elemOrg.elementTextTrim( "name" ) );
             org.setName( elemOrg.elementTextTrim( "name" ) );
             org.setUrl( elemOrg.elementTextTrim( "url" ) );
 
index 1141eba27090b48cbb2c70307122e41aeac6cdbc..cb85febe24a08858cb2d5ebb54e27b4bcc047f34 100644 (file)
@@ -387,6 +387,7 @@ public class ProjectModel400Writer
 
         Element elem = root.addElement( "organization" );
 
+        //addChildElement( elem, "name", organization.getOrganizationName() );
         addChildElement( elem, "name", organization.getName() );
         addChildElement( elem, "url", organization.getUrl() );
     }
index 64c967cc5587d46d4f373db24f655d56dc755c6b..0f76807ba54715b5af4d0c3e8b9a635f6183701d 100644 (file)
@@ -167,19 +167,19 @@ public class BrowseAction
                     }
 
                     if ( sharedModel.getIssueManagement() != null && model.getIssueManagement() != null &&
-                        !StringUtils.equalsIgnoreCase( sharedModel.getIssueManagement().getUrl(), model.getIssueManagement().getUrl() ) )
+                        !StringUtils.equalsIgnoreCase( sharedModel.getIssueManagement().getIssueManagementUrl(), model.getIssueManagement().getIssueManagementUrl() ) )
                     {
                         sharedModel.setIssueManagement( null );
                     }
 
                     if ( sharedModel.getCiManagement() != null && model.getCiManagement() != null &&
-                        !StringUtils.equalsIgnoreCase( sharedModel.getCiManagement().getUrl(), model.getCiManagement().getUrl() ) )
+                        !StringUtils.equalsIgnoreCase( sharedModel.getCiManagement().getCiUrl(), model.getCiManagement().getCiUrl() ) )
                     {
                         sharedModel.setCiManagement( null );
                     }
 
                     if ( sharedModel.getOrganization() != null && model.getOrganization() != null && 
-                        !StringUtils.equalsIgnoreCase( sharedModel.getOrganization().getName(), model.getOrganization().getName() ) )
+                        !StringUtils.equalsIgnoreCase( sharedModel.getOrganization().getOrganizationName(), model.getOrganization().getOrganizationName() ) )
                     {
                         sharedModel.setOrganization( null );
                     }
index f542e091dbc5bef34926da923fd0fb9e9c539aa4..54cb15da172832f39dadaead8bef6c073d860d28 100644 (file)
           <td>
             <c:choose>
               <c:when test="${(sharedModel.organization.url != null) && (!empty sharedModel.organization.url)}">
-                <a href="${sharedModel.organization.url}">${sharedModel.organization.name}</a>
+                <a href="${sharedModel.organization.url}">${sharedModel.organization.organizationName}</a>
               </c:when>
               <c:otherwise>
-                ${sharedModel.organization.name}
+                ${sharedModel.organization.organizationName}
               </c:otherwise>
             </c:choose>
           </td>
           <th>Issue Tracker</th>
           <td>
             <c:choose>
-              <c:when test="${!empty (sharedModel.issueManagement.url)}">
-                <a href="${sharedModel.issueManagement.url}">${sharedModel.issueManagement.system}</a>
+              <c:when test="${!empty (sharedModel.issueManagement.issueManagementUrl)}">
+                <a href="${sharedModel.issueManagement.issueManagementUrl}">${sharedModel.issueManagement.system}</a>
               </c:when>
               <c:otherwise>
                 ${sharedModel.issueManagement.system}
           <th>Continuous Integration</th>
           <td>
             <c:choose>
-              <c:when test="${!empty (sharedModel.ciManagement.url)}">
-                <a href="${sharedModel.ciManagement.url}">${sharedModel.ciManagement.system}</a>
+              <c:when test="${!empty (sharedModel.ciManagement.ciUrl)}">
+                <a href="${sharedModel.ciManagement.ciUrl}">${sharedModel.ciManagement.system}</a>
               </c:when>
               <c:otherwise>
                 ${sharedModel.ciManagement.system}
index a85f9ccd4cc5dc63b4c66289a9e4a5b9e90aa2a0..981a980025075a8ef488e287982bb66c70e95367 100644 (file)
         <td>
           <c:choose>
             <c:when test="${model.organization != null}">
-              <a href="${model.organization.url}">${model.organization.name}</a>
+              <a href="${model.organization.url}">${model.organization.organizationName}</a>
             </c:when>
             <c:otherwise>
               ${model.organization.name}
         <th>Issue Tracker</th>
         <td>
           <c:choose>
-            <c:when test="${!empty (model.issueManagement.url)}">
-              <a href="${model.issueManagement.url}">${model.issueManagement.system}</a>
+            <c:when test="${!empty (model.issueManagement.issueManagementUrl)}">
+              <a href="${model.issueManagement.issueManagementUrl}">${model.issueManagement.system}</a>
             </c:when>
             <c:otherwise>
               ${model.issueManagement.system}
         <th>Continuous Integration</th>
         <td>
           <c:choose>
-            <c:when test="${!empty (model.ciManagement.url)}">
-              <a href="${model.ciManagement.url}">${model.ciManagement.system}</a>
+            <c:when test="${!empty (model.ciManagement.ciUrl)}">
+              <a href="${model.ciManagement.ciUrl}">${model.ciManagement.system}</a>
             </c:when>
             <c:otherwise>
               ${model.ciManagement.system}