Skip to content

Commit 1f41fe1

Browse files
dfirovagcf-owl-bot[bot]
authored andcommitted
chore(samples): refactoring comments. (#528)
* chore (samples) Refactoring comments. * pr fix: refactored comments. * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 73ec7c7 commit 1f41fe1

File tree

5 files changed

+22
-17
lines changed

5 files changed

+22
-17
lines changed

retail/interactive-tutorials/src/main/java/events/ImportUserEventsBigQuery.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,19 @@
3838
public class ImportUserEventsBigQuery {
3939

4040
public static void main(String[] args) throws IOException, InterruptedException {
41-
// TODO(developer): Replace these variables before running the sample.
41+
// TODO(developer): Set projectId to your Google Cloud Platform project ID.
4242
String projectId = ServiceOptions.getDefaultProjectId();
4343
String defaultCatalog =
4444
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
45-
// TO CHECK ERROR HANDLING PASTE THE INVALID CATALOG NAME HERE:
45+
// To check error handling use invalid catalog name here:
4646
// defaultCatalog = "invalid_catalog_name";
47+
48+
// TODO(developer): Set datasetId to your datasetId
4749
String datasetId = "user_events";
50+
// TODO(developer): Set tableId to your tableId
4851
String tableId = "events";
49-
// TO CHECK ERROR HANDLING USE THE TABLE OF INVALID USER EVENTS:
50-
// tableId = "events_some_invalid";
52+
// To check error handling use table of invalid user events here:
53+
// tableId = "events_some_invalid"
5154

5255
importUserEventsFromBigQuery(projectId, defaultCatalog, datasetId, tableId);
5356
}

retail/interactive-tutorials/src/main/java/events/PurgeUserEvent.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
/*
18-
* Purge user events into a catalog from inline source using Retail API
18+
* Deleting user event using Retail API.
1919
*/
2020

2121
package events;
@@ -36,11 +36,11 @@ public class PurgeUserEvent {
3636

3737
public static void main(String[] args)
3838
throws IOException, ExecutionException, InterruptedException {
39-
// TODO(developer): Replace these variables before running the sample.
39+
// TODO(developer): Set projectId to your Google Cloud Platform project ID.
4040
String projectId = ServiceOptions.getDefaultProjectId();
4141
String defaultCatalog =
4242
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
43-
// visitorId generated randomly.
43+
// visitorId is generated randomly
4444
String visitorId = UUID.randomUUID().toString();
4545

4646
callPurgeUserEvents(defaultCatalog, visitorId);
@@ -57,9 +57,11 @@ public static void callPurgeUserEvents(String defaultCatalog, String visitorId)
5757
try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
5858
PurgeUserEventsRequest purgeUserEventsRequest =
5959
PurgeUserEventsRequest.newBuilder()
60-
// TO CHECK ERROR HANDLING SET INVALID FILTER HERE:
60+
// To check error handling set invalid filter here:
6161
.setFilter(String.format("visitorId=\"%s\"", visitorId))
6262
.setParent(defaultCatalog)
63+
// Setting the force field to true deletes user events. If set to false will return
64+
// number of events to be deleted without actually deleting them
6365
.setForce(true)
6466
.build();
6567
System.out.printf("Purge user events request: %s%n", purgeUserEventsRequest);

retail/interactive-tutorials/src/main/java/events/RejoinUserEvent.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
/*
18-
* Rejoin user events into a catalog from inline source using Retail API
18+
* Starts a user event rejoin operation using Retail API.
1919
*/
2020

2121
package events;
@@ -38,11 +38,11 @@ public class RejoinUserEvent {
3838

3939
public static void main(String[] args)
4040
throws IOException, ExecutionException, InterruptedException {
41-
// TODO(developer): Replace these variables before running the sample.
41+
// TODO(developer): Set projectId to your Google Cloud Platform project ID.
4242
String projectId = ServiceOptions.getDefaultProjectId();
4343
String defaultCatalog =
4444
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
45-
// visitorId generated randomly.
45+
// visitorId is generated randomly
4646
String visitorId = UUID.randomUUID().toString();
4747

4848
callRejoinUserEvents(defaultCatalog, visitorId);

retail/interactive-tutorials/src/main/java/events/WriteUserEvent.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
/*
18-
* Write user events into a catalog from inline source using Retail API
18+
* Write user event using Retail API.
1919
*/
2020

2121
package events;
@@ -36,11 +36,11 @@ public class WriteUserEvent {
3636

3737
public static void main(String[] args)
3838
throws IOException, ExecutionException, InterruptedException {
39-
// TODO(developer): Replace these variables before running the sample.
39+
// TODO(developer): Set projectId to your Google Cloud Platform project ID.
4040
String projectId = ServiceOptions.getDefaultProjectId();
4141
String defaultCatalog =
4242
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
43-
// visitorId generated randomly.
43+
// visitorId is generated randomly
4444
String visitorId = UUID.randomUUID().toString();
4545

4646
writeUserEvent(defaultCatalog, visitorId);

retail/interactive-tutorials/src/main/java/product/CrudProduct.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515
*/
1616

1717
/*
18-
* Create product in a catalog using Retail API
18+
* Create, update, get and delete product in a catalog using Retail API.
1919
*/
2020

2121
package product;
2222

2323
import com.google.api.gax.rpc.NotFoundException;
24-
import com.google.cloud.ServiceOptions;
2524
import com.google.cloud.retail.v2.CreateProductRequest;
2625
import com.google.cloud.retail.v2.DeleteProductRequest;
2726
import com.google.cloud.retail.v2.GetProductRequest;
@@ -37,7 +36,8 @@
3736
public class CrudProduct {
3837

3938
public static void main(String[] args) throws IOException {
40-
String projectId = ServiceOptions.getDefaultProjectId();
39+
// TODO(developer): Set projectId to your Google Cloud Platform project ID.
40+
String projectId = "my-project";
4141
String generatedProductId = UUID.randomUUID().toString();
4242
String branchName =
4343
String.format(

0 commit comments

Comments
 (0)