]> source.dussan.org Git - archiva.git/commitdiff
-merged with r615904 in trunk
authorMaria Odea B. Ching <oching@apache.org>
Tue, 29 Jan 2008 07:00:14 +0000 (07:00 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Tue, 29 Jan 2008 07:00:14 +0000 (07:00 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches/archiva-1.0.x@616186 13f79535-47bb-0310-9956-ffa450edef68

archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java
archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction-validation.xml [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addLegacyArtifactPath.jsp

index 6dca666ea89e57710bd8866861f8c5dfc7ddf6f9..71d6c3bc8e8763dd06ea962225b5333e26aee271 100644 (file)
@@ -54,6 +54,16 @@ public class AddLegacyArtifactPathAction
 \r
     private LegacyArtifactPath legacyArtifactPath;\r
 \r
+    private String groupId;\r
+\r
+    private String artifactId;\r
+\r
+    private String version;\r
+\r
+    private String classifier;\r
+\r
+    private String type;\r
+\r
 \r
     public void prepare()\r
     {\r
@@ -67,14 +77,18 @@ public class AddLegacyArtifactPathAction
 \r
     public String commit()\r
     {\r
+        this.legacyArtifactPath.setArtifact(\r
+            this.groupId + ":" + this.artifactId + ":" +  this.classifier + ":" +  this.version + ":" + this.type );\r
+\r
+        // Check the proposed Artifact macthes the path\r
         ArtifactReference artifact = new ArtifactReference();\r
-               \r
-               artifact.setGroupId( this.legacyArtifactPath.getGroupId() );\r
-               artifact.setArtifactId( this.legacyArtifactPath.getArtifactId() );\r
-               artifact.setClassifier( this.legacyArtifactPath.getClassifier() );\r
-               artifact.setVersion( this.legacyArtifactPath.getVersion() );\r
-               artifact.setType( this.legacyArtifactPath.getType() );\r
-               \r
+\r
+               artifact.setGroupId( this.groupId );\r
+               artifact.setArtifactId( this.artifactId );\r
+               artifact.setClassifier( this.classifier );\r
+               artifact.setVersion( this.version );\r
+               artifact.setType( this.type );\r
+\r
         String path = repositoryContent.toPath( artifact );\r
         if ( ! path.equals( this.legacyArtifactPath.getPath() ) )\r
         {\r
@@ -117,4 +131,54 @@ public class AddLegacyArtifactPathAction
 \r
         return SUCCESS;\r
     }\r
+\r
+    public String getGroupId()\r
+    {\r
+        return groupId;\r
+    }\r
+\r
+    public void setGroupId( String groupId )\r
+    {\r
+        this.groupId = groupId;\r
+    }\r
+\r
+    public String getArtifactId()\r
+    {\r
+        return artifactId;\r
+    }\r
+\r
+    public void setArtifactId( String artifactId )\r
+    {\r
+        this.artifactId = artifactId;\r
+    }\r
+\r
+    public String getVersion()\r
+    {\r
+        return version;\r
+    }\r
+\r
+    public void setVersion( String version )\r
+    {\r
+        this.version = version;\r
+    }\r
+\r
+    public String getClassifier()\r
+    {\r
+        return classifier;\r
+    }\r
+\r
+    public void setClassifier( String classifier )\r
+    {\r
+        this.classifier = classifier;\r
+    }\r
+\r
+    public String getType()\r
+    {\r
+        return type;\r
+    }\r
+\r
+    public void setType( String type )\r
+    {\r
+        this.type = type;\r
+    }\r
 }\r
diff --git a/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction-validation.xml b/archiva-web/archiva-webapp/src/main/resources/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction-validation.xml
new file mode 100644 (file)
index 0000000..1725a33
--- /dev/null
@@ -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
index 4258e8cc94a2006f8d110afceba2c4c9a9cd88b2..6c647d426b2001f1a96e62ad79cb83ebc7325fe7 100644 (file)
 \r
       }\r
   }\r
-  function computeArtifactReference()\r
-  {\r
-      document.getElementById("addLegacyArtifactPath_legacyArtifactPath_artifact").value\r
-          = document.getElementById("addLegacyArtifactPath_groupId").value\r
-          + ":"\r
-          + document.getElementById("addLegacyArtifactPath_artifactId").value\r
-          + ":"\r
-          + document.getElementById("addLegacyArtifactPath_version").value\r
-          + ":"\r
-          + document.getElementById("addLegacyArtifactPath_classifier").value\r
-          + ":"\r
-          + document.getElementById("addLegacyArtifactPath_type").value;\r
-  }\r
   </script>\r
 \r
   <ww:actionmessage/>\r
   <ww:actionerror/>\r
-  <ww:form method="post" action="addLegacyArtifactPath!commit" namespace="/admin" validate="true" onsubmit="computeArtifactReference()">\r
+  <ww:form method="post" action="addLegacyArtifactPath!commit" namespace="/admin" validate="true">\r
     <ww:textfield name="legacyArtifactPath.path" label="Path" size="50" required="true" onchange="parse( this.value )"/>\r
-    <ww:textfield name="groupId" label="GroupId" size="20" required="true" disabled="true"/>\r
+    <ww:textfield name="groupId" label="GroupId" size="20" required="true"/>\r
     <ww:textfield name="artifactId" label="ArtifactId" size="20" required="true"/>\r
     <ww:textfield name="version" label="Version" size="20" required="true"/>\r
     <ww:textfield name="classifier" label="Classifier" size="20" required="false"/>\r
-    <ww:textfield name="type" label="Type" size="20" required="true" disabled="true"/>\r
-    <ww:hidden name="legacyArtifactPath.artifact"/>\r
+    <ww:textfield name="type" label="Type" size="20" required="true"/>\r
     <ww:submit value="Add Legacy Artifact Path"/>\r
   </ww:form>\r
 \r