|
|
@ -50,14 +50,12 @@ public class TbMsgDeleteAttributes implements TbNode { |
|
|
private TbMsgDeleteAttributesConfiguration config; |
|
|
private TbMsgDeleteAttributesConfiguration config; |
|
|
private String scope; |
|
|
private String scope; |
|
|
private List<String> keys; |
|
|
private List<String> keys; |
|
|
private boolean sendAttributesDeletedNotification; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void init(TbContext ctx, TbNodeConfiguration configuration) throws TbNodeException { |
|
|
public void init(TbContext ctx, TbNodeConfiguration configuration) throws TbNodeException { |
|
|
this.config = TbNodeUtils.convert(configuration, TbMsgDeleteAttributesConfiguration.class); |
|
|
this.config = TbNodeUtils.convert(configuration, TbMsgDeleteAttributesConfiguration.class); |
|
|
this.scope = config.getScope(); |
|
|
this.scope = config.getScope(); |
|
|
this.keys = config.getKeys(); |
|
|
this.keys = config.getKeys(); |
|
|
this.sendAttributesDeletedNotification = config.isSendAttributesDeletedNotification(); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@ -70,11 +68,15 @@ public class TbMsgDeleteAttributes implements TbNode { |
|
|
if (keysToDelete.isEmpty()) { |
|
|
if (keysToDelete.isEmpty()) { |
|
|
ctx.tellSuccess(msg); |
|
|
ctx.tellSuccess(msg); |
|
|
} else { |
|
|
} else { |
|
|
FutureCallback<Void> callback = new TelemetryNodeCallback(ctx, msg); |
|
|
ctx.getTelemetryService().deleteAndNotify( |
|
|
if (sendAttributesDeletedNotification) { |
|
|
ctx.getTenantId(), |
|
|
callback = new AttributesDeleteNodeCallback(ctx, msg, scope, keysToDelete); |
|
|
msg.getOriginator(), |
|
|
} |
|
|
scope, |
|
|
ctx.getTelemetryService().deleteAndNotify(ctx.getTenantId(), msg.getOriginator(), scope, keysToDelete, callback); |
|
|
keysToDelete, |
|
|
|
|
|
config.isSendAttributesDeletedNotification() ? |
|
|
|
|
|
new AttributesDeleteNodeCallback(ctx, msg, scope, keysToDelete) : |
|
|
|
|
|
new TelemetryNodeCallback(ctx, msg) |
|
|
|
|
|
); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|