Skip to content

Commit 3bcb571

Browse files
committed
style(dataconverter): apply java formatting
Signed-off-by: “Kevin” <kevlar_ksb@yahoo.com>
1 parent 2bccda4 commit 3bcb571

5 files changed

Lines changed: 38 additions & 29 deletions

File tree

src/main/java/com/uber/cadence/samples/dataconverter/CompressedDataConverterWorkflow.java

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
* input, output, and activity parameter by {@link CompressedJsonDataConverter}, which is wired in
3434
* at the worker by {@link DataConverterWorker}.
3535
*
36-
* <p>The workflow takes no inputs and builds its own large payload internally so it can be
37-
* started from the Cadence CLI without bundling a custom converter into the caller.
36+
* <p>The workflow takes no inputs and builds its own large payload internally so it can be started
37+
* from the Cadence CLI without bundling a custom converter into the caller.
3838
*/
3939
public final class CompressedDataConverterWorkflow {
4040

@@ -44,8 +44,8 @@ private CompressedDataConverterWorkflow() {}
4444

4545
/**
4646
* A complex data structure with nested objects and arrays designed to demonstrate compression
47-
* benefits. Fields are public + have no-arg constructors so the JSON data converter can
48-
* serialize and deserialize them.
47+
* benefits. Fields are public + have no-arg constructors so the JSON data converter can serialize
48+
* and deserialize them.
4949
*/
5050
public static final class LargePayload {
5151
public String id;
@@ -149,9 +149,10 @@ public static LargePayload createLargePayload() {
149149
LargePayload p = new LargePayload();
150150
p.id = "large_payload_001";
151151
p.name = "Comprehensive Product Catalog";
152-
p.description = repeat(
153-
"This is a comprehensive product catalog containing thousands of items with detailed descriptions, specifications, and user reviews. Each item includes pricing information, inventory status, and customer feedback. The catalog is designed to provide complete information for customers making purchasing decisions. ",
154-
50);
152+
p.description =
153+
repeat(
154+
"This is a comprehensive product catalog containing thousands of items with detailed descriptions, specifications, and user reviews. Each item includes pricing information, inventory status, and customer feedback. The catalog is designed to provide complete information for customers making purchasing decisions. ",
155+
50);
155156

156157
p.metadata = new LinkedHashMap<>();
157158
for (int i = 0; i < 30; i++) {
@@ -167,9 +168,10 @@ public static LargePayload createLargePayload() {
167168
Item it = new Item();
168169
it.itemId = "item_" + i;
169170
it.title = "High-Quality Product " + i + " with Advanced Features";
170-
it.description = repeat(
171-
"This is a premium product with exceptional quality and advanced features designed for professional use. It includes comprehensive documentation and support. ",
172-
10);
171+
it.description =
172+
repeat(
173+
"This is a premium product with exceptional quality and advanced features designed for professional use. It includes comprehensive documentation and support. ",
174+
10);
173175
it.price = 100.0 + i * 10 + (i % 100) / 100.0;
174176
it.categories = new ArrayList<>();
175177
it.categories.add("Electronics");
@@ -192,9 +194,10 @@ public static LargePayload createLargePayload() {
192194
r.reviewId = "review_" + i + "_" + j;
193195
r.userId = "user_" + j;
194196
r.rating = 1 + (j % 5);
195-
r.comment = repeat(
196-
"This is a detailed customer review with comprehensive feedback about the product quality, delivery experience, and overall satisfaction. The customer provides specific details about their experience. ",
197-
3);
197+
r.comment =
198+
repeat(
199+
"This is a detailed customer review with comprehensive feedback about the product quality, delivery experience, and overall satisfaction. The customer provides specific details about their experience. ",
200+
3);
198201
r.helpfulVotes = j * 2;
199202
r.notHelpfulVotes = j;
200203
r.date = "2024-01-15T10:30:00Z";
@@ -290,9 +293,10 @@ private static String repeat(String s, int n) {
290293
public interface WorkflowIface {
291294

292295
@WorkflowMethod(
293-
name = DataConverterConstants.COMPRESSION_WORKFLOW_TYPE,
294-
executionStartToCloseTimeoutSeconds = 60,
295-
taskList = DataConverterConstants.TASK_LIST_COMPRESSION)
296+
name = DataConverterConstants.COMPRESSION_WORKFLOW_TYPE,
297+
executionStartToCloseTimeoutSeconds = 60,
298+
taskList = DataConverterConstants.TASK_LIST_COMPRESSION
299+
)
296300
LargePayload run();
297301
}
298302

src/main/java/com/uber/cadence/samples/dataconverter/DataConverterSupport.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ static boolean printHintIfDomainMissing(Throwable t) {
6969
" ./gradlew -q execute -PmainClass=com.uber.cadence.samples.common.RegisterDomain");
7070
System.err.println();
7171
System.err.println("Or with Cadence CLI:");
72-
System.err.println(" cadence --domain " + DataConverterConstants.DOMAIN + " domain register");
72+
System.err.println(
73+
" cadence --domain " + DataConverterConstants.DOMAIN + " domain register");
7374
System.err.println();
7475
return true;
7576
}

src/main/java/com/uber/cadence/samples/dataconverter/EncryptionKeyLoader.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
*
2525
* <p>Reads the key from the {@code CADENCE_ENCRYPTION_KEY} environment variable as 64 hex
2626
* characters (32 bytes). If the env var is unset, falls back to a hardcoded demo key with a
27-
* warning. If the env var is set but invalid, throws — silently falling back to the public demo
28-
* key when the user clearly intended their own key would be a security hole.
27+
* warning. If the env var is set but invalid, throws — silently falling back to the public demo key
28+
* when the user clearly intended their own key would be a security hole.
2929
*/
3030
public final class EncryptionKeyLoader {
3131

@@ -51,7 +51,8 @@ public static byte[] loadEncryptionKey() {
5151
try {
5252
key = hexDecode(hexKey);
5353
} catch (IllegalArgumentException e) {
54-
throw new IllegalStateException("CADENCE_ENCRYPTION_KEY is not valid hex: " + e.getMessage(), e);
54+
throw new IllegalStateException(
55+
"CADENCE_ENCRYPTION_KEY is not valid hex: " + e.getMessage(), e);
5556
}
5657
if (key.length != 32) {
5758
throw new IllegalStateException(

src/main/java/com/uber/cadence/samples/dataconverter/S3OffloadDataConverterWorkflow.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
import java.util.Map;
2929

3030
/**
31-
* Demonstrates the claim-check pattern: payloads larger than the configured threshold are stored
32-
* in an external {@link BlobStore} and only a small reference travels through Cadence history.
31+
* Demonstrates the claim-check pattern: payloads larger than the configured threshold are stored in
32+
* an external {@link BlobStore} and only a small reference travels through Cadence history.
3333
*
3434
* <p>The workflow takes no inputs and builds a payload well above the threshold internally so it
3535
* can be started from the Cadence CLI and every run exercises the offload path.
@@ -66,8 +66,10 @@ public S3DataPoint() {}
6666
public static S3LargePayload createS3LargePayload() {
6767
S3LargePayload p = new S3LargePayload();
6868
p.jobId = "batch-job-20240115-001";
69-
p.description = repeat(
70-
"Large telemetry batch job containing sensor readings from the production cluster. ", 10);
69+
p.description =
70+
repeat(
71+
"Large telemetry batch job containing sensor readings from the production cluster. ",
72+
10);
7173

7274
p.dataPoints = new ArrayList<>(200);
7375
for (int i = 0; i < 200; i++) {
@@ -100,9 +102,10 @@ private static String repeat(String s, int n) {
100102
public interface WorkflowIface {
101103

102104
@WorkflowMethod(
103-
name = DataConverterConstants.S3_OFFLOAD_WORKFLOW_TYPE,
104-
executionStartToCloseTimeoutSeconds = 60,
105-
taskList = DataConverterConstants.TASK_LIST_S3)
105+
name = DataConverterConstants.S3_OFFLOAD_WORKFLOW_TYPE,
106+
executionStartToCloseTimeoutSeconds = 60,
107+
taskList = DataConverterConstants.TASK_LIST_S3
108+
)
106109
S3LargePayload run();
107110
}
108111

src/main/java/com/uber/cadence/samples/dataconverter/S3OffloadStarter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
* Starts {@link S3OffloadDataConverterWorkflow} (async, fire-and-forget).
2727
*
2828
* <p>The workflow takes no inputs and generates its own payload, so this starter does not need to
29-
* use the matching {@link S3OffloadDataConverter}. The same effect can be achieved from the
30-
* Cadence CLI via:
29+
* use the matching {@link S3OffloadDataConverter}. The same effect can be achieved from the Cadence
30+
* CLI via:
3131
*
3232
* <pre>
3333
* cadence --domain samples-domain \

0 commit comments

Comments
 (0)