archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r951287 - in /archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main: java/org/apache/maven/archiva/web/action/ShowArtifactAction.java resources/struts.xml webapp/WEB-INF/jsp/include/projectMetadata.jspf
Date Fri, 04 Jun 2010 05:50:17 GMT
Author: oching
Date: Fri Jun  4 05:50:17 2010
New Revision: 951287

URL: http://svn.apache.org/viewvc?rev=951287&view=rev
Log:
[MRM-1362] Add simple 'CRUD' pages for project-level metadata along with a "generic metadata"
plugin
o added validation for adding new properties

Modified:
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectMetadata.jspf

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java?rev=951287&r1=951286&r2=951287&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java
Fri Jun  4 05:50:17 2010
@@ -305,9 +305,9 @@ public class ShowArtifactAction
     
     public String addMetadataProperty()
     {
-        ProjectVersionMetadata projectMetadata = getProjectVersionMetadata();
-        String errorMsg = null;      
+        String errorMsg = null;
         
+        ProjectVersionMetadata projectMetadata = getProjectVersionMetadata();
         if( projectMetadata == null )
         {
             addActionError( errorMsg != null ? errorMsg : "Artifact not found" );
@@ -323,6 +323,13 @@ public class ShowArtifactAction
             genericMetadata = projectMetadata.getFacet( GenericMetadataFacet.FACET_ID ).toProperties();
         }
         
+        if( propertyName == null || "".equals( propertyName.trim() ) || propertyValue ==
null || "".equals( propertyValue.trim() ) )
+        {
+            model = projectMetadata;            
+            addActionError( errorMsg != null ? errorMsg : "Property Name and Property Value
are required." );
+            return INPUT;
+        }
+        
         genericMetadata.put( propertyName, propertyValue );
         
         GenericMetadataFacet genericMetadataFacet = new GenericMetadataFacet();

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml?rev=951287&r1=951286&r2=951287&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml
Fri Jun  4 05:50:17 2010
@@ -223,7 +223,8 @@
     </action>
 
     <action name="addMetadataProperty" class="showArtifactAction" method="addMetadataProperty">
     
-      <result>/WEB-INF/jsp/showArtifact.jsp</result>
+      <result name="input">/WEB-INF/jsp/showArtifact.jsp</result>
+      <result name="success">/WEB-INF/jsp/showArtifact.jsp</result>
     </action>
 
     <action name="deleteMetadataEntry" class="showArtifactAction" method="deleteMetadataEntry">

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectMetadata.jspf
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectMetadata.jspf?rev=951287&r1=951286&r2=951287&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectMetadata.jspf
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectMetadata.jspf
Fri Jun  4 05:50:17 2010
@@ -23,7 +23,7 @@
 <%@ taglib prefix="archiva"   uri="/WEB-INF/taglib.tld" %>
 
 <div> 
-
+ 
   <div>
     <s:form action="addMetadataProperty" namespace="/" method="post" validate="true" theme="simple">
   
       <s:hidden name="groupId" value="%{groupId}" />
@@ -67,5 +67,19 @@
     </c:if>  
   </div>
   
+  
+  <p>
+    <s:if test="hasActionMessages()">
+      <div id="messages">
+        <s:actionmessage/>
+      </div>
+    </s:if>
+    <s:if test="hasActionErrors()">
+      <div id="messages">
+        <s:actionerror/>
+      </div>
+    </s:if>
+  </p>
+  
   <%-- <archiva:project-metadata object="${projectMetadata}" groupId="${groupId}" artifactId="${artifactId}"
version="${version}" /> --%>
 </div>



Mime
View raw message