Class GrafeasClient (2.12.0)

  public 
  
 class 
 GrafeasClient 
  
 implements 
  
 BackgroundResource 
 

Service Description: Grafeas API.

Retrieves analysis results of Cloud components such as Docker container images.

Analysis results are stored as a series of occurrences. An Occurrence contains information about a specific analysis instance on a resource. An occurrence refers to a Note . A note contains details describing the analysis and is generally stored in a separate project, called a Provider . Multiple occurrences can refer to the same note.

For example, an SSL vulnerability could affect multiple images. In this case, there would be one note for the vulnerability and an occurrence for each image with the vulnerability referring to that note.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 OccurrenceName 
  
 name 
  
 = 
  
 OccurrenceName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[OCCURRENCE]" 
 ); 
  
 Occurrence 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 getOccurrence 
 ( 
 name 
 ); 
  
 } 
  
 

Note: close() needs to be called on the GrafeasClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of GrafeasSettings to create(). For example:

To customize credentials:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 GrafeasSettings 
  
 grafeasSettings 
  
 = 
  
 GrafeasSettings 
 . 
 newBuilder 
 () 
  
 . 
 setCredentialsProvider 
 ( 
 FixedCredentialsProvider 
 . 
 create 
 ( 
 myCredentials 
 )) 
  
 . 
 build 
 (); 
  
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ( 
 grafeasSettings 
 ); 
  
 

To customize the endpoint:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 GrafeasSettings 
  
 grafeasSettings 
  
 = 
  
 GrafeasSettings 
 . 
 newBuilder 
 (). 
 setEndpoint 
 ( 
 myEndpoint 
 ). 
 build 
 (); 
  
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ( 
 grafeasSettings 
 ); 
  
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > GrafeasClient

Implements

BackgroundResource

Static Methods

create()

  public 
  
 static 
  
 final 
  
 GrafeasClient 
  
 create 
 () 
 

Constructs an instance of GrafeasClient with default settings.

Returns
Type Description
GrafeasClient
Exceptions
Type Description
IOException

create(GrafeasSettings settings)

  public 
  
 static 
  
 final 
  
 GrafeasClient 
  
 create 
 ( 
 GrafeasSettings 
  
 settings 
 ) 
 

Constructs an instance of GrafeasClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
Name Description
settings GrafeasSettings
Returns
Type Description
GrafeasClient
Exceptions
Type Description
IOException

create(GrafeasStub stub)

  public 
  
 static 
  
 final 
  
 GrafeasClient 
  
 create 
 ( 
 GrafeasStub 
  
 stub 
 ) 
 

Constructs an instance of GrafeasClient, using the given stub for making calls. This is for advanced usage - prefer using create(GrafeasSettings).

Parameter
Name Description
stub GrafeasStub
Returns
Type Description
GrafeasClient

Constructors

GrafeasClient(GrafeasSettings settings)

  protected 
  
 GrafeasClient 
 ( 
 GrafeasSettings 
  
 settings 
 ) 
 

Constructs an instance of GrafeasClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
Name Description
settings GrafeasSettings

GrafeasClient(GrafeasStub stub)

  protected 
  
 GrafeasClient 
 ( 
 GrafeasStub 
  
 stub 
 ) 
 
Parameter
Name Description
stub GrafeasStub

Methods

awaitTermination(long duration, TimeUnit unit)

  public 
  
 boolean 
  
 awaitTermination 
 ( 
 long 
  
 duration 
 , 
  
 TimeUnit 
  
 unit 
 ) 
 
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

batchCreateNotes(BatchCreateNotesRequest request)

  public 
  
 final 
  
 BatchCreateNotesResponse 
  
 batchCreateNotes 
 ( 
 BatchCreateNotesRequest 
  
 request 
 ) 
 

Creates new notes in batch.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 BatchCreateNotesRequest 
  
 request 
  
 = 
  
 BatchCreateNotesRequest 
 . 
 newBuilder 
 () 
  
 . 
 setParent 
 ( 
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ). 
 toString 
 ()) 
  
 . 
 putAllNotes 
 ( 
 new 
  
 HashMap<String 
 , 
  
 Note 
> ()) 
  
 . 
 build 
 (); 
  
 BatchCreateNotesResponse 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 batchCreateNotes 
 ( 
 request 
 ); 
  
 } 
  
 
Parameter
Name Description
request BatchCreateNotesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
BatchCreateNotesResponse

batchCreateNotes(ProjectName parent, Map<String,Note> notes)

  public 
  
 final 
  
 BatchCreateNotesResponse 
  
 batchCreateNotes 
 ( 
 ProjectName 
  
 parent 
 , 
  
 Map<String 
 , 
 Note 
>  
 notes 
 ) 
 

Creates new notes in batch.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 ProjectName 
  
 parent 
  
 = 
  
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ); 
  
 Map<String 
 , 
  
 Note 
>  
 notes 
  
 = 
  
 new 
  
 HashMap 
<> (); 
  
 BatchCreateNotesResponse 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 batchCreateNotes 
 ( 
 parent 
 , 
  
 notes 
 ); 
  
 } 
  
 
Parameters
Name Description
parent ProjectName

The name of the project in the form of projects/[PROJECT_ID] , under which the notes are to be created.

notes Map < String , Note >

The notes to create. Max allowed length is 1000.

Returns
Type Description
BatchCreateNotesResponse

batchCreateNotes(String parent, Map<String,Note> notes)

  public 
  
 final 
  
 BatchCreateNotesResponse 
  
 batchCreateNotes 
 ( 
 String 
  
 parent 
 , 
  
 Map<String 
 , 
 Note 
>  
 notes 
 ) 
 

Creates new notes in batch.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 String 
  
 parent 
  
 = 
  
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ). 
 toString 
 (); 
  
 Map<String 
 , 
  
 Note 
>  
 notes 
  
 = 
  
 new 
  
 HashMap 
<> (); 
  
 BatchCreateNotesResponse 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 batchCreateNotes 
 ( 
 parent 
 , 
  
 notes 
 ); 
  
 } 
  
 
Parameters
Name Description
parent String

The name of the project in the form of projects/[PROJECT_ID] , under which the notes are to be created.

notes Map < String , Note >

The notes to create. Max allowed length is 1000.

Returns
Type Description
BatchCreateNotesResponse

batchCreateNotesCallable()

  public 
  
 final 
  
 UnaryCallable<BatchCreateNotesRequest 
 , 
 BatchCreateNotesResponse 
>  
 batchCreateNotesCallable 
 () 
 

Creates new notes in batch.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 BatchCreateNotesRequest 
  
 request 
  
 = 
  
 BatchCreateNotesRequest 
 . 
 newBuilder 
 () 
  
 . 
 setParent 
 ( 
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ). 
 toString 
 ()) 
  
 . 
 putAllNotes 
 ( 
 new 
  
 HashMap<String 
 , 
  
 Note 
> ()) 
  
 . 
 build 
 (); 
  
 ApiFuture<BatchCreateNotesResponse> 
  
 future 
  
 = 
  
 grafeasClient 
 . 
 batchCreateNotesCallable 
 (). 
 futureCall 
 ( 
 request 
 ); 
  
 // Do something. 
  
 BatchCreateNotesResponse 
  
 response 
  
 = 
  
 future 
 . 
 get 
 (); 
  
 } 
  
 
Returns
Type Description
UnaryCallable < BatchCreateNotesRequest , BatchCreateNotesResponse >

batchCreateOccurrences(BatchCreateOccurrencesRequest request)

  public 
  
 final 
  
 BatchCreateOccurrencesResponse 
  
 batchCreateOccurrences 
 ( 
 BatchCreateOccurrencesRequest 
  
 request 
 ) 
 

