public Builder mergeFrom(io.grafeas.v1beta1.ListNoteOccurrencesRequest other) { if (other == io.grafeas.v1beta1.ListNoteOccurrencesRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (!other.getFilter().isEmpty()) { filter_ = other.filter_; onChanged(); } if (other.getPageSize() != 0) { setPageSize(other.getPageSize()); } if (!other.getPageToken().isEmpty()) { pageToken_ = other.pageToken_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { io.grafeas.v1beta1.ListNoteOccurrencesRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (io.grafeas.v1beta1.ListNoteOccurrencesRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; }
public Builder mergeFrom(io.grafeas.v1beta1.ListNoteOccurrencesRequest other) { if (other == io.grafeas.v1beta1.ListNoteOccurrencesRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (!other.getFilter().isEmpty()) { filter_ = other.filter_; onChanged(); } if (other.getPageSize() != 0) { setPageSize(other.getPageSize()); } if (!other.getPageToken().isEmpty()) { pageToken_ = other.pageToken_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { io.grafeas.v1beta1.ListNoteOccurrencesRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (io.grafeas.v1beta1.ListNoteOccurrencesRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; }
private Builder() { maybeForceBuilderInitialization(); }
public static Builder newBuilder(io.grafeas.v1beta1.ListNoteOccurrencesRequest prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); }
@java.lang.Override public io.grafeas.v1beta1.ListNoteOccurrencesRequest buildPartial() { io.grafeas.v1beta1.ListNoteOccurrencesRequest result = new io.grafeas.v1beta1.ListNoteOccurrencesRequest(this); result.name_ = name_; result.filter_ = filter_; result.pageSize_ = pageSize_; result.pageToken_ = pageToken_; onBuilt(); return result; }
@java.lang.Override protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /**
@java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof io.grafeas.v1beta1.ListNoteOccurrencesRequest) { return mergeFrom((io.grafeas.v1beta1.ListNoteOccurrencesRequest) other); } else { super.mergeFrom(other); return this; } }
@java.lang.Override public io.grafeas.v1beta1.ListNoteOccurrencesRequest build() { io.grafeas.v1beta1.ListNoteOccurrencesRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); }
/** * Retrieves all the Occurrences associated with a specified Note * Here, all Occurrences are printed and counted * @param client The Grafeas client used to perform the API requests. * @param noteId the Note's unique identifier * @param projectId the GCP project the Note belongs to * @return number of Occurrences found */ public static int getOccurrencesForNote(GrafeasV1Beta1Client client, String noteId, String projectId) { final NoteName noteName = NoteName.of(projectId, noteId); int i = 0; ListNoteOccurrencesRequest request = ListNoteOccurrencesRequest.newBuilder() .setName(noteName.toString()) .build(); for (Occurrence o : client.listNoteOccurrences(request).iterateAll()) { // Write custom code to process each Occurrence here System.out.println(o.getName()); i = i + 1; } return i; } // [END occurrences_for_note]
/** * Lists occurrences referencing the specified note. Provider projects can use this method to get * all occurrences across consumer projects referencing the specified note. * * <p>Sample code: * * <pre><code> * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { * NoteName name = NoteName.of("[PROJECT]", "[NOTE]"); * String filter = ""; * for (Occurrence element : grafeasV1Beta1Client.listNoteOccurrences(name.toString(), filter).iterateAll()) { * // doThingsWith(element); * } * } * </code></pre> * * @param name The name of the note to list occurrences for in the form of * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. * @param filter The filter expression. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListNoteOccurrencesPagedResponse listNoteOccurrences(String name, String filter) { ListNoteOccurrencesRequest request = ListNoteOccurrencesRequest.newBuilder().setName(name).setFilter(filter).build(); return listNoteOccurrences(request); }
/** * Lists occurrences referencing the specified note. Provider projects can use this method to get * all occurrences across consumer projects referencing the specified note. * * <p>Sample code: * * <pre><code> * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { * NoteName name = NoteName.of("[PROJECT]", "[NOTE]"); * String filter = ""; * for (Occurrence element : grafeasV1Beta1Client.listNoteOccurrences(name, filter).iterateAll()) { * // doThingsWith(element); * } * } * </code></pre> * * @param name The name of the note to list occurrences for in the form of * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. * @param filter The filter expression. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListNoteOccurrencesPagedResponse listNoteOccurrences(NoteName name, String filter) { ListNoteOccurrencesRequest request = ListNoteOccurrencesRequest.newBuilder() .setName(name == null ? null : name.toString()) .setFilter(filter) .build(); return listNoteOccurrences(request); }
private Builder() { maybeForceBuilderInitialization(); }
private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); }
public static Builder newBuilder(io.grafeas.v1beta1.ListNoteOccurrencesRequest prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); }
@Override public ListNoteOccurrencesRequest injectToken( ListNoteOccurrencesRequest payload, String token) { return ListNoteOccurrencesRequest.newBuilder(payload).setPageToken(token).build(); }