<commit_before>package mesfavoris.internal.service.operations;

import java.util.List;

import mesfavoris.BookmarksException;
import mesfavoris.model.BookmarkDatabase;
import mesfavoris.model.BookmarkId;
import mesfavoris.validation.IBookmarkModificationValidator;

public class DeleteBookmarksOperation {
	private final BookmarkDatabase bookmarkDatabase;
	private final IBookmarkModificationValidator bookmarkModificationValidator;

	public DeleteBookmarksOperation(BookmarkDatabase bookmarkDatabase,
			IBookmarkModificationValidator bookmarkModificationValidator) {
		this.bookmarkDatabase = bookmarkDatabase;
		this.bookmarkModificationValidator = bookmarkModificationValidator;
	}

	public void deleteBookmarks(final List<BookmarkId> selection) throws BookmarksException {
		bookmarkDatabase.modify(bookmarksTreeModifier -> {
			for (BookmarkId bookmarkId : selection) {
				if (bookmarkModificationValidator
						.validateModification(bookmarksTreeModifier.getCurrentTree(), bookmarkId).isOK()) {
					bookmarksTreeModifier.deleteBookmark(bookmarkId, true);
				}
			}
		});
	}

}
<commit_msg>A shared bookmark could not be deleted if not connected.<commit_after>package mesfavoris.internal.service.operations;

import java.util.List;

import mesfavoris.BookmarksException;
import mesfavoris.model.BookmarkDatabase;
import mesfavoris.model.BookmarkFolder;
import mesfavoris.model.BookmarkId;
import mesfavoris.validation.IBookmarkModificationValidator;

public class DeleteBookmarksOperation {
	private final BookmarkDatabase bookmarkDatabase;
	private final IBookmarkModificationValidator bookmarkModificationValidator;

	public DeleteBookmarksOperation(BookmarkDatabase bookmarkDatabase,
			IBookmarkModificationValidator bookmarkModificationValidator) {
		this.bookmarkDatabase = bookmarkDatabase;
		this.bookmarkModificationValidator = bookmarkModificationValidator;
	}

	public void deleteBookmarks(final List<BookmarkId> selection) throws BookmarksException {
		bookmarkDatabase.modify(bookmarksTreeModifier -> {
			for (BookmarkId bookmarkId : selection) {
				BookmarkFolder bookmarkFolder = bookmarksTreeModifier.getCurrentTree().getParentBookmark(bookmarkId);
				if (bookmarkFolder == null) {
					return;
				}
				if (bookmarkModificationValidator
						.validateModification(bookmarksTreeModifier.getCurrentTree(), bookmarkFolder.getId()).isOK()) {
					bookmarksTreeModifier.deleteBookmark(bookmarkId, true);
				}
			}
		});
	}

}

{'fraction_non_alphanumeric': 0.06927465362673187, 'fraction_numerical': 0.0, 'mean_word_length': 6.818471337579618, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6277067', 'n_tokens_mistral': 729, 'n_tokens_neox': 672, 'n_words': 118}