Creates new occurrences in batch.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 BatchCreateOccurrencesRequest 
  
 request 
  
 = 
  
 BatchCreateOccurrencesRequest 
 . 
 newBuilder 
 () 
  
 . 
 setParent 
 ( 
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ). 
 toString 
 ()) 
  
 . 
 addAllOccurrences 
 ( 
 new 
  
 ArrayList<Occurrence> 
 ()) 
  
 . 
 build 
 (); 
  
 BatchCreateOccurrencesResponse 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 batchCreateOccurrences 
 ( 
 request 
 ); 
  
 } 
  
 
Parameter
Name Description
request BatchCreateOccurrencesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
BatchCreateOccurrencesResponse

batchCreateOccurrences(ProjectName parent, List<Occurrence> occurrences)

  public 
  
 final 
  
 BatchCreateOccurrencesResponse 
  
 batchCreateOccurrences 
 ( 
 ProjectName 
  
 parent 
 , 
  
 List<Occurrence> 
  
 occurrences 
 ) 
 

Creates new occurrences in batch.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 ProjectName 
  
 parent 
  
 = 
  
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ); 
  
 List<Occurrence> 
  
 occurrences 
  
 = 
  
 new 
  
 ArrayList 
<> (); 
  
 BatchCreateOccurrencesResponse 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 batchCreateOccurrences 
 ( 
 parent 
 , 
  
 occurrences 
 ); 
  
 } 
  
 
Parameters
Name Description
parent ProjectName

The name of the project in the form of projects/[PROJECT_ID] , under which the occurrences are to be created.

occurrences List < Occurrence >

The occurrences to create. Max allowed length is 1000.

Returns
Type Description
BatchCreateOccurrencesResponse

batchCreateOccurrences(String parent, List<Occurrence> occurrences)

  public 
  
 final 
  
 BatchCreateOccurrencesResponse 
  
 batchCreateOccurrences 
 ( 
 String 
  
 parent 
 , 
  
 List<Occurrence> 
  
 occurrences 
 ) 
 

Creates new occurrences in batch.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 String 
  
 parent 
  
 = 
  
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ). 
 toString 
 (); 
  
 List<Occurrence> 
  
 occurrences 
  
 = 
  
 new 
  
 ArrayList 
<> (); 
  
 BatchCreateOccurrencesResponse 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 batchCreateOccurrences 
 ( 
 parent 
 , 
  
 occurrences 
 ); 
  
 } 
  
 
Parameters
Name Description
parent String

The name of the project in the form of projects/[PROJECT_ID] , under which the occurrences are to be created.

occurrences List < Occurrence >

The occurrences to create. Max allowed length is 1000.

Returns
Type Description
BatchCreateOccurrencesResponse

batchCreateOccurrencesCallable()

  public 
  
 final 
  
 UnaryCallable<BatchCreateOccurrencesRequest 
 , 
 BatchCreateOccurrencesResponse 
>  
 batchCreateOccurrencesCallable 
 () 
 

Creates new occurrences in batch.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 BatchCreateOccurrencesRequest 
  
 request 
  
 = 
  
 BatchCreateOccurrencesRequest 
 . 
 newBuilder 
 () 
  
 . 
 setParent 
 ( 
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ). 
 toString 
 ()) 
  
 . 
 addAllOccurrences 
 ( 
 new 
  
 ArrayList<Occurrence> 
 ()) 
  
 . 
 build 
 (); 
  
 ApiFuture<BatchCreateOccurrencesResponse> 
  
 future 
  
 = 
  
 grafeasClient 
 . 
 batchCreateOccurrencesCallable 
 (). 
 futureCall 
 ( 
 request 
 ); 
  
 // Do something. 
  
 BatchCreateOccurrencesResponse 
  
 response 
  
 = 
  
 future 
 . 
 get 
 (); 
  
 } 
  
 
Returns
Type Description
UnaryCallable < BatchCreateOccurrencesRequest , BatchCreateOccurrencesResponse >

close()

  public 
  
 final 
  
 void 
  
 close 
 () 
 

createNote(CreateNoteRequest request)

  public 
  
 final 
  
 Note 
  
 createNote 
 ( 
 CreateNoteRequest 
  
 request 
 ) 
 

Creates a new note.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 CreateNoteRequest 
  
 request 
  
 = 
  
 CreateNoteRequest 
 . 
 newBuilder 
 () 
  
 . 
 setParent 
 ( 
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ). 
 toString 
 ()) 
  
 . 
 setNoteId 
 ( 
 "noteId-1039694675" 
 ) 
  
 . 
 setNote 
 ( 
 Note 
 . 
 newBuilder 
 (). 
 build 
 ()) 
  
 . 
 build 
 (); 
  
 Note 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 createNote 
 ( 
 request 
 ); 
  
 } 
  
 
Parameter
Name Description
request CreateNoteRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Note

createNote(ProjectName parent, String noteId, Note note)

  public 
  
 final 
  
 Note 
  
 createNote 
 ( 
 ProjectName 
  
 parent 
 , 
  
 String 
  
 noteId 
 , 
  
 Note 
  
 note 
 ) 
 

Creates a new note.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 ProjectName 
  
 parent 
  
 = 
  
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ); 
  
 String 
  
 noteId 
  
 = 
  
 "noteId-1039694675" 
 ; 
  
 Note 
  
 note 
  
 = 
  
 Note 
 . 
 newBuilder 
 (). 
 build 
 (); 
  
 Note 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 createNote 
 ( 
 parent 
 , 
  
 noteId 
 , 
  
 note 
 ); 
  
 } 
  
 
Parameters
Name Description
parent ProjectName

The name of the project in the form of projects/[PROJECT_ID] , under which the note is to be created.

noteId String

The ID to use for this note.

note Note

The note to create.

Returns
Type Description
Note

createNote(String parent, String noteId, Note note)

  public 
  
 final 
  
 Note 
  
 createNote 
 ( 
 String 
  
 parent 
 , 
  
 String 
  
 noteId 
 , 
  
 Note 
  
 note 
 ) 
 

Creates a new note.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 String 
  
 parent 
  
 = 
  
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ). 
 toString 
 (); 
  
 String 
  
 noteId 
  
 = 
  
 "noteId-1039694675" 
 ; 
  
 Note 
  
 note 
  
 = 
  
 Note 
 . 
 newBuilder 
 (). 
 build 
 (); 
  
 Note 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 createNote 
 ( 
 parent 
 , 
  
 noteId 
 , 
  
 note 
 ); 
  
 } 
  
 
Parameters
Name Description
parent String

The name of the project in the form of projects/[PROJECT_ID] , under which the note is to be created.

noteId String

The ID to use for this note.

note Note

The note to create.

Returns
Type Description
Note

createNoteCallable()

  public 
  
 final 
  
 UnaryCallable<CreateNoteRequest 
 , 
 Note 
>  
 createNoteCallable 
 () 
 

Creates a new note.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 CreateNoteRequest 
  
 request 
  
 = 
  
 CreateNoteRequest 
 . 
 newBuilder 
 () 
  
 . 
 setParent 
 ( 
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ). 
 toString 
 ()) 
  
 . 
 setNoteId 
 ( 
 "noteId-1039694675" 
 ) 
  
 . 
 setNote 
 ( 
 Note 
 . 
 newBuilder 
 (). 
 build 
 ()) 
  
 . 
 build 
 (); 
  
 ApiFuture<Note> 
  
 future 
  
 = 
  
 grafeasClient 
 . 
 createNoteCallable 
 (). 
 futureCall 
 ( 
 request 
 ); 
  
 // Do something. 
  
 Note 
  
 response 
  
 = 
  
 future 
 . 
 get 
 (); 
  
 } 
  
 
Returns
Type Description
UnaryCallable < CreateNoteRequest , Note >

createOccurrence(CreateOccurrenceRequest request)

  public 
  
 final 
  
 Occurrence 
  
 createOccurrence 
 ( 
 CreateOccurrenceRequest 
  
 request 
 ) 
 

