24
24
throw new ADEIException(translate("Unsupported item filter is configured: \"%s\"", $filter_class));
27
28
$this->filter = new $filter_class($opts);
29
30
$mask = $filter->GetItemMask();
31
if (($mask)&&(!$mask->IsFull())) $this->check_masked = true;
32
else $this->check_masked = false;
34
32
if (isset($opts['item_mask'])) {
36
$this->indexes = array();
37
33
$key = array(); $re = array();
38
34
if (is_array($opts['item_mask'])) {
39
35
if (is_array($opts['item_mask'][0])) {
42
38
$checks = array($opts['item_mask']);
45
$re = $opts['item_mask'];
49
foreach ($mask->ids as $id) {
50
if (preg_match($re, $id)) $this->indexes[$i] = $id;
54
$checks = array(array(
41
// Just a regexp of numeric ids
42
$checks = $opts['item_mask'];
45
$this->indexes_masked = array();
46
$this->indexes_full = array();
62
$items = $rdr->GetItemList($grp, ($mask?$mask:new MASK()));
50
if (is_array($checks)) {
51
$items = $rdr->GetItemList($grp, new MASK());
54
if (($opts['masking_reader'])&&($mask)&&(!$mask->IsFull())) {
56
$items = $mask->GetIDs();
58
$items = range(0, $rdr->GetGroupSize($grp) - 1);
64
63
foreach ($items as &$item) {
66
foreach ($checks as $check) {
67
if (!preg_match($check['items'], $item[$check['key']])) {
64
if (is_array($checks)) {
68
foreach ($checks as $check) {
69
if (!preg_match($check['items'], $item[$check['key']])) {
72
if ($matched) $this->indexes[$i] = $item["id"];
76
$matched = preg_match($checks, $item);
79
if ((!$mask)||($mask->Check($i))) {
80
if ($matched) $this->indexes_masked[$j] = $id;
83
if ($matched) $this->indexes_full[$i] = $id;
88
$this->indexes_masked = $this->indexes_full;
89
$this->indexes_full = false;
76
} else if (($mask)&&(!$mask->IsFull())) {
77
$this->indexes = $mask->ids;
79
$this->indexes = range(0, $rdr->GetGroupSize($grp) - 1);
93
// Avoid calling GetGroupSize (involves requires to Source Database)
94
if (($opts['masking_reader'])&&($mask)&&(!$mask->IsFull())) {
95
$this->index_full = false;
96
$this->indexes_masked = $mask->GetIDs();
98
$this->indexes_full = range(0, $rdr->GetGroupSize($grp) - 1);
99
if (($mask)&&(!$mask->IsFull())) $this->indexes_masked = $mask->ids;
100
else $this->indexes_masked = $this->indexes_full;
84
106
function Start(&$data) {
85
107
if ($this->skip) return;
87
if (($this->check_masked)&&(!$data['masked']))
88
throw new ADEIException(translate("ITEMFilter can't be executed on unmasked data..."));
109
if ($data['masked']) {
110
if ($this->indexes_masked === false)
111
throw new ADEIException(translate("ITEMFilter is not configured for masked data..."));
112
$this->indexes = $this->indexes_masked;
114
if ($this->indexes_full === false)
115
throw new ADEIException(translate("ITEMFilter is not configured for unmasked data..."));
116
$this->indexes = $this->indexes_full;
91
121
function ProcessVector(&$data, &$time, &$values) {