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.ecm.platform.importer.mqueues.pattern.consumer;
020
021/**
022 * @since 9.2
023 */
024public class DocumentConsumerPolicy extends ConsumerPolicy {
025    protected boolean blockIndexing = false;
026    protected boolean bulkMode = false;
027    protected boolean blockAsyncListeners = false;
028    protected boolean blockPostCommitListeners = false;
029    protected boolean blockDefaultSyncListeners = false;
030
031    public DocumentConsumerPolicy(DocumentConsumerPolicyBuilder builder) {
032        super(builder);
033        this.blockIndexing = builder.blockIndexing;
034        this.blockAsyncListeners = builder.blockAsyncListeners;
035        this.blockDefaultSyncListeners = builder.blockDefaultSyncListener;
036        this.blockPostCommitListeners = builder.blockPostCommitListeners;
037        this.bulkMode = builder.bulkMode;
038    }
039
040    public boolean bulkMode() {
041        return bulkMode;
042    }
043
044    public boolean blockAsyncListeners() {
045        return blockAsyncListeners;
046    }
047
048    public boolean blockPostCommitListeners() {
049        return blockPostCommitListeners;
050    }
051
052    public boolean blockDefaultSyncListeners() {
053        return blockDefaultSyncListeners;
054    }
055
056    public boolean blockIndexing() {
057        return blockIndexing;
058    }
059
060    public static DocumentConsumerPolicyBuilder builder() {
061        return new DocumentConsumerPolicyBuilder();
062    }
063
064    @Override
065    public String toString() {
066        return "DocumentConsumerPolicy{" +
067                "blockIndexing=" + blockIndexing +
068                ", bulkMode=" + bulkMode +
069                ", blockAsyncListeners=" + blockAsyncListeners +
070                ", blockPostCommitListeners=" + blockPostCommitListeners +
071                ", blockDefaultSyncListeners=" + blockDefaultSyncListeners +
072                ", " + super.toString() +
073                '}';
074    }
075}