"AND (:customerId IS NULL OR d.customerId = uuid(:customerId)) "+
"AND (:edgeId IS NULL OR d.id IN (SELECT re.toId FROM RelationEntity re WHERE re.toType = 'DEVICE' AND re.relationTypeGroup = 'EDGE' AND re.relationType = 'Contains' AND re.fromType = 'EDGE' AND re.fromId = uuid(:edgeId))) "+
"AND ((:deviceType) IS NULL OR d.type = :deviceType) "+
"AND (:deviceProfileId IS NULL OR d.deviceProfileId = uuid(:deviceProfileId)) "+
"AND ((:filterByActive) IS FALSE OR d.active = :deviceActive) "+