@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
public Builder mergeFrom(com.google.firestore.v1beta1.RollbackRequest other) { if (other == com.google.firestore.v1beta1.RollbackRequest.getDefaultInstance()) return this; if (!other.getDatabase().isEmpty()) { database_ = other.database_; onChanged(); } if (other.getTransaction() != com.google.protobuf.ByteString.EMPTY) { setTransaction(other.getTransaction()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@java.lang.Override public com.google.firestore.v1beta1.RollbackRequest buildPartial() { com.google.firestore.v1beta1.RollbackRequest result = new com.google.firestore.v1beta1.RollbackRequest(this); result.database_ = database_; result.transaction_ = transaction_; onBuilt(); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.firestore.v1beta1.RollbackRequest)) { return super.equals(obj); } com.google.firestore.v1beta1.RollbackRequest other = (com.google.firestore.v1beta1.RollbackRequest) obj; boolean result = true; result = result && getDatabase().equals(other.getDatabase()); result = result && getTransaction().equals(other.getTransaction()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + DATABASE_FIELD_NUMBER; hash = (53 * hash) + getDatabase().hashCode(); hash = (37 * hash) + TRANSACTION_FIELD_NUMBER; hash = (53 * hash) + getTransaction().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * * * <pre> * The transaction to roll back. * </pre> * * <code>bytes transaction = 2;</code> */ public Builder clearTransaction() { transaction_ = getDefaultInstance().getTransaction(); onChanged(); return this; }
/** * * * <pre> * The database name. In the format: * `projects/{project_id}/databases/{database_id}`. * </pre> * * <code>string database = 1;</code> */ public Builder clearDatabase() { database_ = getDefaultInstance().getDatabase(); onChanged(); return this; } /**
@java.lang.Override public com.google.firestore.v1beta1.RollbackRequest getDefaultInstanceForType() { return com.google.firestore.v1beta1.RollbackRequest.getDefaultInstance(); }
if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry, tag)) { done = true; } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable();
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getDatabaseBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, database_); } if (!transaction_.isEmpty()) { output.writeBytes(2, transaction_); } unknownFields.writeTo(output); }
@java.lang.Override public com.google.firestore.v1beta1.RollbackRequest build() { com.google.firestore.v1beta1.RollbackRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
@Test @SuppressWarnings("all") public void rollbackTest() { Empty expectedResponse = Empty.newBuilder().build(); mockFirestore.addResponse(expectedResponse); String formattedDatabase = FirestoreClient.formatDatabaseRootName("[PROJECT]", "[DATABASE]"); ByteString transaction = ByteString.copyFromUtf8("-34"); client.rollback(formattedDatabase, transaction); List<GeneratedMessageV3> actualRequests = mockFirestore.getRequests(); Assert.assertEquals(1, actualRequests.size()); RollbackRequest actualRequest = (RollbackRequest) actualRequests.get(0); Assert.assertEquals(formattedDatabase, actualRequest.getDatabase()); Assert.assertEquals(transaction, actualRequest.getTransaction()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
.setRequestMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.firestore.v1beta1.RollbackRequest.getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getDatabaseBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, database_); } if (!transaction_.isEmpty()) { size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, transaction_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
public static RollbackRequest rollback() { RollbackRequest.Builder rollback = RollbackRequest.newBuilder(); rollback.setDatabase(DATABASE_NAME); rollback.setTransaction(TRANSACTION_ID); return rollback.build(); }
/** * Rolls back a transaction. * * <p>Sample code: * * <pre><code> * try (FirestoreClient firestoreClient = FirestoreClient.create()) { * String formattedDatabase = FirestoreClient.formatDatabaseRootName("[PROJECT]", "[DATABASE]"); * ByteString transaction = ByteString.copyFromUtf8(""); * firestoreClient.rollback(formattedDatabase, transaction); * } * </code></pre> * * @param database The database name. In the format: * `projects/{project_id}/databases/{database_id}`. * @param transaction The transaction to roll back. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void rollback(String database, ByteString transaction) { DATABASE_ROOT_PATH_TEMPLATE.validate(database, "rollback"); RollbackRequest request = RollbackRequest.newBuilder().setDatabase(database).setTransaction(transaction).build(); rollback(request); }
/** Rolls a transaction back and releases all read locks. */ ApiFuture<Void> rollback() { pending = false; RollbackRequest.Builder reqBuilder = RollbackRequest.newBuilder(); reqBuilder.setTransaction(transactionId); reqBuilder.setDatabase(firestore.getDatabaseName()); ApiFuture<Empty> rollbackFuture = firestore.sendRequest(reqBuilder.build(), firestore.getClient().rollbackCallable()); return ApiFutures.transform( rollbackFuture, new ApiFunction<Empty, Void>() { @Override public Void apply(Empty beginTransactionResponse) { return null; } }); }
/** * Rolls back a transaction. * * <p>Sample code: * * <pre><code> * try (FirestoreClient firestoreClient = FirestoreClient.create()) { * String formattedDatabase = FirestoreClient.formatDatabaseRootName("[PROJECT]", "[DATABASE]"); * ByteString transaction = ByteString.copyFromUtf8(""); * firestoreClient.rollback(formattedDatabase, transaction); * } * </code></pre> * * @param database The database name. In the format: * `projects/{project_id}/databases/{database_id}`. * @param transaction The transaction to roll back. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void rollback(String database, ByteString transaction) { DATABASE_ROOT_PATH_TEMPLATE.validate(database, "rollback"); RollbackRequest request = RollbackRequest.newBuilder().setDatabase(database).setTransaction(transaction).build(); rollback(request); }
/** Rolls a transaction back and releases all read locks. */ ApiFuture<Void> rollback() { pending = false; RollbackRequest.Builder reqBuilder = RollbackRequest.newBuilder(); reqBuilder.setTransaction(transactionId); reqBuilder.setDatabase(firestore.getDatabaseName()); ApiFuture<Empty> rollbackFuture = firestore.sendRequest(reqBuilder.build(), firestore.getClient().rollbackCallable()); return ApiFutures.transform( rollbackFuture, new ApiFunction<Empty, Void>() { @Override public Void apply(Empty beginTransactionResponse) { return null; } }); }