Skip to content

Commit

Permalink
Merge pull request #1398 from telefonicaid/task/remove_expression_lan…
Browse files Browse the repository at this point in the history
…guage

fully remove expression language field
  • Loading branch information
fgalan authored Jun 30, 2023
2 parents a117e76 + 2fb0a1d commit 6ebbbc6
Show file tree
Hide file tree
Showing 14 changed files with 11 additions and 38 deletions.
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- Remove: expressionLanguage field (as it it not longer needed, due to only one expression language is supported, after the removal of legacy expressions in 3.2.0) (#1384)
- Add: allow update timestamp and other config fields of device
- Fix: use 'options=upsert' when update ngsiv2 CB entities and appendMode is enabled (#956)
- Fix: do not propagate group config (timestamp and explicitAttrs) to autoprovisioned devices (at database level) (#1377)
Expand Down
1 change: 0 additions & 1 deletion lib/model/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ const Device = new Schema({
creationDate: { type: Date, default: Date.now },
internalAttributes: Object,
autoprovision: Boolean,
expressionLanguage: String,
explicitAttrs: Group.ExplicitAttrsType,
ngsiVersion: String
});
Expand Down
1 change: 0 additions & 1 deletion lib/model/Group.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ const Group = new Schema({
attributes: Array,
internalAttributes: Array,
autoprovision: Boolean,
expressionLanguage: String,
explicitAttrs: ExplicitAttrsType,
defaultEntityNameConjunction: String,
ngsiVersion: String,
Expand Down
1 change: 0 additions & 1 deletion lib/services/common/iotManagerService.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ function register(callback) {
timestamp: service.timestamp,
autoprovision: service.autoprovision,
explicitAttrs: service.explicitAttrs,
expressionLanguage: service.expressionLanguage,
defaultEntityNameConjunction: service.defaultEntityNameConjunction,
ngsiVersion: service.ngsiVersion,
entityNameExp: service.entityNameExp
Expand Down
19 changes: 9 additions & 10 deletions lib/services/devices/deviceRegistryMongoDB.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const attributeList = [
'polling',
'timestamp',
'explicitAttrs',
'expressionLanguage',
'ngsiVersion'
];

Expand Down Expand Up @@ -176,15 +175,15 @@ function listDevices(type, service, subservice, limit, offset, callback) {
query.skip(parseInt(offset, 10));
}

async.series([query.exec.bind(query), Device.model.countDocuments.bind(Device.model, condition)], function (
error,
results
) {
callback(error, {
count: results[1],
devices: results[0]
});
});
async.series(
[query.exec.bind(query), Device.model.countDocuments.bind(Device.model, condition)],
function (error, results) {
callback(error, {
count: results[1],
devices: results[0]
});
}
);
}

function findOneInMongoDB(queryParams, id, callback) {
Expand Down
3 changes: 0 additions & 3 deletions lib/services/devices/deviceService.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,6 @@ function mergeDeviceWithConfiguration(fields, defaults, deviceData, configuratio
if (configuration && configuration.ngsiVersion) {
deviceData.ngsiVersion = configuration.ngsiVersion;
}
if (configuration && configuration.expressionLanguage && deviceData.expressionLanguage === undefined) {
deviceData.expressionLanguage = configuration.expressionLanguage;
}
if (configuration && configuration.explicitAttrs !== undefined && deviceData.explicitAttrs === undefined) {
deviceData.explicitAttrs = configuration.explicitAttrs;
}
Expand Down
3 changes: 0 additions & 3 deletions lib/services/devices/devices-NGSI-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,6 @@ function updateRegisterDeviceNgsi2(deviceObj, entityInfoUpdated, callback) {
if ('explicitAttrs' in newDevice && newDevice.explicitAttrs !== undefined) {
oldDevice.explicitAttrs = newDevice.explicitAttrs;
}
if ('expressionLanguage' in newDevice && newDevice.expressionLanguage !== undefined) {
oldDevice.expressionLanguage = newDevice.expressionLanguage;
}
if ('apikey' in newDevice && newDevice.apikey !== undefined) {
oldDevice.explicitAttrs = newDevice.apikey;
}
Expand Down
3 changes: 0 additions & 3 deletions lib/services/northBound/deviceProvisioningServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ const provisioningAPITranslation = {
static_attributes: 'staticAttributes',
autoprovision: 'autoprovision',
explicitAttrs: 'explicitAttrs',
expressionLanguage: 'expressionLanguage',
ngsiVersion: 'ngsiVersion',
entityNameExp: 'entityNameExp'
};
Expand Down Expand Up @@ -142,7 +141,6 @@ function handleProvision(req, res, next) {
internalId: null,
autoprovision: body.autoprovision,
explicitAttrs: body.explicitAttrs,
expressionLanguage: body.expressionLanguage,
ngsiVersion: body.ngsiVersion
});
}
Expand Down Expand Up @@ -219,7 +217,6 @@ function toProvisioningAPIFormat(device) {
internal_attributes: device.internalAttributes,
protocol: device.protocol,
autoprovision: device.autoprovision,
expressionLanguage: device.expressionLanguage,
explicitAttrs: device.explicitAttrs,
ngsiVersion: device.ngsiVersion
};
Expand Down
4 changes: 0 additions & 4 deletions lib/templates/createDevice.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@
"description": "Transport protocol used by the platform to communicate with the device",
"type": "string"
},
"expressionLanguage": {
"description": "Expression language used to apply expressions for this device",
"type": "string"
},
"explicitAttrs": {
"description": "Flag about only provisioned attributes will be processed to Context Broker"
},
Expand Down
4 changes: 0 additions & 4 deletions lib/templates/createDeviceLax.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@
"description": "Transport protocol used by the platform to communicate with the device",
"type": "string"
},
"expressionLanguage": {
"description": "Expression language used to apply expressions for this device",
"type": "string"
},
"explicitAttrs": {
"description": "Flag about only provisioned attributes will be processed to Context Broker"
},
Expand Down
6 changes: 1 addition & 5 deletions lib/templates/deviceGroup.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@
"description": "list of lazy attributes of the devices",
"type": "array"
},
"expressionLanguage": {
"description": "Expression language used to for the group of devices",
"type": "string"
},
"ngsiVersion": {
"description": "NGSI Interface for this group of devices",
"type": "string"
Expand Down Expand Up @@ -81,4 +77,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
{
"device_id": "MicroLight1",
"protocol": "GENERIC_PROTO",
"expressionLanguage": "jexl",
"attributes": [
{
"name": "attr_name",
Expand Down
1 change: 0 additions & 1 deletion test/unit/ngsiv2/plugins/multientity-plugin_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,6 @@ const iotAgentConfig = {
},
GPS1: {
commands: [],
expressionLanguage: 'jexl',
type: 'GPS',
lazy: [],
active: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,6 @@ describe('NGSI-v2 - Device provisioning API: Provision devices', function () {
/*jshint camelcase: false */
entity_type: 'MicroLights',
entityNameExp: "id + '__' + suffix_st",
expressionLanguage: 'jexl',
cbHost: 'http://192.168.1.1:1026',
static_attributes: [
{
Expand Down

0 comments on commit 6ebbbc6

Please sign in to comment.