Creates a new occurrence.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 CreateOccurrenceRequest 
  
 request 
  
 = 
  
 CreateOccurrenceRequest 
 . 
 newBuilder 
 () 
  
 . 
 setParent 
 ( 
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ). 
 toString 
 ()) 
  
 . 
 setOccurrence 
 ( 
 Occurrence 
 . 
 newBuilder 
 (). 
 build 
 ()) 
  
 . 
 build 
 (); 
  
 Occurrence 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 createOccurrence 
 ( 
 request 
 ); 
  
 } 
  
 
Parameter
Name Description
request CreateOccurrenceRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Occurrence

createOccurrence(ProjectName parent, Occurrence occurrence)

  public 
  
 final 
  
 Occurrence 
  
 createOccurrence 
 ( 
 ProjectName 
  
 parent 
 , 
  
 Occurrence 
  
 occurrence 
 ) 
 

Creates a new occurrence.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 ProjectName 
  
 parent 
  
 = 
  
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ); 
  
 Occurrence 
  
 occurrence 
  
 = 
  
 Occurrence 
 . 
 newBuilder 
 (). 
 build 
 (); 
  
 Occurrence 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 createOccurrence 
 ( 
 parent 
 , 
  
 occurrence 
 ); 
  
 } 
  
 
Parameters
Name Description
parent ProjectName

The name of the project in the form of projects/[PROJECT_ID] , under which the occurrence is to be created.

occurrence Occurrence

The occurrence to create.

Returns
Type Description
Occurrence

createOccurrence(String parent, Occurrence occurrence)

  public 
  
 final 
  
 Occurrence 
  
 createOccurrence 
 ( 
 String 
  
 parent 
 , 
  
 Occurrence 
  
 occurrence 
 ) 
 

Creates a new occurrence.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 String 
  
 parent 
  
 = 
  
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ). 
 toString 
 (); 
  
 Occurrence 
  
 occurrence 
  
 = 
  
 Occurrence 
 . 
 newBuilder 
 (). 
 build 
 (); 
  
 Occurrence 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 createOccurrence 
 ( 
 parent 
 , 
  
 occurrence 
 ); 
  
 } 
  
 
Parameters
Name Description
parent String

The name of the project in the form of projects/[PROJECT_ID] , under which the occurrence is to be created.

occurrence Occurrence

The occurrence to create.

Returns
Type Description
Occurrence

createOccurrenceCallable()

  public 
  
 final 
  
 UnaryCallable<CreateOccurrenceRequest 
 , 
 Occurrence 
>  
 createOccurrenceCallable 
 () 
 

Creates a new occurrence.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 CreateOccurrenceRequest 
  
 request 
  
 = 
  
 CreateOccurrenceRequest 
 . 
 newBuilder 
 () 
  
 . 
 setParent 
 ( 
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ). 
 toString 
 ()) 
  
 . 
 setOccurrence 
 ( 
 Occurrence 
 . 
 newBuilder 
 (). 
 build 
 ()) 
  
 . 
 build 
 (); 
  
 ApiFuture<Occurrence> 
  
 future 
  
 = 
  
 grafeasClient 
 . 
 createOccurrenceCallable 
 (). 
 futureCall 
 ( 
 request 
 ); 
  
 // Do something. 
  
 Occurrence 
  
 response 
  
 = 
  
 future 
 . 
 get 
 (); 
  
 } 
  
 
Returns
Type Description
UnaryCallable < CreateOccurrenceRequest , Occurrence >

deleteNote(DeleteNoteRequest request)

  public 
  
 final 
  
 void 
  
 deleteNote 
 ( 
 DeleteNoteRequest 
  
 request 
 ) 
 

Deletes the specified note.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 DeleteNoteRequest 
  
 request 
  
 = 
  
 DeleteNoteRequest 
 . 
 newBuilder 
 () 
  
 . 
 setName 
 ( 
 NoteName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[NOTE]" 
 ). 
 toString 
 ()) 
  
 . 
 build 
 (); 
  
 grafeasClient 
 . 
 deleteNote 
 ( 
 request 
 ); 
  
 } 
  
 
Parameter
Name Description
request DeleteNoteRequest

The request object containing all of the parameters for the API call.

deleteNote(NoteName name)

  public 
  
 final 
  
 void 
  
 deleteNote 
 ( 
 NoteName 
  
 name 
 ) 
 

Deletes the specified note.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 NoteName 
  
 name 
  
 = 
  
 NoteName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[NOTE]" 
 ); 
  
 grafeasClient 
 . 
 deleteNote 
 ( 
 name 
 ); 
  
 } 
  
 
Parameter
Name Description
name NoteName

The name of the note in the form of projects/[PROVIDER_ID]/notes/[NOTE_ID] .

deleteNote(String name)

  public 
  
 final 
  
 void 
  
 deleteNote 
 ( 
 String 
  
 name 
 ) 
 

Deletes the specified note.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 String 
  
 name 
  
 = 
  
 NoteName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[NOTE]" 
 ). 
 toString 
 (); 
  
 grafeasClient 
 . 
 deleteNote 
 ( 
 name 
 ); 
  
 } 
  
 
Parameter
Name Description
name String

The name of the note in the form of projects/[PROVIDER_ID]/notes/[NOTE_ID] .

deleteNoteCallable()

  public 
  
 final 
  
 UnaryCallable<DeleteNoteRequest 
 , 
 Empty 
>  
 deleteNoteCallable 
 () 
 

Deletes the specified note.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 DeleteNoteRequest 
  
 request 
  
 = 
  
 DeleteNoteRequest 
 . 
 newBuilder 
 () 
  
 . 
 setName 
 ( 
 NoteName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[NOTE]" 
 ). 
 toString 
 ()) 
  
 . 
 build 
 (); 
  
 ApiFuture<Empty> 
  
 future 
  
 = 
  
 grafeasClient 
 . 
 deleteNoteCallable 
 (). 
 futureCall 
 ( 
 request 
 ); 
  
 // Do something. 
  
 future 
 . 
 get 
 (); 
  
 } 
  
 
Returns
Type Description
UnaryCallable < DeleteNoteRequest , Empty >

deleteOccurrence(DeleteOccurrenceRequest request)

  public 
  
 final 
  
 void 
  
 deleteOccurrence 
 ( 
 DeleteOccurrenceRequest 
  
 request 
 ) 
 

Deletes the specified occurrence. For example, use this method to delete an occurrence when the occurrence is no longer applicable for the given resource.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 DeleteOccurrenceRequest 
  
 request 
  
 = 
  
 DeleteOccurrenceRequest 
 . 
 newBuilder 
 () 
  
 . 
 setName 
 ( 
 OccurrenceName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[OCCURRENCE]" 
 ). 
 toString 
 ()) 
  
 . 
 build 
 (); 
  
 grafeasClient 
 . 
 deleteOccurrence 
 ( 
 request 
 ); 
  
 } 
  
 
Parameter
Name Description
request DeleteOccurrenceRequest

The request object containing all of the parameters for the API call.

deleteOccurrence(OccurrenceName name)

  public 
  
 final 
  
 void 
  
 deleteOccurrence 
 ( 
 OccurrenceName 
  
 name 
 ) 
 

Deletes the specified occurrence. For example, use this method to delete an occurrence when the occurrence is no longer applicable for the given resource.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 OccurrenceName 
  
 name 
  
 = 
  
 OccurrenceName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[OCCURRENCE]" 
 ); 
  
 grafeasClient 
 . 
 deleteOccurrence 
 ( 
 name 
 ); 
  
 } 
  
 
Parameter
Name Description
name OccurrenceName

The name of the occurrence in the form of projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] .

deleteOccurrence(String name)

  public 
  
 final 
  
 void 
  
 deleteOccurrence 
 ( 
 String 
  
 name 
 ) 
 

Deletes the specified occurrence. For example, use this method to delete an occurrence when the occurrence is no longer applicable for the given resource.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 String 
  
 name 
  
 = 
  
 OccurrenceName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[OCCURRENCE]" 
 ). 
 toString 
 (); 
  
 grafeasClient 
 . 
 deleteOccurrence 
 ( 
 name 
 ); 
  
 } 
  
 
