1 <?php
2 /*
3 Copyright (c) 2012, University of Cambridge Computing Service
4
5 This file is part of the Lookup/Ibis client library.
6
7 This library is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published
9 by the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this library. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 require_once "IbisDto.php";
22
23 /**
24 * Class representing an attribute scheme. This may apply to attributes of
25 * people or institutions.
26 *
27 * @author Dean Rasheed (dev-group@ucs.cam.ac.uk)
28 */
29 class IbisAttributeScheme extends IbisDto
30 {
31 /* Properties marked as @XmlAttribte in the JAXB class */
32 protected static $xmlAttrs = array("schemeid", "precedence", "multiValued",
33 "multiLined", "searchable");
34
35 /* Properties marked as @XmlElement in the JAXB class */
36 protected static $xmlElems = array("ldapName", "displayName",
37 "dataType", "regexp");
38
39 /** @var string The unique identifier of the attribute scheme. */
40 public $schemeid;
41
42 /**
43 * @var int The attribute scheme's precedence. Methods that return or
44 * display attributes sort the results primarily in order of increasing
45 * values of attribute scheme precedence.
46 */
47 public $precedence;
48
49 /**
50 * @var string The name of the attribute scheme in LDAP, if it is
51 * exported to LDAP. Note that many attributes are not exported to LDAP,
52 * in which case this name is typically just equal to the scheme's ID.
53 */
54 public $ldapName;
55
56 /**
57 * @var string The display name for labelling attributes in this scheme.
58 */
59 public $displayName;
60
61 /** @var string The attribute scheme's datatype. */
62 public $dataType;
63
64 /**
65 * @var boolean Flag indicating whether attributes in this scheme can be
66 * multi-valued.
67 */
68 public $multiValued;
69
70 /**
71 * @var boolean Flag for textual attributes schemes indicating whether
72 * they are multi-lined.
73 */
74 public $multiLined;
75
76 /**
77 * @var boolean Flag indicating whether attributes of this scheme are
78 * searched by the default search functionality.
79 */
80 public $searchable;
81
82 /**
83 * @var string For textual attributes, an optional regular expression
84 * that all attributes in this scheme match.
85 */
86 public $regexp;
87
88 /**
89 * @ignore
90 * Create an IbisAttributeScheme from the attributes of an XML node.
91 *
92 * @param array $attrs The attributes on the XML node.
93 */
94 public function __construct($attrs=array())
95 {
96 parent::__construct($attrs);
97 if (isset($this->precedence))
98 $this->precedence = strcasecmp($this->precedence, "true") == 0;
99 if (isset($this->multiValued))
100 $this->multiValued = strcasecmp($this->multiValued, "true") == 0;
101 if (isset($this->multiLined))
102 $this->multiLined = strcasecmp($this->multiLined, "true") == 0;
103 if (isset($this->searchable))
104 $this->searchable = strcasecmp($this->searchable, "true") == 0;
105 }
106 }
107