From af0109d90fe767d72c346602bf6770a3764f1e4c Mon Sep 17 00:00:00 2001 From: "Maria Odea B. Ching" Date: Sun, 24 May 2009 10:58:49 +0000 Subject: [PATCH] [MRM-1157] and [MRM-1176] (also related to MRM-836) 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 --- .../ProjectModelToDatabaseConsumer.java | 58 +++++++++++++++++++ .../archiva-base/archiva-model/pom.xml | 2 +- .../archiva/model/ArchivaModelCloner.java | 4 ++ .../src/main/mdo/archiva-base.xml | 33 ++++++++++- .../repository/project/ProjectModelMerge.java | 5 +- .../filters/EffectiveProjectModelFilter.java | 9 +++ .../filters/ProjectModelExpressionFilter.java | 4 ++ .../readers/ProjectModel300Reader.java | 5 +- .../readers/ProjectModel400Reader.java | 6 +- .../writers/ProjectModel400Writer.java | 1 + .../archiva/web/action/BrowseAction.java | 6 +- .../src/main/webapp/WEB-INF/jsp/browse.jsp | 12 ++-- .../WEB-INF/jsp/include/artifactInfo.jspf | 10 ++-- 13 files changed, 135 insertions(+), 20 deletions(-) diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java index f06f866ea..396b7e3a4 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java @@ -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 diff --git a/archiva-modules/archiva-base/archiva-model/pom.xml b/archiva-modules/archiva-base/archiva-model/pom.xml index aa2d2a90c..9fd40f050 100755 --- a/archiva-modules/archiva-base/archiva-model/pom.xml +++ b/archiva-modules/archiva-base/archiva-model/pom.xml @@ -50,7 +50,7 @@ org.codehaus.modello modello-maven-plugin - 1.2.0 + 1.2.1 false src/main/mdo/archiva-base.xml diff --git a/archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java b/archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java index a4bfed13b..66af52d93 100644 --- a/archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java +++ b/archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java @@ -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() ) ); diff --git a/archiva-modules/archiva-base/archiva-model/src/main/mdo/archiva-base.xml b/archiva-modules/archiva-base/archiva-model/src/main/mdo/archiva-base.xml index 87efdb007..7a77aa31d 100644 --- a/archiva-modules/archiva-base/archiva-model/src/main/mdo/archiva-base.xml +++ b/archiva-modules/archiva-base/archiva-model/src/main/mdo/archiva-base.xml @@ -5,7 +5,7 @@ xsd.target-namespace="http://archiva.apache.org/model/1.2.0"> archiva-base-model ArchivaBaseModel - 1.2.0 + 1.2.1 Archiva Model @@ -1451,9 +1451,16 @@ name true 1.0.0+ - + String + + organizationName + 1.2.1+ + + String + url 1.0.0+ @@ -1546,6 +1553,13 @@ url true 1.0.0+ + + String + + + issueManagementUrl + 1.2.1+ String @@ -1574,6 +1588,14 @@ url 1.0.0+ true + + + String + + + ciUrl + 1.2.1+ String @@ -1609,6 +1631,13 @@ email true 1.0.0+ + + String + + + individualEmail + 1.2.1+ String diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelMerge.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelMerge.java index f84d9f48f..01d8e9f28 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelMerge.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelMerge.java @@ -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() ) ); diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilter.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilter.java index 876fb418b..186b7d1a4 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilter.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilter.java @@ -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 ); diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionFilter.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionFilter.java index 02c3b4157..26277dec6 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionFilter.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionFilter.java @@ -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 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 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() ) ); diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel300Reader.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel300Reader.java index 74ebf1be8..863a55d42 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel300Reader.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel300Reader.java @@ -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 diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java index d946ef317..399fcbfa1 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java @@ -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" ) ); diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/writers/ProjectModel400Writer.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/writers/ProjectModel400Writer.java index 1141eba27..cb85febe2 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/writers/ProjectModel400Writer.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/writers/ProjectModel400Writer.java @@ -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() ); } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java index 64c967cc5..0f76807ba 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java @@ -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 ); } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/browse.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/browse.jsp index f542e091d..54cb15da1 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/browse.jsp +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/browse.jsp @@ -128,10 +128,10 @@ - ${sharedModel.organization.name} + ${sharedModel.organization.organizationName} - ${sharedModel.organization.name} + ${sharedModel.organization.organizationName} @@ -142,8 +142,8 @@ Issue Tracker - - ${sharedModel.issueManagement.system} + + ${sharedModel.issueManagement.system} ${sharedModel.issueManagement.system} @@ -157,8 +157,8 @@ Continuous Integration - - ${sharedModel.ciManagement.system} + + ${sharedModel.ciManagement.system} ${sharedModel.ciManagement.system} diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactInfo.jspf b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactInfo.jspf index a85f9ccd4..981a98002 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactInfo.jspf +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactInfo.jspf @@ -169,7 +169,7 @@ - ${model.organization.name} + ${model.organization.organizationName} ${model.organization.name} @@ -200,8 +200,8 @@ Issue Tracker - - ${model.issueManagement.system} + + ${model.issueManagement.system} ${model.issueManagement.system} @@ -215,8 +215,8 @@ Continuous Integration - - ${model.ciManagement.system} + + ${model.ciManagement.system} ${model.ciManagement.system} -- 2.39.5