Parameter
Name Description
name String

The name of the occurrence in the form of projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] .

deleteOccurrenceCallable()

  public 
  
 final 
  
 UnaryCallable<DeleteOccurrenceRequest 
 , 
 Empty 
>  
 deleteOccurrenceCallable 
 () 
 

Deletes the specified occurrence. For example, use this method to delete an occurrence when the occurrence is no longer applicable for the given resource.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 DeleteOccurrenceRequest 
  
 request 
  
 = 
  
 DeleteOccurrenceRequest 
 . 
 newBuilder 
 () 
  
 . 
 setName 
 ( 
 OccurrenceName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[OCCURRENCE]" 
 ). 
 toString 
 ()) 
  
 . 
 build 
 (); 
  
 ApiFuture<Empty> 
  
 future 
  
 = 
  
 grafeasClient 
 . 
 deleteOccurrenceCallable 
 (). 
 futureCall 
 ( 
 request 
 ); 
  
 // Do something. 
  
 future 
 . 
 get 
 (); 
  
 } 
  
 
Returns
Type Description
UnaryCallable < DeleteOccurrenceRequest , Empty >

getNote(GetNoteRequest request)

  public 
  
 final 
  
 Note 
  
 getNote 
 ( 
 GetNoteRequest 
  
 request 
 ) 
 

Gets the specified note.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 GetNoteRequest 
  
 request 
  
 = 
  
 GetNoteRequest 
 . 
 newBuilder 
 () 
  
 . 
 setName 
 ( 
 NoteName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[NOTE]" 
 ). 
 toString 
 ()) 
  
 . 
 build 
 (); 
  
 Note 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 getNote 
 ( 
 request 
 ); 
  
 } 
  
 
Parameter
Name Description
request GetNoteRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Note

getNote(NoteName name)

  public 
  
 final 
  
 Note 
  
 getNote 
 ( 
 NoteName 
  
 name 
 ) 
 

Gets the specified note.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 NoteName 
  
 name 
  
 = 
  
 NoteName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[NOTE]" 
 ); 
  
 Note 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 getNote 
 ( 
 name 
 ); 
  
 } 
  
 
Parameter
Name Description
name NoteName

The name of the note in the form of projects/[PROVIDER_ID]/notes/[NOTE_ID] .

Returns
Type Description
Note

getNote(String name)

  public 
  
 final 
  
 Note 
  
 getNote 
 ( 
 String 
  
 name 
 ) 
 

Gets the specified note.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 String 
  
 name 
  
 = 
  
 NoteName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[NOTE]" 
 ). 
 toString 
 (); 
  
 Note 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 getNote 
 ( 
 name 
 ); 
  
 } 
  
 
Parameter
Name Description
name String

The name of the note in the form of projects/[PROVIDER_ID]/notes/[NOTE_ID] .

Returns
Type Description
Note

getNoteCallable()

  public 
  
 final 
  
 UnaryCallable<GetNoteRequest 
 , 
 Note 
>  
 getNoteCallable 
 () 
 

Gets the specified note.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 GetNoteRequest 
  
 request 
  
 = 
  
 GetNoteRequest 
 . 
 newBuilder 
 () 
  
 . 
 setName 
 ( 
 NoteName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[NOTE]" 
 ). 
 toString 
 ()) 
  
 . 
 build 
 (); 
  
 ApiFuture<Note> 
  
 future 
  
 = 
  
 grafeasClient 
 . 
 getNoteCallable 
 (). 
 futureCall 
 ( 
 request 
 ); 
  
 // Do something. 
  
 Note 
  
 response 
  
 = 
  
 future 
 . 
 get 
 (); 
  
 } 
  
 
Returns
Type Description
UnaryCallable < GetNoteRequest , Note >

getOccurrence(GetOccurrenceRequest request)

  public 
  
 final 
  
 Occurrence 
  
 getOccurrence 
 ( 
 GetOccurrenceRequest 
  
 request 
 ) 
 

Gets the specified occurrence.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 GetOccurrenceRequest 
  
 request 
  
 = 
  
 GetOccurrenceRequest 
 . 
 newBuilder 
 () 
  
 . 
 setName 
 ( 
 OccurrenceName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[OCCURRENCE]" 
 ). 
 toString 
 ()) 
  
 . 
 build 
 (); 
  
 Occurrence 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 getOccurrence 
 ( 
 request 
 ); 
  
 } 
  
 
Parameter
Name Description
request GetOccurrenceRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Occurrence

getOccurrence(OccurrenceName name)

  public 
  
 final 
  
 Occurrence 
  
 getOccurrence 
 ( 
 OccurrenceName 
  
 name 
 ) 
 

Gets the specified occurrence.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 OccurrenceName 
  
 name 
  
 = 
  
 OccurrenceName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[OCCURRENCE]" 
 ); 
  
 Occurrence 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 getOccurrence 
 ( 
 name 
 ); 
  
 } 
  
 
Parameter
Name Description
name OccurrenceName

The name of the occurrence in the form of projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] .

Returns
Type Description
Occurrence

getOccurrence(String name)

  public 
  
 final 
  
 Occurrence 
  
 getOccurrence 
 ( 
 String 
  
 name 
 ) 
 

Gets the specified occurrence.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 String 
  
 name 
  
 = 
  
 OccurrenceName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[OCCURRENCE]" 
 ). 
 toString 
 (); 
  
 Occurrence 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 getOccurrence 
 ( 
 name 
 ); 
  
 } 
  
 
Parameter
Name Description
name String

The name of the occurrence in the form of projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] .

Returns
Type Description
Occurrence

getOccurrenceCallable()

  public 
  
 final 
  
 UnaryCallable<GetOccurrenceRequest 
 , 
 Occurrence 
>  
 getOccurrenceCallable 
 () 
 

Gets the specified occurrence.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 GetOccurrenceRequest 
  
 request 
  
 = 
  
 GetOccurrenceRequest 
 . 
 newBuilder 
 () 
  
 . 
 setName 
 ( 
 OccurrenceName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[OCCURRENCE]" 
 ). 
 toString 
 ()) 
  
 . 
 build 
 (); 
  
 ApiFuture<Occurrence> 
  
 future 
  
 = 
  
 grafeasClient 
 . 
 getOccurrenceCallable 
 (). 
 futureCall 
 ( 
 request 
 ); 
  
 // Do something. 
  
 Occurrence 
  
 response 
  
 = 
  
 future 
 . 
 get 
 (); 
  
 } 
  
 
Returns
Type Description
UnaryCallable < GetOccurrenceRequest , Occurrence >

getOccurrenceNote(GetOccurrenceNoteRequest request)

  public 
  
 final 
  
 Note 
  
 getOccurrenceNote 
 ( 
 GetOccurrenceNoteRequest 
  
 request 
 ) 
 

Gets the note attached to the specified occurrence. Consumer projects can use this method to get a note that belongs to a provider project.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 GetOccurrenceNoteRequest 
  
 request 
  
 = 
  
 GetOccurrenceNoteRequest 
 . 
 newBuilder 
 () 
  
 . 
 setName 
 ( 
 OccurrenceName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[OCCURRENCE]" 
 ). 
 toString 
 ()) 
  
 . 
 build 
 (); 
  
 Note 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 getOccurrenceNote 
 ( 
 request 
 ); 
  
 } 
  
 
Parameter
Name Description
request GetOccurrenceNoteRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Note

getOccurrenceNote(OccurrenceName name)

  public 
  
 final 
  
 Note 
  
 getOccurrenceNote 
 ( 
 OccurrenceName 
  
 name 
 ) 
 

Gets the note attached to the specified occurrence. Consumer projects can use this method to get a note that belongs to a provider project.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 OccurrenceName 
  
 name 
  
 = 
  
 OccurrenceName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[OCCURRENCE]" 
 ); 
  
 Note 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 getOccurrenceNote 
 ( 
 name 
 ); 
  
 } 
  
 
