|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
/** |
|
3
|
|
|
* @copyright Copyright (c) 2017 Robin Appelman <[email protected]> |
|
4
|
|
|
* |
|
5
|
|
|
* @license GNU AGPL version 3 or any later version |
|
6
|
|
|
* |
|
7
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
8
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
9
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
10
|
|
|
* License, or (at your option) any later version. |
|
11
|
|
|
* |
|
12
|
|
|
* This program is distributed in the hope that it will be useful, |
|
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15
|
|
|
* GNU Affero General Public License for more details. |
|
16
|
|
|
* |
|
17
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
18
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
19
|
|
|
* |
|
20
|
|
|
*/ |
|
21
|
|
|
|
|
22
|
|
|
namespace SearchDAV\Backend; |
|
23
|
|
|
|
|
24
|
|
|
class SearchPropertyDefinition { |
|
25
|
|
|
const XS = '{http://www.w3.org/2001/XMLSchema}'; |
|
26
|
|
|
const DATATYPE_STRING = self::XS . 'string'; |
|
27
|
|
|
const DATATYPE_INTEGER = self::XS . 'integer'; |
|
28
|
|
|
const DATATYPE_NONNEGATIVE_INTEGER = self::XS . 'nonNegativeInteger'; |
|
29
|
|
|
const DATATYPE_DECIMAL = self::XS . 'decimal'; |
|
30
|
|
|
const DATATYPE_DATETIME = self::XS . 'dateTime'; |
|
31
|
|
|
const DATATYPE_BOOLEAN = self::XS . 'boolean'; |
|
32
|
|
|
|
|
33
|
|
|
|
|
34
|
|
|
/** @var boolean */ |
|
35
|
|
|
public $searchable; |
|
36
|
|
|
/** @var boolean */ |
|
37
|
|
|
public $selectable; |
|
38
|
|
|
/** @var boolean */ |
|
39
|
|
|
public $sortable; |
|
40
|
|
|
/** @var boolean */ |
|
41
|
|
|
public $caseSensitive; |
|
42
|
|
|
/** @var string */ |
|
43
|
|
|
public $dataType; |
|
44
|
|
|
/** @var string */ |
|
45
|
|
|
public $name; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* SearchProperty constructor. |
|
49
|
|
|
* |
|
50
|
|
|
* @param string $name the name and namespace of the property in clark notation |
|
51
|
|
|
* @param bool $searchable whether or not this property can be used as part of a search query |
|
52
|
|
|
* @param bool $selectable whether or not this property can be returned as part of a search result |
|
53
|
|
|
* @param bool $sortable whether or not this property can be used to sort the search result |
|
54
|
|
|
* @param string $dataType the datatype of the property, one of the SearchProperty::DATATYPE_ constants or any XSD datatype in clark notation |
|
55
|
|
|
* @param bool $caseSensitive whether or not comparisons on the property are case sensitive, only applies to string propertries |
|
56
|
|
|
*/ |
|
57
|
|
|
public function __construct($name, $searchable, $selectable, $sortable, $dataType = self::DATATYPE_STRING, $caseSensitive = true) { |
|
58
|
|
|
$this->searchable = $searchable; |
|
59
|
|
|
$this->selectable = $selectable; |
|
60
|
|
|
$this->sortable = $sortable; |
|
61
|
|
|
$this->dataType = $dataType; |
|
62
|
|
|
$this->name = $name; |
|
63
|
|
|
$this->caseSensitive = $caseSensitive; |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|