|
1 | 1 | /* |
2 | | - * Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | + * Copyright 2010-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"). |
5 | 5 | * You may not use this file except in compliance with the License. |
@@ -440,6 +440,125 @@ public AnalyzeDocumentResult call() throws Exception { |
440 | 440 | }); |
441 | 441 | } |
442 | 442 |
|
| 443 | + /** |
| 444 | + * <p> |
| 445 | + * Analyzes an input document for financially related relationships between |
| 446 | + * text. |
| 447 | + * </p> |
| 448 | + * <p> |
| 449 | + * Information is returned as <code>ExpenseDocuments</code> and seperated as |
| 450 | + * follows. |
| 451 | + * </p> |
| 452 | + * <ul> |
| 453 | + * <li> |
| 454 | + * <p> |
| 455 | + * <code>LineItemGroups</code>- A data set containing <code>LineItems</code> |
| 456 | + * which store information about the lines of text, such as an item |
| 457 | + * purchased and its price on a receipt. |
| 458 | + * </p> |
| 459 | + * </li> |
| 460 | + * <li> |
| 461 | + * <p> |
| 462 | + * <code>SummaryFields</code>- Contains all other information a receipt, |
| 463 | + * such as header information or the vendors name. |
| 464 | + * </p> |
| 465 | + * </li> |
| 466 | + * </ul> |
| 467 | + * |
| 468 | + * @param analyzeExpenseRequest |
| 469 | + * @return A Java Future object containing the response from the |
| 470 | + * AnalyzeExpense service method, as returned by Amazon Textract. |
| 471 | + * @throws InvalidParameterException |
| 472 | + * @throws InvalidS3ObjectException |
| 473 | + * @throws UnsupportedDocumentException |
| 474 | + * @throws DocumentTooLargeException |
| 475 | + * @throws BadDocumentException |
| 476 | + * @throws AccessDeniedException |
| 477 | + * @throws ProvisionedThroughputExceededException |
| 478 | + * @throws InternalServerErrorException |
| 479 | + * @throws ThrottlingException |
| 480 | + * @throws AmazonClientException If any internal errors are encountered |
| 481 | + * inside the client while attempting to make the request or |
| 482 | + * handle the response. For example if a network connection is |
| 483 | + * not available. |
| 484 | + * @throws AmazonServiceException If an error response is returned by Amazon |
| 485 | + * Textract indicating either a problem with the data in the |
| 486 | + * request, or a server side issue. |
| 487 | + */ |
| 488 | + public Future<AnalyzeExpenseResult> analyzeExpenseAsync( |
| 489 | + final AnalyzeExpenseRequest analyzeExpenseRequest) throws AmazonServiceException, |
| 490 | + AmazonClientException { |
| 491 | + return executorService.submit(new Callable<AnalyzeExpenseResult>() { |
| 492 | + public AnalyzeExpenseResult call() throws Exception { |
| 493 | + return analyzeExpense(analyzeExpenseRequest); |
| 494 | + } |
| 495 | + }); |
| 496 | + } |
| 497 | + |
| 498 | + /** |
| 499 | + * <p> |
| 500 | + * Analyzes an input document for financially related relationships between |
| 501 | + * text. |
| 502 | + * </p> |
| 503 | + * <p> |
| 504 | + * Information is returned as <code>ExpenseDocuments</code> and seperated as |
| 505 | + * follows. |
| 506 | + * </p> |
| 507 | + * <ul> |
| 508 | + * <li> |
| 509 | + * <p> |
| 510 | + * <code>LineItemGroups</code>- A data set containing <code>LineItems</code> |
| 511 | + * which store information about the lines of text, such as an item |
| 512 | + * purchased and its price on a receipt. |
| 513 | + * </p> |
| 514 | + * </li> |
| 515 | + * <li> |
| 516 | + * <p> |
| 517 | + * <code>SummaryFields</code>- Contains all other information a receipt, |
| 518 | + * such as header information or the vendors name. |
| 519 | + * </p> |
| 520 | + * </li> |
| 521 | + * </ul> |
| 522 | + * |
| 523 | + * @param analyzeExpenseRequest |
| 524 | + * @return A Java Future object containing the response from the |
| 525 | + * AnalyzeExpense service method, as returned by Amazon Textract. |
| 526 | + * @throws InvalidParameterException |
| 527 | + * @throws InvalidS3ObjectException |
| 528 | + * @throws UnsupportedDocumentException |
| 529 | + * @throws DocumentTooLargeException |
| 530 | + * @throws BadDocumentException |
| 531 | + * @throws AccessDeniedException |
| 532 | + * @throws ProvisionedThroughputExceededException |
| 533 | + * @throws InternalServerErrorException |
| 534 | + * @throws ThrottlingException |
| 535 | + * @throws AmazonClientException If any internal errors are encountered |
| 536 | + * inside the client while attempting to make the request or |
| 537 | + * handle the response. For example if a network connection is |
| 538 | + * not available. |
| 539 | + * @throws AmazonServiceException If an error response is returned by Amazon |
| 540 | + * Textract indicating either a problem with the data in the |
| 541 | + * request, or a server side issue. |
| 542 | + */ |
| 543 | + public Future<AnalyzeExpenseResult> analyzeExpenseAsync( |
| 544 | + final AnalyzeExpenseRequest analyzeExpenseRequest, |
| 545 | + final AsyncHandler<AnalyzeExpenseRequest, AnalyzeExpenseResult> asyncHandler) |
| 546 | + throws AmazonServiceException, AmazonClientException { |
| 547 | + return executorService.submit(new Callable<AnalyzeExpenseResult>() { |
| 548 | + public AnalyzeExpenseResult call() throws Exception { |
| 549 | + AnalyzeExpenseResult result = null; |
| 550 | + try { |
| 551 | + result = analyzeExpense(analyzeExpenseRequest); |
| 552 | + } catch (Exception ex) { |
| 553 | + asyncHandler.onError(ex); |
| 554 | + throw ex; |
| 555 | + } |
| 556 | + asyncHandler.onSuccess(analyzeExpenseRequest, result); |
| 557 | + return result; |
| 558 | + } |
| 559 | + }); |
| 560 | + } |
| 561 | + |
443 | 562 | /** |
444 | 563 | * <p> |
445 | 564 | * Detects text in the input document. Amazon Textract can detect lines of |
@@ -643,6 +762,7 @@ public DetectDocumentTextResult call() throws Exception { |
643 | 762 | * @throws InternalServerErrorException |
644 | 763 | * @throws ThrottlingException |
645 | 764 | * @throws InvalidS3ObjectException |
| 765 | + * @throws InvalidKMSKeyException |
646 | 766 | * @throws AmazonClientException If any internal errors are encountered |
647 | 767 | * inside the client while attempting to make the request or |
648 | 768 | * handle the response. For example if a network connection is |
@@ -743,6 +863,7 @@ public GetDocumentAnalysisResult call() throws Exception { |
743 | 863 | * @throws InternalServerErrorException |
744 | 864 | * @throws ThrottlingException |
745 | 865 | * @throws InvalidS3ObjectException |
| 866 | + * @throws InvalidKMSKeyException |
746 | 867 | * @throws AmazonClientException If any internal errors are encountered |
747 | 868 | * inside the client while attempting to make the request or |
748 | 869 | * handle the response. For example if a network connection is |
@@ -828,6 +949,7 @@ public GetDocumentAnalysisResult call() throws Exception { |
828 | 949 | * @throws InternalServerErrorException |
829 | 950 | * @throws ThrottlingException |
830 | 951 | * @throws InvalidS3ObjectException |
| 952 | + * @throws InvalidKMSKeyException |
831 | 953 | * @throws AmazonClientException If any internal errors are encountered |
832 | 954 | * inside the client while attempting to make the request or |
833 | 955 | * handle the response. For example if a network connection is |
@@ -904,6 +1026,7 @@ public GetDocumentTextDetectionResult call() throws Exception { |
904 | 1026 | * @throws InternalServerErrorException |
905 | 1027 | * @throws ThrottlingException |
906 | 1028 | * @throws InvalidS3ObjectException |
| 1029 | + * @throws InvalidKMSKeyException |
907 | 1030 | * @throws AmazonClientException If any internal errors are encountered |
908 | 1031 | * inside the client while attempting to make the request or |
909 | 1032 | * handle the response. For example if a network connection is |
|
0 commit comments