From f64ef7fd2632f91d76eba221c2e3007dc8a9e8f8 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Mon, 17 Feb 2020 22:19:15 +0100 Subject: [PATCH] Adding exists method for content item --- .../apache/archiva/repository/content/ContentItem.java | 6 ++++++ .../repository/content/base/ArchivaContentItem.java | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/ContentItem.java b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/ContentItem.java index 1b6a492a9..8efdd8461 100644 --- a/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/ContentItem.java +++ b/archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/ContentItem.java @@ -75,4 +75,10 @@ public interface ContentItem */ ManagedRepositoryContent getRepository( ); + /** + * Returns true, if the item exists, otherwise false + * @return true, if the item exists, otherwise false + */ + boolean exists(); + } diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/content/base/ArchivaContentItem.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/content/base/ArchivaContentItem.java index 58d333512..7e15d61be 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/content/base/ArchivaContentItem.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/content/base/ArchivaContentItem.java @@ -181,6 +181,7 @@ public abstract class ArchivaContentItem implements ContentItem protected abstract N getNextBuilder( ); + @Override public WithAssetBuilder withRepository( ManagedRepositoryContent repository ) { if ( repository == null ) @@ -191,6 +192,7 @@ public abstract class ArchivaContentItem implements ContentItem return this; } + @Override public N withAsset( StorageAsset asset ) { if ( asset == null ) @@ -201,6 +203,7 @@ public abstract class ArchivaContentItem implements ContentItem return getNextBuilder( ); } + @Override public O withAttribute( String key, String value ) { if ( StringUtils.isEmpty( key ) ) @@ -216,10 +219,17 @@ public abstract class ArchivaContentItem implements ContentItem ( (ArchivaContentItem) item ).repository = repository; } + @Override public I build( ) { return item; } } + + @Override + public boolean exists( ) + { + return asset.exists( ); + } } -- 2.39.5