Parameter
Name Description
name OccurrenceName

The name of the occurrence in the form of projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] .

Returns
Type Description
Note

getOccurrenceNote(String name)

  public 
  
 final 
  
 Note 
  
 getOccurrenceNote 
 ( 
 String 
  
 name 
 ) 
 

Gets the note attached to the specified occurrence. Consumer projects can use this method to get a note that belongs to a provider project.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 String 
  
 name 
  
 = 
  
 OccurrenceName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[OCCURRENCE]" 
 ). 
 toString 
 (); 
  
 Note 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 getOccurrenceNote 
 ( 
 name 
 ); 
  
 } 
  
 
Parameter
Name Description
name String

The name of the occurrence in the form of projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] .

Returns
Type Description
Note

getOccurrenceNoteCallable()

  public 
  
 final 
  
 UnaryCallable<GetOccurrenceNoteRequest 
 , 
 Note 
>  
 getOccurrenceNoteCallable 
 () 
 

Gets the note attached to the specified occurrence. Consumer projects can use this method to get a note that belongs to a provider project.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 GetOccurrenceNoteRequest 
  
 request 
  
 = 
  
 GetOccurrenceNoteRequest 
 . 
 newBuilder 
 () 
  
 . 
 setName 
 ( 
 OccurrenceName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[OCCURRENCE]" 
 ). 
 toString 
 ()) 
  
 . 
 build 
 (); 
  
 ApiFuture<Note> 
  
 future 
  
 = 
  
 grafeasClient 
 . 
 getOccurrenceNoteCallable 
 (). 
 futureCall 
 ( 
 request 
 ); 
  
 // Do something. 
  
 Note 
  
 response 
  
 = 
  
 future 
 . 
 get 
 (); 
  
 } 
  
 
Returns
Type Description
UnaryCallable < GetOccurrenceNoteRequest , Note >

getSettings()

  public 
  
 final 
  
 GrafeasSettings 
  
 getSettings 
 () 
 
Returns
Type Description
GrafeasSettings

getStub()

  public 
  
 GrafeasStub 
  
 getStub 
 () 
 
Returns
Type Description
GrafeasStub

isShutdown()

  public 
  
 boolean 
  
 isShutdown 
 () 
 
Returns
Type Description
boolean

isTerminated()

  public 
  
 boolean 
  
 isTerminated 
 () 
 
Returns
Type Description
boolean

listNoteOccurrences(ListNoteOccurrencesRequest request)

  public 
  
 final 
  
 GrafeasClient 
 . 
 ListNoteOccurrencesPagedResponse 
  
 listNoteOccurrences 
 ( 
 ListNoteOccurrencesRequest 
  
 request 
 ) 
 

Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 ListNoteOccurrencesRequest 
  
 request 
  
 = 
  
 ListNoteOccurrencesRequest 
 . 
 newBuilder 
 () 
  
 . 
 setName 
 ( 
 NoteName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[NOTE]" 
 ). 
 toString 
 ()) 
  
 . 
 setFilter 
 ( 
 "filter-1274492040" 
 ) 
  
 . 
 setPageSize 
 ( 
 883849137 
 ) 
  
 . 
 setPageToken 
 ( 
 "pageToken873572522" 
 ) 
  
 . 
 build 
 (); 
  
 for 
  
 ( 
 Occurrence 
  
 element 
  
 : 
  
 grafeasClient 
 . 
 listNoteOccurrences 
 ( 
 request 
 ). 
 iterateAll 
 ()) 
  
 { 
  
 // doThingsWith(element); 
  
 } 
  
 } 
  
 
Parameter
Name Description
request ListNoteOccurrencesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
GrafeasClient.ListNoteOccurrencesPagedResponse

listNoteOccurrences(NoteName name, String filter)

  public 
  
 final 
  
 GrafeasClient 
 . 
 ListNoteOccurrencesPagedResponse 
  
 listNoteOccurrences 
 ( 
 NoteName 
  
 name 
 , 
  
 String 
  
 filter 
 ) 
 

Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 NoteName 
  
 name 
  
 = 
  
 NoteName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[NOTE]" 
 ); 
  
 String 
  
 filter 
  
 = 
  
 "filter-1274492040" 
 ; 
  
 for 
  
 ( 
 Occurrence 
  
 element 
  
 : 
  
 grafeasClient 
 . 
 listNoteOccurrences 
 ( 
 name 
 , 
  
 filter 
 ). 
 iterateAll 
 ()) 
  
 { 
  
 // doThingsWith(element); 
  
 } 
  
 } 
  
 
Parameters
Name Description
name NoteName

The name of the note to list occurrences for in the form of projects/[PROVIDER_ID]/notes/[NOTE_ID] .

filter String

The filter expression.

Returns
Type Description
GrafeasClient.ListNoteOccurrencesPagedResponse

listNoteOccurrences(String name, String filter)

  public 
  
 final 
  
 GrafeasClient 
 . 
 ListNoteOccurrencesPagedResponse 
  
 listNoteOccurrences 
 ( 
 String 
  
 name 
 , 
  
 String 
  
 filter 
 ) 
 

Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 String 
  
 name 
  
 = 
  
 NoteName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[NOTE]" 
 ). 
 toString 
 (); 
  
 String 
  
 filter 
  
 = 
  
 "filter-1274492040" 
 ; 
  
 for 
  
 ( 
 Occurrence 
  
 element 
  
 : 
  
 grafeasClient 
 . 
 listNoteOccurrences 
 ( 
 name 
 , 
  
 filter 
 ). 
 iterateAll 
 ()) 
  
 { 
  
 // doThingsWith(element); 
  
 } 
  
 } 
  
 
Parameters
Name Description
name String

The name of the note to list occurrences for in the form of projects/[PROVIDER_ID]/notes/[NOTE_ID] .

filter String

The filter expression.

Returns
Type Description
GrafeasClient.ListNoteOccurrencesPagedResponse

listNoteOccurrencesCallable()

  public 
  
 final 
  
 UnaryCallable<ListNoteOccurrencesRequest 
 , 
 ListNoteOccurrencesResponse 
>  
 listNoteOccurrencesCallable 
 () 
 

Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 ListNoteOccurrencesRequest 
  
 request 
  
 = 
  
 ListNoteOccurrencesRequest 
 . 
 newBuilder 
 () 
  
 . 
 setName 
 ( 
 NoteName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[NOTE]" 
 ). 
 toString 
 ()) 
  
 . 
 setFilter 
 ( 
 "filter-1274492040" 
 ) 
  
 . 
 setPageSize 
 ( 
 883849137 
 ) 
  
 . 
 setPageToken 
 ( 
 "pageToken873572522" 
 ) 
  
 . 
 build 
 (); 
  
 while 
  
 ( 
 true 
 ) 
  
 { 
  
 ListNoteOccurrencesResponse 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 listNoteOccurrencesCallable 
 (). 
 call 
 ( 
 request 
 ); 
  
 for 
  
 ( 
 Occurrence 
  
 element 
  
 : 
  
 response 
 . 
 getOccurrencesList 
 ()) 
  
 { 
  
 // doThingsWith(element); 
  
 } 
  
 String 
  
 nextPageToken 
  
 = 
  
 response 
 . 
 getNextPageToken 
 (); 
  
 if 
  
 ( 
 ! 
 Strings 
 . 
 isNullOrEmpty 
 ( 
 nextPageToken 
 )) 
  
 { 
  
 request 
  
 = 
  
 request 
 . 
 toBuilder 
 (). 
 setPageToken 
 ( 
 nextPageToken 
 ). 
 build 
 (); 
  
 } 
  
 else 
  
 { 
  
 break 
 ; 
  
 } 
  
 } 
  
 } 
  
 
Returns
Type Description
UnaryCallable < ListNoteOccurrencesRequest , ListNoteOccurrencesResponse >

listNoteOccurrencesPagedCallable()

  public 
  
 final 
  
 UnaryCallable<ListNoteOccurrencesRequest 
 , 
 GrafeasClient 
 . 
 ListNoteOccurrencesPagedResponse 
