Skip to content

Commit

Permalink
FIX jexl context addition logic
Browse files Browse the repository at this point in the history
  • Loading branch information
fgalan committed Jul 3, 2024
1 parent 0fe0be5 commit 50221f6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/lib/ngsiNotify/Notifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,14 @@ static bool setNgsiPayload
for (unsigned int ix = 0; ix < orderedNgsiAttrs.size(); ix++)
{
cer.entity.attributeVector.push_back(new ContextAttribute(orderedNgsiAttrs[ix], false, true));
TIME_EXPR_CTXBLD_START();
exprContextObjectP->add(orderedNgsiAttrs[ix]->name, orderedNgsiAttrs[ix]->toJsonValue(exprContextObjectP), true);
TIME_EXPR_CTXBLD_STOP();

// Avoid to add context if an attribute with the same name exists in the entity
if (cer.entity.attributeVector.get(orderedNgsiAttrs[ix]->name) < 0)
{
TIME_EXPR_CTXBLD_START();
exprContextObjectP->add(orderedNgsiAttrs[ix]->name, orderedNgsiAttrs[ix]->toJsonValue(exprContextObjectP), true);
TIME_EXPR_CTXBLD_STOP();
}
}
// Next, other attributes in the original entity not already added
for (unsigned int ix = 0; ix < en.attributeVector.size(); ix++)
Expand Down

0 comments on commit 50221f6

Please sign in to comment.