[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
This commit is contained in:
Maria Odea B. Ching 2010-06-04 05:50:17 +00:00
parent f51b049d51
commit a82088bc3f
3 changed files with 26 additions and 4 deletions

View File

@ -305,9 +305,9 @@ public class ShowArtifactAction
public String addMetadataProperty()
{
ProjectVersionMetadata projectMetadata = getProjectVersionMetadata();
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();

View File

@ -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">

View File

@ -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>