Minor renaming and refactoring
This commit is contained in:
parent
2d146c2416
commit
0fa24abc24
@ -93,8 +93,8 @@ public final class PluginProcessingContext implements PluginContext {
|
||||
@Override
|
||||
public void saveAttributes(final TenantId tenantId, final EntityId entityId, final String scope, final List<AttributeKvEntry> attributes, final PluginCallback<Void> callback) {
|
||||
validate(entityId, new ValidationCallback(callback, ctx -> {
|
||||
ListenableFuture<List<Void>> attrKvListFuture = pluginCtx.attributesService.save(entityId, scope, attributes);
|
||||
Futures.addCallback(attrKvListFuture, getListCallback(callback, v -> {
|
||||
ListenableFuture<List<Void>> futures = pluginCtx.attributesService.save(entityId, scope, attributes);
|
||||
Futures.addCallback(futures, getListCallback(callback, v -> {
|
||||
if (entityId.getEntityType() == EntityType.DEVICE) {
|
||||
onDeviceAttributesChanged(tenantId, new DeviceId(entityId.getId()), scope, attributes);
|
||||
}
|
||||
@ -106,8 +106,8 @@ public final class PluginProcessingContext implements PluginContext {
|
||||
@Override
|
||||
public void removeAttributes(final TenantId tenantId, final EntityId entityId, final String scope, final List<String> keys, final PluginCallback<Void> callback) {
|
||||
validate(entityId, new ValidationCallback(callback, ctx -> {
|
||||
ListenableFuture<List<Void>> future = pluginCtx.attributesService.removeAll(entityId, scope, keys);
|
||||
Futures.addCallback(future, getCallback(callback, v -> null), executor);
|
||||
ListenableFuture<List<Void>> futures = pluginCtx.attributesService.removeAll(entityId, scope, keys);
|
||||
Futures.addCallback(futures, getCallback(callback, v -> null), executor);
|
||||
if (entityId.getEntityType() == EntityType.DEVICE) {
|
||||
onDeviceAttributesDeleted(tenantId, new DeviceId(entityId.getId()), keys.stream().map(key -> new AttributeKey(scope, key)).collect(Collectors.toSet()));
|
||||
}
|
||||
|
||||
@ -125,11 +125,7 @@ public class CassandraBaseAttributesDao extends CassandraAbstractAsyncDao implem
|
||||
stmt.setToNull(8);
|
||||
}
|
||||
log.trace("Generated save stmt [{}] for entityId {} and attributeType {} and attribute", stmt, entityId, attributeType, attribute);
|
||||
return getFuture(executeAsyncWrite(stmt), rs -> getAttributeKvEntryFromRs(rs));
|
||||
}
|
||||
|
||||
private Void getAttributeKvEntryFromRs(ResultSet rs) {
|
||||
return null;
|
||||
return getFuture(executeAsyncWrite(stmt), rs -> null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -148,7 +144,7 @@ public class CassandraBaseAttributesDao extends CassandraAbstractAsyncDao implem
|
||||
.and(eq(ATTRIBUTE_TYPE_COLUMN, attributeType))
|
||||
.and(eq(ATTRIBUTE_KEY_COLUMN, key));
|
||||
log.debug("Remove request: {}", delete.toString());
|
||||
return getFuture(getSession().executeAsync(delete), rs -> getAttributeKvEntryFromRs(rs));
|
||||
return getFuture(getSession().executeAsync(delete), rs -> null);
|
||||
}
|
||||
|
||||
private PreparedStatement getSaveStmt() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user