Skip to content

Commit 21febd9

Browse files
authored
Create ProcessResult.java
Result object for async product processing.
1 parent 80a07a3 commit 21febd9

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

  • code/chapter04/catalog/src/main/java/io/microprofile/tutorial/store/product/entity
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
package io.microprofile.tutorial.store.product.entity;
2+
3+
import org.eclipse.microprofile.openapi.annotations.media.Schema;
4+
5+
/**
6+
* Result object for async product processing.
7+
*/
8+
@Schema(description = "Result of async product processing")
9+
public class ProcessResult {
10+
11+
@Schema(description = "ID of the processed product", example = "123")
12+
private Long productId;
13+
14+
@Schema(description = "Processing status",
15+
example = "COMPLETED",
16+
enumeration = {"COMPLETED", "FAILED", "PENDING"})
17+
private String status;
18+
19+
@Schema(description = "Processing message or error details",
20+
example = "Product processed successfully")
21+
private String message;
22+
23+
@Schema(description = "Timestamp when processing completed",
24+
example = "2025-01-31T16:00:00Z")
25+
private String timestamp;
26+
27+
public ProcessResult() {
28+
}
29+
30+
public ProcessResult(Long productId, String status, String message) {
31+
this.productId = productId;
32+
this.status = status;
33+
this.message = message;
34+
this.timestamp = java.time.Instant.now().toString();
35+
}
36+
37+
public Long getProductId() {
38+
return productId;
39+
}
40+
41+
public void setProductId(Long productId) {
42+
this.productId = productId;
43+
}
44+
45+
public String getStatus() {
46+
return status;
47+
}
48+
49+
public void setStatus(String status) {
50+
this.status = status;
51+
}
52+
53+
public String getMessage() {
54+
return message;
55+
}
56+
57+
public void setMessage(String message) {
58+
this.message = message;
59+
}
60+
61+
public String getTimestamp() {
62+
return timestamp;
63+
}
64+
65+
public void setTimestamp(String timestamp) {
66+
this.timestamp = timestamp;
67+
}
68+
}

0 commit comments

Comments
 (0)