|
| 1 | +/* |
| 2 | + * DISCLAIMER |
| 3 | + * |
| 4 | + * Copyright 2016 ArangoDB GmbH, Cologne, Germany |
| 5 | + * |
| 6 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + * you may not use this file except in compliance with the License. |
| 8 | + * You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, software |
| 13 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + * See the License for the specific language governing permissions and |
| 16 | + * limitations under the License. |
| 17 | + * |
| 18 | + * Copyright holder is ArangoDB GmbH, Cologne, Germany |
| 19 | + */ |
| 20 | + |
| 21 | +package com.arangodb.model; |
| 22 | + |
| 23 | +import com.arangodb.velocypack.annotations.Expose; |
| 24 | + |
| 25 | +/** |
| 26 | + * @author Mark Vollmary |
| 27 | + */ |
| 28 | +public class GraphDocumentReadOptions { |
| 29 | + |
| 30 | + private String ifNoneMatch; |
| 31 | + private String ifMatch; |
| 32 | + private boolean catchException; |
| 33 | + @Expose(serialize = false) |
| 34 | + private Boolean allowDirtyRead; |
| 35 | + |
| 36 | + public GraphDocumentReadOptions() { |
| 37 | + super(); |
| 38 | + catchException = true; |
| 39 | + } |
| 40 | + |
| 41 | + public String getIfNoneMatch() { |
| 42 | + return ifNoneMatch; |
| 43 | + } |
| 44 | + |
| 45 | + /** |
| 46 | + * @param ifNoneMatch document revision must not contain If-None-Match |
| 47 | + * @return options |
| 48 | + */ |
| 49 | + public GraphDocumentReadOptions ifNoneMatch(final String ifNoneMatch) { |
| 50 | + this.ifNoneMatch = ifNoneMatch; |
| 51 | + return this; |
| 52 | + } |
| 53 | + |
| 54 | + public String getIfMatch() { |
| 55 | + return ifMatch; |
| 56 | + } |
| 57 | + |
| 58 | + /** |
| 59 | + * @param ifMatch document revision must contain If-Match |
| 60 | + * @return options |
| 61 | + */ |
| 62 | + public GraphDocumentReadOptions ifMatch(final String ifMatch) { |
| 63 | + this.ifMatch = ifMatch; |
| 64 | + return this; |
| 65 | + } |
| 66 | + |
| 67 | + public boolean isCatchException() { |
| 68 | + return catchException; |
| 69 | + } |
| 70 | + |
| 71 | + /** |
| 72 | + * @param catchException whether or not catch possible thrown exceptions |
| 73 | + * @return options |
| 74 | + */ |
| 75 | + public GraphDocumentReadOptions catchException(final boolean catchException) { |
| 76 | + this.catchException = catchException; |
| 77 | + return this; |
| 78 | + } |
| 79 | + |
| 80 | + /** |
| 81 | + * @param allowDirtyRead Set to {@code true} allows reading from followers in an active-failover setup. |
| 82 | + * @return options |
| 83 | + * @see <a href="https://docs.arangodb.com/current/Manual/Administration/ActiveFailover/#reading-from-follower">API |
| 84 | + * Documentation</a> |
| 85 | + * @since ArangoDB 3.4.0 |
| 86 | + */ |
| 87 | + public GraphDocumentReadOptions allowDirtyRead(final Boolean allowDirtyRead) { |
| 88 | + this.allowDirtyRead = allowDirtyRead; |
| 89 | + return this; |
| 90 | + } |
| 91 | + |
| 92 | + public Boolean getAllowDirtyRead() { |
| 93 | + return allowDirtyRead; |
| 94 | + } |
| 95 | + |
| 96 | +} |
0 commit comments