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