>  
 listNoteOccurrencesPagedCallable 
 () 
 

Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 ListNoteOccurrencesRequest 
  
 request 
  
 = 
  
 ListNoteOccurrencesRequest 
 . 
 newBuilder 
 () 
  
 . 
 setName 
 ( 
 NoteName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[NOTE]" 
 ). 
 toString 
 ()) 
  
 . 
 setFilter 
 ( 
 "filter-1274492040" 
 ) 
  
 . 
 setPageSize 
 ( 
 883849137 
 ) 
  
 . 
 setPageToken 
 ( 
 "pageToken873572522" 
 ) 
  
 . 
 build 
 (); 
  
 ApiFuture<Occurrence> 
  
 future 
  
 = 
  
 grafeasClient 
 . 
 listNoteOccurrencesPagedCallable 
 (). 
 futureCall 
 ( 
 request 
 ); 
  
 // Do something. 
  
 for 
  
 ( 
 Occurrence 
  
 element 
  
 : 
  
 future 
 . 
 get 
 (). 
 iterateAll 
 ()) 
  
 { 
  
 // doThingsWith(element); 
  
 } 
  
 } 
  
 
Returns
Type Description
UnaryCallable < ListNoteOccurrencesRequest , ListNoteOccurrencesPagedResponse >

listNotes(ListNotesRequest request)

  public 
  
 final 
  
 GrafeasClient 
 . 
 ListNotesPagedResponse 
  
 listNotes 
 ( 
 ListNotesRequest 
  
 request 
 ) 
 

Lists notes for the specified project.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 ListNotesRequest 
  
 request 
  
 = 
  
 ListNotesRequest 
 . 
 newBuilder 
 () 
  
 . 
 setParent 
 ( 
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ). 
 toString 
 ()) 
  
 . 
 setFilter 
 ( 
 "filter-1274492040" 
 ) 
  
 . 
 setPageSize 
 ( 
 883849137 
 ) 
  
 . 
 setPageToken 
 ( 
 "pageToken873572522" 
 ) 
  
 . 
 build 
 (); 
  
 for 
  
 ( 
 Note 
  
 element 
  
 : 
  
 grafeasClient 
 . 
 listNotes 
 ( 
 request 
 ). 
 iterateAll 
 ()) 
  
 { 
  
 // doThingsWith(element); 
  
 } 
  
 } 
  
 
Parameter
Name Description
request ListNotesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
GrafeasClient.ListNotesPagedResponse

listNotes(ProjectName parent, String filter)

  public 
  
 final 
  
 GrafeasClient 
 . 
 ListNotesPagedResponse 
  
 listNotes 
 ( 
 ProjectName 
  
 parent 
 , 
  
 String 
  
 filter 
 ) 
 

Lists notes for the specified project.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 ProjectName 
  
 parent 
  
 = 
  
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ); 
  
 String 
  
 filter 
  
 = 
  
 "filter-1274492040" 
 ; 
  
 for 
  
 ( 
 Note 
  
 element 
  
 : 
  
 grafeasClient 
 . 
 listNotes 
 ( 
 parent 
 , 
  
 filter 
 ). 
 iterateAll 
 ()) 
  
 { 
  
 // doThingsWith(element); 
  
 } 
  
 } 
  
 
Parameters
Name Description
parent ProjectName

The name of the project to list notes for in the form of projects/[PROJECT_ID] .

filter String

The filter expression.

Returns
Type Description
GrafeasClient.ListNotesPagedResponse

listNotes(String parent, String filter)

  public 
  
 final 
  
 GrafeasClient 
 . 
 ListNotesPagedResponse 
  
 listNotes 
 ( 
 String 
  
 parent 
 , 
  
 String 
  
 filter 
 ) 
 

Lists notes for the specified project.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 String 
  
 parent 
  
 = 
  
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ). 
 toString 
 (); 
  
 String 
  
 filter 
  
 = 
  
 "filter-1274492040" 
 ; 
  
 for 
  
 ( 
 Note 
  
 element 
  
 : 
  
 grafeasClient 
 . 
 listNotes 
 ( 
 parent 
 , 
  
 filter 
 ). 
 iterateAll 
 ()) 
  
 { 
  
 // doThingsWith(element); 
  
 } 
  
 } 
  
 
Parameters
Name Description
parent String

The name of the project to list notes for in the form of projects/[PROJECT_ID] .

filter String

The filter expression.

Returns
Type Description
GrafeasClient.ListNotesPagedResponse

listNotesCallable()

  public 
  
 final 
  
 UnaryCallable<ListNotesRequest 
 , 
 ListNotesResponse 
>  
 listNotesCallable 
 () 
 

Lists notes for the specified project.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 ListNotesRequest 
  
 request 
  
 = 
  
 ListNotesRequest 
 . 
 newBuilder 
 () 
  
 . 
 setParent 
 ( 
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ). 
 toString 
 ()) 
  
 . 
 setFilter 
 ( 
 "filter-1274492040" 
 ) 
  
 . 
 setPageSize 
 ( 
 883849137 
 ) 
  
 . 
 setPageToken 
 ( 
 "pageToken873572522" 
 ) 
  
 . 
 build 
 (); 
  
 while 
  
 ( 
 true 
 ) 
  
 { 
  
 ListNotesResponse 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 listNotesCallable 
 (). 
 call 
 ( 
 request 
 ); 
  
 for 
  
 ( 
 Note 
  
 element 
  
 : 
  
 response 
 . 
 getNotesList 
 ()) 
  
 { 
  
 // doThingsWith(element); 
  
 } 
  
 String 
  
 nextPageToken 
  
 = 
  
 response 
 . 
 getNextPageToken 
 (); 
  
 if 
  
 ( 
 ! 
 Strings 
 . 
 isNullOrEmpty 
 ( 
 nextPageToken 
 )) 
  
 { 
  
 request 
  
 = 
  
 request 
 . 
 toBuilder 
 (). 
 setPageToken 
 ( 
 nextPageToken 
 ). 
 build 
 (); 
  
 } 
  
 else 
  
 { 
  
 break 
 ; 
  
 } 
  
 } 
  
 } 
  
 
Returns
Type Description
UnaryCallable < ListNotesRequest , ListNotesResponse >

listNotesPagedCallable()

  public 
  
 final 
  
 UnaryCallable<ListNotesRequest 
 , 
 GrafeasClient 
 . 
 ListNotesPagedResponse 
>  
 listNotesPagedCallable 
 () 
 

Lists notes for the specified project.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 ListNotesRequest 
  
 request 
  
 = 
  
 ListNotesRequest 
 . 
 newBuilder 
 () 
  
 . 
 setParent 
 ( 
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ). 
 toString 
 ()) 
  
 . 
 setFilter 
 ( 
 "filter-1274492040" 
 ) 
  
 . 
 setPageSize 
 ( 
 883849137 
 ) 
  
 . 
 setPageToken 
 ( 
 "pageToken873572522" 
 ) 
  
 . 
 build 
 (); 
  
 ApiFuture<Note> 
  
 future 
  
 = 
  
 grafeasClient 
 . 
 listNotesPagedCallable 
 (). 
 futureCall 
 ( 
 request 
 ); 
  
 // Do something. 
  
 for 
  
 ( 
 Note 
  
 element 
  
 : 
  
 future 
 . 
 get 
 (). 
 iterateAll 
 ()) 
  
 { 
  
 // doThingsWith(element); 
  
 } 
  
 } 
  
 
Returns
Type Description
UnaryCallable < ListNotesRequest , ListNotesPagedResponse >

listOccurrences(ListOccurrencesRequest request)

  public 
  
 final 
  
 GrafeasClient 
 . 
 ListOccurrencesPagedResponse 
  
 listOccurrences 
 ( 
 ListOccurrencesRequest 
  
 request 
 ) 
 

