001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.actions.upload;
003
004import java.util.Map;
005
006import org.openstreetmap.josm.data.APIDataSet;
007
008/**
009 * Change, or block, the upload.
010 *
011 * The UploadHook may modify the uploaded data silently, it may display a
012 * warning message to the user or prevent the upload altogether.
013 *
014 * The tags of the changeset can also be changed with modifyChangesetTags method.
015 */
016public interface UploadHook {
017
018    /**
019     * Check, and/or change, the data to be uploaded.
020     * Default implementation is to approve the upload.
021     * @param apiDataSet the data to upload, modify this to change the data.
022     * @return {@code true} if upload is possible, {@code false} to block the upload.
023     */
024    default boolean checkUpload(APIDataSet apiDataSet) {
025        return true;
026    }
027
028    /**
029     * Modify the changeset tags (in place) before upload.
030     * Default implementation is to do no changes.
031     * @param tags The current tags to change
032     * @since 13028
033     */
034    default void modifyChangesetTags(Map<String, String> tags) {
035    }
036}