-
Notifications
You must be signed in to change notification settings - Fork 840
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed EnhancedClient UpdateItem operation to make it work on nested a…
…ttributes as well (#5593) * Fixed EnhancedClient UpdateItem operation to make it work on nested attributes as well * Add Tests for multi-level nesting updates to work correctly * Fixed PR feedback * Updated Javadocs * Addressed Pr feedback * Removed indendation changes * Added tests for FlattenedMapper * fixed indendation * Fix indendation and remove unintentional changes * Configured MappingConfiguration object * Added methods to AttributeMapping interface * Fixed unintentional indendation changes * Fixed unintentional indendation changes * Add changelogs * Introduce a new method to transform input to be able to perform update operations on nested DynamoDB object attributes. * Remove unwanted changes * Indent * Remove unwanted changes * Added testing * Added test to validate updating string to null * Remove unintentional indentation changes * Fix checkstyle * Update test case to add empty nested attribute * Added a test to verify that updates to non-scalar nested attributes with ignoreNulls set to true, throws DDBException * Uncomment test assertions * Ensure correct workings of updating to an emoty map * Fixed checkstyle * Addressed pr feedback * Created modes of update operation and deprecated existing ignoreNulls configuration * Added more comments around deprecation * Grouped validation methods * Added more documentation to define the modes of update operations * Removed MAPS_ONLY mode and added more documentation * Added unit test * Improved documentation to establish tradeoffs between update modes * Modified error code in documentation * Updated Documentation around update modes
- Loading branch information
1 parent
db81c49
commit 7ae6ed3
Showing
12 changed files
with
723 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"type": "bugfix", | ||
"category": "AWS SDK for Java v2", | ||
"contributor": "anirudh9391", | ||
"description": "Introduce a new method to transform input to be able to perform update operations on nested DynamoDB object attributes." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...nhanced/src/main/java/software/amazon/awssdk/enhanced/dynamodb/model/IgnoreNullsMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
package software.amazon.awssdk.enhanced.dynamodb.model; | ||
|
||
import software.amazon.awssdk.annotations.SdkPublicApi; | ||
|
||
/** | ||
* <p> | ||
* The SCALAR_ONLY mode supports updates to scalar attributes to any level (top level, first nested level, second nested level, | ||
* etc.) when the user wants to update scalar attributes by providing only the delta of changes to be updated. This mode | ||
* does not support updates to maps and is expected to throw a 4xx DynamoDB exception if done so. | ||
* <p> | ||
* In the MAPS_ONLY mode, creation of new map/bean structures through update statements are supported, i.e. setting | ||
* null/non-existent maps to non-null values. If users try to update scalar attributes in this mode, it will overwrite | ||
* existing values in the table. | ||
* <p> | ||
* The DEFAULT mode disables any special handling around null values in the update query expression | ||
*/ | ||
@SdkPublicApi | ||
public enum IgnoreNullsMode { | ||
SCALAR_ONLY, | ||
MAPS_ONLY, | ||
DEFAULT | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.