Skip to content

Commit

Permalink
Small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
NavidMitchell committed Jan 7, 2025
1 parent d6a1f1f commit 087067b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public DelegatingUpsertPreProcessor(StructuresProperties structuresProperties,
structure,
fieldPreProcessors);
mapUpsertPreProcessor = new MapUpsertPreProcessor(structure,
structuresProperties,
fieldPreProcessors);
pojoUpsertPreProcessor = new PojoUpsertPreProcessor();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public MapUpsertPreProcessor(Structure structure,
// FIXME: validate structure Object definition on save to ensure an ID field is present and not on a nested field
if(idFieldPreProcessor == null) {
log.warn("No id field preprocessor found for structure: {}", structure);
}else if(idFieldPreProcessor.getLeft().contains(".")){ // ids are not allowed to be nested
log.warn("Id field preprocessor found for structure: {} but it is nested: {}", structure, idFieldPreProcessor.getLeft());
}
}

Expand All @@ -57,7 +59,6 @@ public MapUpsertPreProcessor(Structure structure,
public CompletableFuture<EntityHolder> process(Map<Object, Object> entity,
EntityContext context) {
try {
// ids are not allowed to be nested
// FIXME: once the FIXME in the constructor is resolved, this check should be unnecessary
// We do this here since there is no way to return an error to the user from the constructor
if(idFieldPreProcessor != null && !idFieldPreProcessor.getLeft().contains(".")){
Expand All @@ -75,7 +76,6 @@ public CompletableFuture<EntityHolder> process(Map<Object, Object> entity,
public CompletableFuture<List<EntityHolder>> processArray(List<Map<Object, Object>> entities,
EntityContext context) {
try {
// ids are not allowed to be nested
// FIXME: once the FIXME in the constructor is resolved, this check should be unnecessary
// We do this here since there is no way to return an error to the user from the constructor
if(idFieldPreProcessor != null && !idFieldPreProcessor.getLeft().contains(".")){
Expand Down Expand Up @@ -122,7 +122,6 @@ private EntityHolder preProcessData(Map<Object, Object> entity, EntityContext co
}
}

// if this is the id we add the special _id field for elasticsearch to use
return new EntityHolder(id,
context.getParticipant().getTenantId(),
structure.getMultiTenancyType(),
Expand Down

0 comments on commit 087067b

Please sign in to comment.