001/*
002 * (C) Copyright 2017 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     bdelbosc
018 */
019package org.nuxeo.importer.stream.consumer;
020
021import org.nuxeo.lib.stream.pattern.consumer.ConsumerPolicyBuilder;
022
023/**
024 * @since 9.2
025 */
026public class DocumentConsumerPolicyBuilder extends ConsumerPolicyBuilder {
027
028    protected boolean blockIndexing = false;
029
030    protected boolean bulkMode = false;
031
032    protected boolean blockAsyncListeners = false;
033
034    protected boolean blockPostCommitListeners = false;
035
036    protected boolean blockDefaultSyncListener = false;
037
038    public DocumentConsumerPolicyBuilder blockIndexing(boolean value) {
039        this.blockIndexing = value;
040        return this;
041    }
042
043    public DocumentConsumerPolicyBuilder useBulkMode(boolean value) {
044        this.bulkMode = value;
045        return this;
046    }
047
048    public DocumentConsumerPolicyBuilder blockAsyncListeners(boolean value) {
049        this.blockAsyncListeners = value;
050        return this;
051    }
052
053    public DocumentConsumerPolicyBuilder blockPostCommitListeners(boolean value) {
054        this.blockPostCommitListeners = value;
055        return this;
056    }
057
058    public DocumentConsumerPolicyBuilder blockDefaultSyncListener(boolean value) {
059        this.blockDefaultSyncListener = value;
060        return this;
061    }
062
063    @Override
064    public DocumentConsumerPolicy build() {
065        return new DocumentConsumerPolicy(this);
066    }
067
068}