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 d148be496..077dcad61 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
@@ -22,6 +22,7 @@ package org.apache.maven.archiva.web.action;
import com.opensymphony.xwork2.Validateable;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.model.Dependency;
+import org.apache.archiva.metadata.model.License;
import org.apache.archiva.metadata.model.MailingList;
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
import org.apache.archiva.metadata.model.ProjectVersionReference;
@@ -102,6 +103,10 @@ public class ShowArtifactAction
private boolean dependencyTree = false;
private ProjectVersionMetadata projectMetadata;
+
+ private String deleteItem;
+
+ private String itemValue;
/**
* Show the versioned project information tab.
@@ -295,7 +300,90 @@ public class ShowArtifactAction
return SUCCESS;
}
-
+
+ public String deleteMetadataEntry()
+ {
+ projectMetadata = getProjectVersionMetadata();
+
+ if ( !StringUtils.isEmpty( deleteItem ) && !StringUtils.isEmpty( itemValue ) )
+ {
+ if ( "dependency".equals( deleteItem ) )
+ {
+ removeDependency();
+ }
+ else if ( "mailingList".equals( deleteItem ) )
+ {
+ removeMailingList();
+ }
+ else if ( "license".equals( deleteItem ) )
+ {
+ removeLicense();
+ }
+
+ deleteItem = "";
+ itemValue = "";
+ }
+
+ return updateProjectMetadata();
+ }
+
+ private void removeDependency()
+ {
+ List dependencies = projectMetadata.getDependencies();
+ List newDependencies = new ArrayList();
+
+ if ( dependencies != null )
+ {
+ for ( Dependency dependency : dependencies )
+ {
+ if ( !StringUtils.equals( itemValue, dependency.getArtifactId() ) )
+ {
+ newDependencies.add( dependency );
+ }
+ }
+ }
+
+ projectMetadata.setDependencies( newDependencies );
+ }
+
+ private void removeMailingList()
+ {
+ List mailingLists = projectMetadata.getMailingLists();
+ List newMailingLists = new ArrayList();
+
+ if ( mailingLists != null )
+ {
+ for ( MailingList mailingList : mailingLists )
+ {
+ if ( !StringUtils.equals( itemValue, mailingList.getName() ) )
+ {
+ newMailingLists.add( mailingList );
+ }
+ }
+ }
+
+ projectMetadata.setMailingLists( newMailingLists );
+ }
+
+ private void removeLicense()
+ {
+ List licenses = projectMetadata.getLicenses();
+ List newLicenses = new ArrayList();
+
+ if ( licenses != null )
+ {
+ for ( License license : licenses )
+ {
+ if ( !StringUtils.equals( itemValue, license.getName() ) )
+ {
+ newLicenses.add( license );
+ }
+ }
+ }
+
+ projectMetadata.setLicenses( newLicenses );
+ }
+
@Override
public void validate()
{
@@ -410,6 +498,16 @@ public class ShowArtifactAction
this.projectMetadata = projectMetadata;
}
+ public void setDeleteItem( String deleteItem )
+ {
+ this.deleteItem = deleteItem;
+ }
+
+ public void setItemValue( String itemValue )
+ {
+ this.itemValue = itemValue;
+ }
+
// TODO: move this into the artifact metadata itself via facets where necessary
public class ArtifactDownloadInfo
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/ProjectMetadataTag.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/ProjectMetadataTag.java
index d005446d3..73653c67b 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/ProjectMetadataTag.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/ProjectMetadataTag.java
@@ -45,6 +45,12 @@ public class ProjectMetadataTag
private Logger log = LoggerFactory.getLogger( ProjectMetadataTag.class );
private Object object;
+
+ private String groupId;
+
+ private String artifactId;
+
+ private String version;
@Override
public void release()
@@ -152,8 +158,12 @@ public class ProjectMetadataTag
startList( metadataEntries );
for ( License license : licenses )
{
+ createDeleteLink( "license", license.getName(), metadataEntries );
+ startList( metadataEntries );
addListItem( "licenses." + ctr + ".name=", license.getName(), metadataEntries );
addListItem( "licenses." + ctr + ".url=", license.getUrl(), metadataEntries );
+ endList( metadataEntries );
+ endListItem( metadataEntries );
ctr++;
}
endList( metadataEntries );
@@ -171,6 +181,8 @@ public class ProjectMetadataTag
startList( metadataEntries );
for ( MailingList list : lists )
{
+ createDeleteLink( "mailingList", list.getName(), metadataEntries );
+ startList( metadataEntries );
addListItem( "mailingLists." + ctr + ".name=", list.getName(), metadataEntries );
addListItem( "mailingLists." + ctr + ".archive.url=", list.getMainArchiveUrl(), metadataEntries );
addListItem( "mailingLists." + ctr + ".post=", list.getPostAddress(), metadataEntries );
@@ -194,6 +206,8 @@ public class ProjectMetadataTag
endList( metadataEntries );
}
endListItem( metadataEntries );
+ endList( metadataEntries );
+ endListItem( metadataEntries );
ctr++;
}
endList( metadataEntries );
@@ -207,8 +221,11 @@ public class ProjectMetadataTag
int ctr = 0;
startList( metadataEntries );
+
for ( Dependency dependency : dependencies )
{
+ createDeleteLink( "dependency", dependency.getArtifactId(), metadataEntries );
+ startList( metadataEntries );
addListItem( "dependency." + ctr + ".group.id=", dependency.getGroupId(), metadataEntries );
addListItem( "dependency." + ctr + ".artifact.id=", dependency.getArtifactId(), metadataEntries );
addListItem( "dependency." + ctr + ".version=", dependency.getVersion(), metadataEntries );
@@ -216,9 +233,12 @@ public class ProjectMetadataTag
addListItem( "dependency." + ctr + ".type=", dependency.getType(), metadataEntries );
addListItem( "dependency." + ctr + ".scope=", dependency.getScope(), metadataEntries );
addListItem( "dependency." + ctr + ".system.path=", dependency.getSystemPath(), metadataEntries );
+ endList( metadataEntries );
+ endListItem( metadataEntries );
ctr++;
}
endList( metadataEntries );
+
endListItem( metadataEntries );
}
@@ -250,9 +270,36 @@ public class ProjectMetadataTag
{
metadataEntries.append( "\n" );
}
+
+ private void createDeleteLink( String name, String value, StringBuffer metadataEntries )
+ {
+ metadataEntries.append( "\n" ).append( value )
+ .append( "\n" )
+ .append( "" ).append( "" );
+ }
public void setObject( Object object )
{
this.object = object;
}
+
+ public void setGroupId( String groupId )
+ {
+ this.groupId = groupId;
+ }
+
+ public void setArtifactId( String artifactId )
+ {
+ this.artifactId = artifactId;
+ }
+
+ public void setVersion( String version )
+ {
+ this.version = version;
+ }
}
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 10ad88add..a93499d44 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
@@ -222,6 +222,13 @@
/WEB-INF/jsp/showArtifact.jsp
+
+
+ showProjectMetadata
+ /
+
+
+
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 498fdabb0..6e5202a7a 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
@@ -36,5 +36,5 @@
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/taglib.tld b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/taglib.tld
index fc83554e0..d5572f276 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/taglib.tld
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/taglib.tld
@@ -124,7 +124,31 @@
+
+
+ groupId
+ true
+ true
+
+
+
+
+
+ artifactId
+ true
+ true
+
+
+
+
+
+ version
+ true
+ true
+
+
+
-
\ No newline at end of file
+