Lists occurrences for the specified project.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 ListOccurrencesRequest 
  
 request 
  
 = 
  
 ListOccurrencesRequest 
 . 
 newBuilder 
 () 
  
 . 
 setParent 
 ( 
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ). 
 toString 
 ()) 
  
 . 
 setFilter 
 ( 
 "filter-1274492040" 
 ) 
  
 . 
 setPageSize 
 ( 
 883849137 
 ) 
  
 . 
 setPageToken 
 ( 
 "pageToken873572522" 
 ) 
  
 . 
 build 
 (); 
  
 for 
  
 ( 
 Occurrence 
  
 element 
  
 : 
  
 grafeasClient 
 . 
 listOccurrences 
 ( 
 request 
 ). 
 iterateAll 
 ()) 
  
 { 
  
 // doThingsWith(element); 
  
 } 
  
 } 
  
 
Parameter
Name Description
request ListOccurrencesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
GrafeasClient.ListOccurrencesPagedResponse

listOccurrences(ProjectName parent, String filter)

  public 
  
 final 
  
 GrafeasClient 
 . 
 ListOccurrencesPagedResponse 
  
 listOccurrences 
 ( 
 ProjectName 
  
 parent 
 , 
  
 String 
  
 filter 
 ) 
 

Lists occurrences for the specified project.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 ProjectName 
  
 parent 
  
 = 
  
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ); 
  
 String 
  
 filter 
  
 = 
  
 "filter-1274492040" 
 ; 
  
 for 
  
 ( 
 Occurrence 
  
 element 
  
 : 
  
 grafeasClient 
 . 
 listOccurrences 
 ( 
 parent 
 , 
  
 filter 
 ). 
 iterateAll 
 ()) 
  
 { 
  
 // doThingsWith(element); 
  
 } 
  
 } 
  
 
Parameters
Name Description
parent ProjectName

The name of the project to list occurrences for in the form of projects/[PROJECT_ID] .

filter String

The filter expression.

Returns
Type Description
GrafeasClient.ListOccurrencesPagedResponse

listOccurrences(String parent, String filter)

  public 
  
 final 
  
 GrafeasClient 
 . 
 ListOccurrencesPagedResponse 
  
 listOccurrences 
 ( 
 String 
  
 parent 
 , 
  
 String 
  
 filter 
 ) 
 

Lists occurrences for the specified project.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 String 
  
 parent 
  
 = 
  
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ). 
 toString 
 (); 
  
 String 
  
 filter 
  
 = 
  
 "filter-1274492040" 
 ; 
  
 for 
  
 ( 
 Occurrence 
  
 element 
  
 : 
  
 grafeasClient 
 . 
 listOccurrences 
 ( 
 parent 
 , 
  
 filter 
 ). 
 iterateAll 
 ()) 
  
 { 
  
 // doThingsWith(element); 
  
 } 
  
 } 
  
 
Parameters
Name Description
parent String

The name of the project to list occurrences for in the form of projects/[PROJECT_ID] .

filter String

The filter expression.

Returns
Type Description
GrafeasClient.ListOccurrencesPagedResponse

listOccurrencesCallable()

  public 
  
 final 
  
 UnaryCallable<ListOccurrencesRequest 
 , 
 ListOccurrencesResponse 
>  
 listOccurrencesCallable 
 () 
 

Lists occurrences for the specified project.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 ListOccurrencesRequest 
  
 request 
  
 = 
  
 ListOccurrencesRequest 
 . 
 newBuilder 
 () 
  
 . 
 setParent 
 ( 
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ). 
 toString 
 ()) 
  
 . 
 setFilter 
 ( 
 "filter-1274492040" 
 ) 
  
 . 
 setPageSize 
 ( 
 883849137 
 ) 
  
 . 
 setPageToken 
 ( 
 "pageToken873572522" 
 ) 
  
 . 
 build 
 (); 
  
 while 
  
 ( 
 true 
 ) 
  
 { 
  
 ListOccurrencesResponse 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 listOccurrencesCallable 
 (). 
 call 
 ( 
 request 
 ); 
  
 for 
  
 ( 
 Occurrence 
  
 element 
  
 : 
  
 response 
 . 
 getOccurrencesList 
 ()) 
  
 { 
  
 // doThingsWith(element); 
  
 } 
  
 String 
  
 nextPageToken 
  
 = 
  
 response 
 . 
 getNextPageToken 
 (); 
  
 if 
  
 ( 
 ! 
 Strings 
 . 
 isNullOrEmpty 
 ( 
 nextPageToken 
 )) 
  
 { 
  
 request 
  
 = 
  
 request 
 . 
 toBuilder 
 (). 
 setPageToken 
 ( 
 nextPageToken 
 ). 
 build 
 (); 
  
 } 
  
 else 
  
 { 
  
 break 
 ; 
  
 } 
  
 } 
  
 } 
  
 
Returns
Type Description
UnaryCallable < ListOccurrencesRequest , ListOccurrencesResponse >

listOccurrencesPagedCallable()

  public 
  
 final 
  
 UnaryCallable<ListOccurrencesRequest 
 , 
 GrafeasClient 
 . 
 ListOccurrencesPagedResponse 
>  
 listOccurrencesPagedCallable 
 () 
 

Lists occurrences for the specified project.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 ListOccurrencesRequest 
  
 request 
  
 = 
  
 ListOccurrencesRequest 
 . 
 newBuilder 
 () 
  
 . 
 setParent 
 ( 
 ProjectName 
 . 
 of 
 ( 
 "[PROJECT]" 
 ). 
 toString 
 ()) 
  
 . 
 setFilter 
 ( 
 "filter-1274492040" 
 ) 
  
 . 
 setPageSize 
 ( 
 883849137 
 ) 
  
 . 
 setPageToken 
 ( 
 "pageToken873572522" 
 ) 
  
 . 
 build 
 (); 
  
 ApiFuture<Occurrence> 
  
 future 
  
 = 
  
 grafeasClient 
 . 
 listOccurrencesPagedCallable 
 (). 
 futureCall 
 ( 
 request 
 ); 
  
 // Do something. 
  
 for 
  
 ( 
 Occurrence 
  
 element 
  
 : 
  
 future 
 . 
 get 
 (). 
 iterateAll 
 ()) 
  
 { 
  
 // doThingsWith(element); 
  
 } 
  
 } 
  
 
Returns
Type Description
UnaryCallable < ListOccurrencesRequest , ListOccurrencesPagedResponse >

shutdown()

  public 
  
 void 
  
 shutdown 
 () 
 

shutdownNow()

  public 
  
 void 
  
 shutdownNow 
 () 
 

updateNote(NoteName name, Note note, FieldMask updateMask)

  public 
  
 final 
  
 Note 
  
 updateNote 
 ( 
 NoteName 
  
 name 
 , 
  
 Note 
  
 note 
 , 
  
 FieldMask 
  
 updateMask 
 ) 
 

Updates the specified note.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 NoteName 
  
 name 
  
 = 
  
 NoteName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[NOTE]" 
 ); 
  
 Note 
  
 note 
  
 = 
  
 Note 
 . 
 newBuilder 
 (). 
 build 
 (); 
  
 FieldMask 
  
 updateMask 
  
 = 
  
 FieldMask 
 . 
 newBuilder 
 (). 
 build 
 (); 
  
 Note 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 updateNote 
 ( 
 name 
 , 
  
 note 
 , 
  
 updateMask 
 ); 
  
 } 
  
 
Parameters
Name Description
name NoteName

The name of the note in the form of projects/[PROVIDER_ID]/notes/[NOTE_ID] .

note Note

The updated note.

updateMask FieldMask

The fields to update.

Returns
Type Description
Note

updateNote(UpdateNoteRequest request)

  public 
  
 final 
  
 Note 
  
 updateNote 
 ( 
 UpdateNoteRequest 
  
 request 
 ) 
 

