From f92647bb5b54c687c2ba579fe2d51aa57b699a42 Mon Sep 17 00:00:00 2001 From: Ian White Date: Thu, 24 Jan 2019 17:10:54 -0800 Subject: [PATCH] allowing the use of StorageName() to skip storing a field --- .../io/stardog/stardao/dynamodb/mapper/JacksonItemMapper.java | 4 +++- .../stardao/mongodb/mapper/jackson/JacksonDocumentMapper.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/stardao-dynamodb/src/main/java/io/stardog/stardao/dynamodb/mapper/JacksonItemMapper.java b/stardao-dynamodb/src/main/java/io/stardog/stardao/dynamodb/mapper/JacksonItemMapper.java index 79a113d..80dca0c 100644 --- a/stardao-dynamodb/src/main/java/io/stardog/stardao/dynamodb/mapper/JacksonItemMapper.java +++ b/stardao-dynamodb/src/main/java/io/stardog/stardao/dynamodb/mapper/JacksonItemMapper.java @@ -104,7 +104,9 @@ protected Item renameItem(Item item, Map renames) { Item renamedItem = new Item(); for (String key : map.keySet()) { String renamedKey = renames.getOrDefault(key, key); - renamedItem.with(renamedKey, item.get(key)); + if (renamedKey != null && !"".equals(renamedKey)) { + renamedItem.with(renamedKey, item.get(key)); + } } return renamedItem; } diff --git a/stardao-mongodb/src/main/java/io/stardog/stardao/mongodb/mapper/jackson/JacksonDocumentMapper.java b/stardao-mongodb/src/main/java/io/stardog/stardao/mongodb/mapper/jackson/JacksonDocumentMapper.java index 08d32ac..3de7317 100644 --- a/stardao-mongodb/src/main/java/io/stardog/stardao/mongodb/mapper/jackson/JacksonDocumentMapper.java +++ b/stardao-mongodb/src/main/java/io/stardog/stardao/mongodb/mapper/jackson/JacksonDocumentMapper.java @@ -109,7 +109,9 @@ protected Document renameDocument(Document doc, Map renames) { Document renamedDoc = new Document(); for (String key : doc.keySet()) { String renamedKey = renames.getOrDefault(key, key); - renamedDoc.put(renamedKey, doc.get(key)); + if (renamedKey != null && !"".equals(renamedKey)) { + renamedDoc.put(renamedKey, doc.get(key)); + } } return renamedDoc; }