]> source.dussan.org Git - archiva.git/commitdiff
Adding exists method for content item
authorMartin Stockhammer <martin_s@apache.org>
Mon, 17 Feb 2020 21:19:15 +0000 (22:19 +0100)
committerMartin Stockhammer <martin_s@apache.org>
Mon, 17 Feb 2020 21:19:15 +0000 (22:19 +0100)
archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/content/ContentItem.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/content/base/ArchivaContentItem.java

index 1b6a492a9e184e71dbdd602e4d2ba3cc047a52d2..8efdd84618143cd6cb7db433682e40c1b21518d7 100644 (file)
@@ -75,4 +75,10 @@ public interface ContentItem
      */
     ManagedRepositoryContent getRepository( );
 
+    /**
+     * Returns <code>true</code>, if the item exists, otherwise <code>false</code>
+     * @return <code>true</code>, if the item exists, otherwise <code>false</code>
+     */
+    boolean exists();
+
 }
index 58d3335128a78ca73671c570cb1ee6f4e3f4c450..7e15d61be6a21680cb20742b396e2a70635f5191 100644 (file)
@@ -181,6 +181,7 @@ public abstract class ArchivaContentItem implements ContentItem
 
         protected abstract N getNextBuilder( );
 
+        @Override
         public WithAssetBuilder<N> 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( );
+    }
 }