Updates the specified note.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 UpdateNoteRequest 
  
 request 
  
 = 
  
 UpdateNoteRequest 
 . 
 newBuilder 
 () 
  
 . 
 setName 
 ( 
 NoteName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[NOTE]" 
 ). 
 toString 
 ()) 
  
 . 
 setNote 
 ( 
 Note 
 . 
 newBuilder 
 (). 
 build 
 ()) 
  
 . 
 setUpdateMask 
 ( 
 FieldMask 
 . 
 newBuilder 
 (). 
 build 
 ()) 
  
 . 
 build 
 (); 
  
 Note 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 updateNote 
 ( 
 request 
 ); 
  
 } 
  
 
Parameter
Name Description
request UpdateNoteRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Note

updateNote(String name, Note note, FieldMask updateMask)

  public 
  
 final 
  
 Note 
  
 updateNote 
 ( 
 String 
  
 name 
 , 
  
 Note 
  
 note 
 , 
  
 FieldMask 
  
 updateMask 
 ) 
 

Updates the specified note.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 String 
  
 name 
  
 = 
  
 NoteName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[NOTE]" 
 ). 
 toString 
 (); 
  
 Note 
  
 note 
  
 = 
  
 Note 
 . 
 newBuilder 
 (). 
 build 
 (); 
  
 FieldMask 
  
 updateMask 
  
 = 
  
 FieldMask 
 . 
 newBuilder 
 (). 
 build 
 (); 
  
 Note 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 updateNote 
 ( 
 name 
 , 
  
 note 
 , 
  
 updateMask 
 ); 
  
 } 
  
 
Parameters
Name Description
name String

The name of the note in the form of projects/[PROVIDER_ID]/notes/[NOTE_ID] .

note Note

The updated note.

updateMask FieldMask

The fields to update.

Returns
Type Description
Note

updateNoteCallable()

  public 
  
 final 
  
 UnaryCallable<UpdateNoteRequest 
 , 
 Note 
>  
 updateNoteCallable 
 () 
 

Updates the specified note.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 UpdateNoteRequest 
  
 request 
  
 = 
  
 UpdateNoteRequest 
 . 
 newBuilder 
 () 
  
 . 
 setName 
 ( 
 NoteName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[NOTE]" 
 ). 
 toString 
 ()) 
  
 . 
 setNote 
 ( 
 Note 
 . 
 newBuilder 
 (). 
 build 
 ()) 
  
 . 
 setUpdateMask 
 ( 
 FieldMask 
 . 
 newBuilder 
 (). 
 build 
 ()) 
  
 . 
 build 
 (); 
  
 ApiFuture<Note> 
  
 future 
  
 = 
  
 grafeasClient 
 . 
 updateNoteCallable 
 (). 
 futureCall 
 ( 
 request 
 ); 
  
 // Do something. 
  
 Note 
  
 response 
  
 = 
  
 future 
 . 
 get 
 (); 
  
 } 
  
 
Returns
Type Description
UnaryCallable < UpdateNoteRequest , Note >

updateOccurrence(OccurrenceName name, Occurrence occurrence, FieldMask updateMask)

  public 
  
 final 
  
 Occurrence 
  
 updateOccurrence 
 ( 
 OccurrenceName 
  
 name 
 , 
  
 Occurrence 
  
 occurrence 
 , 
  
 FieldMask 
  
 updateMask 
 ) 
 

Updates the specified occurrence.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 OccurrenceName 
  
 name 
  
 = 
  
 OccurrenceName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[OCCURRENCE]" 
 ); 
  
 Occurrence 
  
 occurrence 
  
 = 
  
 Occurrence 
 . 
 newBuilder 
 (). 
 build 
 (); 
  
 FieldMask 
  
 updateMask 
  
 = 
  
 FieldMask 
 . 
 newBuilder 
 (). 
 build 
 (); 
  
 Occurrence 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 updateOccurrence 
 ( 
 name 
 , 
  
 occurrence 
 , 
  
 updateMask 
 ); 
  
 } 
  
 
Parameters
Name Description
name OccurrenceName

The name of the occurrence in the form of projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] .

occurrence Occurrence

The updated occurrence.

updateMask FieldMask

The fields to update.

Returns
Type Description
Occurrence

updateOccurrence(UpdateOccurrenceRequest request)

  public 
  
 final 
  
 Occurrence 
  
 updateOccurrence 
 ( 
 UpdateOccurrenceRequest 
  
 request 
 ) 
 

Updates the specified occurrence.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 UpdateOccurrenceRequest 
  
 request 
  
 = 
  
 UpdateOccurrenceRequest 
 . 
 newBuilder 
 () 
  
 . 
 setName 
 ( 
 OccurrenceName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[OCCURRENCE]" 
 ). 
 toString 
 ()) 
  
 . 
 setOccurrence 
 ( 
 Occurrence 
 . 
 newBuilder 
 (). 
 build 
 ()) 
  
 . 
 setUpdateMask 
 ( 
 FieldMask 
 . 
 newBuilder 
 (). 
 build 
 ()) 
  
 . 
 build 
 (); 
  
 Occurrence 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 updateOccurrence 
 ( 
 request 
 ); 
  
 } 
  
 
Parameter
Name Description
request UpdateOccurrenceRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Occurrence

updateOccurrence(String name, Occurrence occurrence, FieldMask updateMask)

  public 
  
 final 
  
 Occurrence 
  
 updateOccurrence 
 ( 
 String 
  
 name 
 , 
  
 Occurrence 
  
 occurrence 
 , 
  
 FieldMask 
  
 updateMask 
 ) 
 

Updates the specified occurrence.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 String 
  
 name 
  
 = 
  
 OccurrenceName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[OCCURRENCE]" 
 ). 
 toString 
 (); 
  
 Occurrence 
  
 occurrence 
  
 = 
  
 Occurrence 
 . 
 newBuilder 
 (). 
 build 
 (); 
  
 FieldMask 
  
 updateMask 
  
 = 
  
 FieldMask 
 . 
 newBuilder 
 (). 
 build 
 (); 
  
 Occurrence 
  
 response 
  
 = 
  
 grafeasClient 
 . 
 updateOccurrence 
 ( 
 name 
 , 
  
 occurrence 
 , 
  
 updateMask 
 ); 
  
 } 
  
 
Parameters
Name Description
name String

The name of the occurrence in the form of projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] .

occurrence Occurrence

The updated occurrence.

updateMask FieldMask

The fields to update.

Returns
Type Description
Occurrence

updateOccurrenceCallable()

  public 
  
 final 
  
 UnaryCallable<UpdateOccurrenceRequest 
 , 
 Occurrence 
>  
 updateOccurrenceCallable 
 () 
 

Updates the specified occurrence.

Sample code:

   
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in 
  
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 
  
 try 
  
 ( 
 GrafeasClient 
  
 grafeasClient 
  
 = 
  
 GrafeasClient 
 . 
 create 
 ()) 
  
 { 
  
 UpdateOccurrenceRequest 
  
 request 
  
 = 
  
 UpdateOccurrenceRequest 
 . 
 newBuilder 
 () 
  
 . 
 setName 
 ( 
 OccurrenceName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[OCCURRENCE]" 
 ). 
 toString 
 ()) 
  
 . 
 setOccurrence 
 ( 
 Occurrence 
 . 
 newBuilder 
 (). 
 build 
 ()) 
  
 . 
 setUpdateMask 
 ( 
 FieldMask 
 . 
 newBuilder 
 (). 
 build 
 ()) 
  
 . 
 build 
 (); 
  
 ApiFuture<Occurrence> 
  
 future 
  
 = 
  
 grafeasClient 
 . 
 updateOccurrenceCallable 
 (). 
 futureCall 
 ( 
 request 
 ); 
  
 // Do something. 
  
 Occurrence 
  
 response 
  
 = 
  
 future 
 . 
 get 
 (); 
  
 } 
  
 
Returns
Type Description
UnaryCallable < UpdateOccurrenceRequest , Occurrence >
Create a Mobile Website
View Site in Mobile | Classic
Share by: