From: Maria Odea B. Ching Date: Fri, 4 Jun 2010 05:50:17 +0000 (+0000) Subject: [MRM-1362] Add simple 'CRUD' pages for project-level metadata along with a "generic... X-Git-Tag: archiva-1.4-M1~930 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a82088bc3f1b03faa44067a32921b45be9a2e586;p=archiva.git [MRM-1362] Add simple 'CRUD' pages for project-level metadata along with a "generic metadata" plugin o added validation for adding new properties git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@951287 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java index eed67d571..373c3eaff 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java @@ -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(); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml index 1da4912a8..4cf08c2ce 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/struts.xml @@ -223,7 +223,8 @@ - /WEB-INF/jsp/showArtifact.jsp + /WEB-INF/jsp/showArtifact.jsp + /WEB-INF/jsp/showArtifact.jsp diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectMetadata.jspf b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectMetadata.jspf index 65f3be1f7..da2937721 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectMetadata.jspf +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/projectMetadata.jspf @@ -23,7 +23,7 @@ <%@ taglib prefix="archiva" uri="/WEB-INF/taglib.tld" %>
- +
@@ -67,5 +67,19 @@
+ +

+ +

+ +
+ + +
+ +
+
+

+ <%-- --%>