Skip to content

Commit a4ba247

Browse files
committed
digital double logic
1 parent 02d41e6 commit a4ba247

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

java-ai/src/main/java/oracleai/services/ORDSCalls.java

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,24 +204,43 @@ public static void insertDigitalDoubleData(MultipartFile image, MultipartFile vi
204204
System.out.println("ORDSCalls.insertDigitalDoubleData insert complete");
205205
}
206206

207+
207208
public static @Nullable String getDigitalDoubleData(String email) throws JsonProcessingException {
208-
System.out.println("DigitalDoubles.downloaddigitaldouble lookup email:" + email);
209-
String url = AIApplication.ORDS_OMLOPSENDPOINT_URL + "modelurls/geturls/" + email;
209+
System.out.println("DigitalDoubles.downloaddigitaldouble lookup email: " + email);
210+
211+
// Use POST instead of GET
212+
String url = AIApplication.ORDS_OMLOPSENDPOINT_URL + "modelurls/geturls";
213+
214+
// Prepare headers
210215
HttpHeaders headers = new HttpHeaders();
211216
headers.setContentType(MediaType.APPLICATION_JSON);
212-
HttpEntity<String> entity = new HttpEntity<>(headers);
217+
218+
// Prepare the request body (email passed in the request body)
219+
Map<String, String> requestBody = new HashMap<>();
220+
requestBody.put("p_participant_email", email);
221+
222+
// Wrap the request body and headers into an HttpEntity
223+
HttpEntity<Map<String, String>> entity = new HttpEntity<>(requestBody, headers);
224+
225+
// Execute the POST request using RestTemplate
213226
ResponseEntity<String> response = new RestTemplate().exchange(url, HttpMethod.POST, entity, String.class);
227+
228+
// Parse the JSON response using Jackson ObjectMapper
214229
ObjectMapper objectMapper = new ObjectMapper();
215230
JsonNode rootNode = objectMapper.readTree(response.getBody());
231+
232+
// Extract the fields
216233
String modelGlbUrl = rootNode.path("MODELGLBURL_OUT").asText();
217234
String modelFbxUrl = rootNode.path("MODELFBXURL_OUT").asText();
218235
String modelUsdzUrl = rootNode.path("MODELUSDZURL_OUT").asText();
219236
String thumbnailUrl = rootNode.path("THUMBNAILURL_OUT").asText();
220237

238+
// Print extracted URLs
221239
System.out.println("MODELGLBURL_OUT: " + modelGlbUrl);
222240
System.out.println("MODELFBXURL_OUT: " + modelFbxUrl);
223241
System.out.println("MODELUSDZURL_OUT: " + modelUsdzUrl);
224242
System.out.println("THUMBNAILURL_OUT: " + thumbnailUrl);
243+
225244
return modelFbxUrl;
226245
}
227246
}

0 commit comments

Comments
 (0)