You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by ni...@apache.org on 2008/01/28 16:02:18 UTC
svn commit: r615904 - in
/maven/archiva/trunk/archiva-web/archiva-webapp/src/main:
java/org/apache/maven/archiva/web/action/admin/legacy/
resources/org/apache/maven/archiva/web/action/admin/legacy/
webapp/WEB-INF/jsp/admin/
Author: nicolas
Date: Mon Jan 28 07:02:17 2008
New Revision: 615904
URL: http://svn.apache.org/viewvc?rev=615904&view=rev
Log:
fix MRM-670 - server-side validation and LegacyArtifactPath computation
Added:
maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/legacy/
maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction-validation.xml (with props)
Modified:
maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java
maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addLegacyArtifactPath.jsp
Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java?rev=615904&r1=615903&r2=615904&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java Mon Jan 28 07:02:17 2008
@@ -54,6 +54,16 @@
private LegacyArtifactPath legacyArtifactPath;
+ private String groupId;
+
+ private String artifactId;
+
+ private String version;
+
+ private String classifier;
+
+ private String type;
+
public void prepare()
{
@@ -67,14 +77,18 @@
public String commit()
{
+ this.legacyArtifactPath.setArtifact(
+ this.groupId + ":" + this.artifactId + ":" + this.classifier + ":" + this.version + ":" + this.type );
+
+ // Check the proposed Artifact macthes the path
ArtifactReference artifact = new ArtifactReference();
-
- artifact.setGroupId( this.legacyArtifactPath.getGroupId() );
- artifact.setArtifactId( this.legacyArtifactPath.getArtifactId() );
- artifact.setClassifier( this.legacyArtifactPath.getClassifier() );
- artifact.setVersion( this.legacyArtifactPath.getVersion() );
- artifact.setType( this.legacyArtifactPath.getType() );
-
+
+ artifact.setGroupId( this.groupId );
+ artifact.setArtifactId( this.artifactId );
+ artifact.setClassifier( this.classifier );
+ artifact.setVersion( this.version );
+ artifact.setType( this.type );
+
String path = repositoryContent.toPath( artifact );
if ( ! path.equals( this.legacyArtifactPath.getPath() ) )
{
@@ -116,5 +130,55 @@
}
return SUCCESS;
+ }
+
+ public String getGroupId()
+ {
+ return groupId;
+ }
+
+ public void setGroupId( String groupId )
+ {
+ this.groupId = groupId;
+ }
+
+ public String getArtifactId()
+ {
+ return artifactId;
+ }
+
+ public void setArtifactId( String artifactId )
+ {
+ this.artifactId = artifactId;
+ }
+
+ public String getVersion()
+ {
+ return version;
+ }
+
+ public void setVersion( String version )
+ {
+ this.version = version;
+ }
+
+ public String getClassifier()
+ {
+ return classifier;
+ }
+
+ public void setClassifier( String classifier )
+ {
+ this.classifier = classifier;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType( String type )
+ {
+ this.type = type;
}
}
Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction-validation.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction-validation.xml?rev=615904&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction-validation.xml (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction-validation.xml Mon Jan 28 07:02:17 2008
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ ~ 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.
+ -->
+
+<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+ <field name="legacyArtifactPath.path">
+ <field-validator type="requiredstring">
+ <message>You must enter a legacy path.</message>
+ </field-validator>
+ </field>
+ <field name="groupId">
+ <field-validator type="requiredstring">
+ <message>You must enter a groupId.</message>
+ </field-validator>
+ </field>
+ <field name="artifactId">
+ <field-validator type="requiredstring">
+ <message>You must enter an artifactId.</message>
+ </field-validator>
+ </field>
+ <field name="version">
+ <field-validator type="requiredstring">
+ <message>You must enter a version.</message>
+ </field-validator>
+ </field>
+ <field name="type">
+ <field-validator type="requiredstring">
+ <message>You must enter a type.</message>
+ </field-validator>
+ </field>
+</validators>
\ No newline at end of file
Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction-validation.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction-validation.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction-validation.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addLegacyArtifactPath.jsp
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addLegacyArtifactPath.jsp?rev=615904&r1=615903&r2=615904&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addLegacyArtifactPath.jsp (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addLegacyArtifactPath.jsp Mon Jan 28 07:02:17 2008
@@ -63,31 +63,17 @@
}
}
- function computeArtifactReference()
- {
- document.getElementById("addLegacyArtifactPath_legacyArtifactPath_artifact").value
- = document.getElementById("addLegacyArtifactPath_groupId").value
- + ":"
- + document.getElementById("addLegacyArtifactPath_artifactId").value
- + ":"
- + document.getElementById("addLegacyArtifactPath_version").value
- + ":"
- + document.getElementById("addLegacyArtifactPath_classifier").value
- + ":"
- + document.getElementById("addLegacyArtifactPath_type").value;
- }
</script>
<ww:actionmessage/>
<ww:actionerror/>
- <ww:form method="post" action="addLegacyArtifactPath!commit" namespace="/admin" validate="true" onsubmit="computeArtifactReference()">
+ <ww:form method="post" action="addLegacyArtifactPath!commit" namespace="/admin" validate="true">
<ww:textfield name="legacyArtifactPath.path" label="Path" size="50" required="true" onchange="parse( this.value )"/>
- <ww:textfield name="groupId" label="GroupId" size="20" required="true" disabled="true"/>
+ <ww:textfield name="groupId" label="GroupId" size="20" required="true"/>
<ww:textfield name="artifactId" label="ArtifactId" size="20" required="true"/>
<ww:textfield name="version" label="Version" size="20" required="true"/>
<ww:textfield name="classifier" label="Classifier" size="20" required="false"/>
- <ww:textfield name="type" label="Type" size="20" required="true" disabled="true"/>
- <ww:hidden name="legacyArtifactPath.artifact"/>
+ <ww:textfield name="type" label="Type" size="20" required="true"/>
<ww:submit value="Add Legacy Artifact Path"/>
</ww:form>