Search in sources :

Example 1 with ItemDeleteStatus

use of org.apache.archiva.repository.ItemDeleteStatus in project archiva by apache.

the class ManagedDefaultRepositoryContent method deleteAllItems.

@Override
public void deleteAllItems(ItemSelector selector, Consumer<ItemDeleteStatus> consumer) throws ContentAccessException, IllegalArgumentException {
    try (Stream<? extends ContentItem> stream = newItemStream(selector, false)) {
        stream.forEach(item -> {
            try {
                deleteItem(item);
                consumer.accept(new ItemDeleteStatus(item));
            } catch (ItemNotFoundException e) {
                consumer.accept(new ItemDeleteStatus(item, ItemDeleteStatus.ITEM_NOT_FOUND, e));
            } catch (Exception e) {
                consumer.accept(new ItemDeleteStatus(item, ItemDeleteStatus.DELETION_FAILED, e));
            } catch (Throwable e) {
                consumer.accept(new ItemDeleteStatus(item, ItemDeleteStatus.UNKNOWN, e));
            }
        });
    }
}
Also used : ItemDeleteStatus(org.apache.archiva.repository.ItemDeleteStatus) LayoutRuntimeException(org.apache.archiva.repository.content.LayoutRuntimeException) ContentAccessException(org.apache.archiva.repository.content.ContentAccessException) IOException(java.io.IOException) LayoutException(org.apache.archiva.repository.content.LayoutException) ItemNotFoundException(org.apache.archiva.repository.content.ItemNotFoundException) ItemNotFoundException(org.apache.archiva.repository.content.ItemNotFoundException)

Aggregations

IOException (java.io.IOException)1 ItemDeleteStatus (org.apache.archiva.repository.ItemDeleteStatus)1 ContentAccessException (org.apache.archiva.repository.content.ContentAccessException)1 ItemNotFoundException (org.apache.archiva.repository.content.ItemNotFoundException)1 LayoutException (org.apache.archiva.repository.content.LayoutException)1 LayoutRuntimeException (org.apache.archiva.repository.content.LayoutRuntimeException)1