| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WebService::Cmis::ObjectType; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
WebService::Cmis::ObjecType . Representation of a cmis object type |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Parent class: L |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
|
12
|
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
9167
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
43
|
|
|
14
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
37
|
|
|
15
|
1
|
|
|
1
|
|
6
|
use WebService::Cmis qw(:namespaces); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
190
|
|
|
16
|
1
|
|
|
1
|
|
6
|
use WebService::Cmis::Property (); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
22
|
|
|
17
|
1
|
|
|
1
|
|
58
|
use WebService::Cmis::AtomEntry (); |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
use Error qw(:try); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our @ISA = qw(WebService::Cmis::AtomEntry); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $CMIS_XPATH_ATTRIBUTES = new XML::LibXML::XPathExpression('./*[local-name() = "type" and namespace-uri()="'.CMISRA_NS.'"]/*[not(starts-with(local-name(),"property")) and namespace-uri() = "'.CMIS_NS.'"]'); |
|
23
|
|
|
|
|
|
|
our $CMIS_XPATH_PROPERTY_DEFINITIONS = new XML::LibXML::XPathExpression('./*[local-name() = "type" and namespace-uri()="'.CMISRA_NS.'"]/*[starts-with(local-name(),"property") and namespace-uri() = "'.CMIS_NS.'"]'); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 METHODS |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=over 4 |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=item new() |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub new { |
|
34
|
|
|
|
|
|
|
my $class = shift; |
|
35
|
|
|
|
|
|
|
my %params = @_; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $xmlDoc = delete $params{xmlDoc}; |
|
38
|
|
|
|
|
|
|
my $repository = delete $params{repository}; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my $this = bless({ |
|
41
|
|
|
|
|
|
|
xmlDoc => $xmlDoc, |
|
42
|
|
|
|
|
|
|
repository => $repository, |
|
43
|
|
|
|
|
|
|
attributes => \%params, |
|
44
|
|
|
|
|
|
|
_hasLoadedAttributes => 0, |
|
45
|
|
|
|
|
|
|
}, $class); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
return $this; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub DESTROY { |
|
51
|
|
|
|
|
|
|
my $this = shift; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
#print STDERR "called ObjectType::DESTROY\n"; |
|
54
|
|
|
|
|
|
|
undef $this->{repository}; |
|
55
|
|
|
|
|
|
|
undef $this->{xmlDoc}; |
|
56
|
|
|
|
|
|
|
undef $this->{propertyDefs}; |
|
57
|
|
|
|
|
|
|
undef $this->{attributes}; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item getAttributes -> %attrs |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
returns a hash of attributes of this object type |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub getAttributes { |
|
67
|
|
|
|
|
|
|
my $this = shift; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
unless ($this->{_hasLoadedAttributes}) { |
|
70
|
|
|
|
|
|
|
foreach my $node ($this->_xmlDoc->findnodes($CMIS_XPATH_ATTRIBUTES)) { |
|
71
|
|
|
|
|
|
|
my $key = $node->nodeName; |
|
72
|
|
|
|
|
|
|
$key =~ s/^cmis://g; |
|
73
|
|
|
|
|
|
|
$this->{attributes}{$key} = $node->string_value |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
$this->{_hasLoadedAttributes} = 1; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
return $this->{attributes}; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item getPropertyDefinitions -> %propertyDefinitions |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
returns a hash of L objects representing each property |
|
85
|
|
|
|
|
|
|
defined for this type. |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub getPropertyDefinitions { |
|
90
|
|
|
|
|
|
|
my $this = shift; |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
require WebService::Cmis::PropertyDefinition; |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
unless (defined $this->{propertyDefs}) { |
|
95
|
|
|
|
|
|
|
# when we come from the types collection the entries might not contain the property definitions. |
|
96
|
|
|
|
|
|
|
# reloading the self link gets the full definition |
|
97
|
|
|
|
|
|
|
$this->reload unless $this->_xmlDoc->exists($CMIS_XPATH_PROPERTY_DEFINITIONS); |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
foreach my $propNode ($this->_xmlDoc->findnodes($CMIS_XPATH_PROPERTY_DEFINITIONS)) { |
|
100
|
|
|
|
|
|
|
my $propDef = new WebService::Cmis::PropertyDefinition(xmlDoc=>$propNode); |
|
101
|
|
|
|
|
|
|
$this->{propertyDefs}{$propDef->getId} = $propDef; |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
return $this->{propertyDefs}; |
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item getAttribute($name) -> $value |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
getter to retrieve the attribute values |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub getAttribute { |
|
115
|
|
|
|
|
|
|
return $_[0]->getAttributes->{$_[1]}; |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=item reload |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
This method will re-fetch the ObjecType XML data from the CMIS |
|
121
|
|
|
|
|
|
|
service. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=cut |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub reload { |
|
126
|
|
|
|
|
|
|
my $this = shift; |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
throw Error::Simple("can't reload ObjectType without attributes") unless defined $this->{attributes}; |
|
129
|
|
|
|
|
|
|
throw Error::Simple("can't reload ObjectType without an id") unless defined $this->{attributes}{id}; |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
my $byTypeIdUrl = $this->{repository}->getUriTemplate('typebyid'); |
|
132
|
|
|
|
|
|
|
$byTypeIdUrl =~ s/{id}/$this->{attributes}{id}/g; |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
#print STDERR "byTypeIdUrl=$byTypeIdUrl\n"; |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
my $result = $this->{repository}{client}->get($byTypeIdUrl, @_); |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
$this->{xmlDoc} = $result->documentElement; |
|
139
|
|
|
|
|
|
|
undef $this->{propertyDefs}; |
|
140
|
|
|
|
|
|
|
} |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=item getId() -> $id |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
returns the type ID of this object |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=cut |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub getId { |
|
149
|
|
|
|
|
|
|
return $_[0]->getAttribute("id"); |
|
150
|
|
|
|
|
|
|
} |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item getBaseId |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
getter for cmis:baseId |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=cut |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
sub getBaseId { |
|
160
|
|
|
|
|
|
|
return $_[0]->getAttribute("baseId"); |
|
161
|
|
|
|
|
|
|
} |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=item getDescription |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
getter for cmis:description |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=cut |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
sub getDescription { |
|
170
|
|
|
|
|
|
|
return $_[0]->getAttribute("description"); |
|
171
|
|
|
|
|
|
|
} |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=item getDisplayName |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
getter for cmis:displayName |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=cut |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
sub getDisplayName { |
|
180
|
|
|
|
|
|
|
return $_[0]->getAttribute("displayName"); |
|
181
|
|
|
|
|
|
|
} |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=item getLocalName |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
getter for cmis:localName |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=cut |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
sub getLocalName { |
|
190
|
|
|
|
|
|
|
return $_[0]->getAttribute("localName"); |
|
191
|
|
|
|
|
|
|
} |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=item getLocalNamespace |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
getter for cmis:localNamespace |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=cut |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
sub getLocalNamespace { |
|
200
|
|
|
|
|
|
|
return $_[0]->getAttribute("localNamespace"); |
|
201
|
|
|
|
|
|
|
} |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=item getQueryName |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
getter for cmis:queryName |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=cut |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
sub getQueryName { |
|
210
|
|
|
|
|
|
|
return $_[0]->getAttribute("queryName"); |
|
211
|
|
|
|
|
|
|
} |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=item getContentStreamAllowed |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
getter for cmis:contentStreamAllowed |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=cut |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
sub getContentStreamAllowed { |
|
220
|
|
|
|
|
|
|
return $_[0]->getAttribute("contentStreamAllowed"); |
|
221
|
|
|
|
|
|
|
} |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=item isCreatable -> $boolean |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
getter for cmis:creatable |
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=cut |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
sub isCreatable { |
|
230
|
|
|
|
|
|
|
require WebService::Cmis::Property; |
|
231
|
|
|
|
|
|
|
return WebService::Cmis::Property::parseBoolean($_[0]->getAttribute('creatable')); |
|
232
|
|
|
|
|
|
|
} |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=item isFileable -> $boolean |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
getter for cmis:fileable |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
See CMIS specification document 2.1.5.1 File-able Objects |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=cut |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
sub isFileable { |
|
243
|
|
|
|
|
|
|
require WebService::Cmis::Property; |
|
244
|
|
|
|
|
|
|
return WebService::Cmis::Property::parseBoolean($_[0]->getAttribute('filable')); |
|
245
|
|
|
|
|
|
|
} |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=item isQueryable -> $boolean |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
getter for cmis:queryable |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=cut |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
sub isQueryable { |
|
254
|
|
|
|
|
|
|
require WebService::Cmis::Property; |
|
255
|
|
|
|
|
|
|
return WebService::Cmis::Property::parseBoolean($_[0]->getAttribute('queryable')); |
|
256
|
|
|
|
|
|
|
} |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=item isFulltextIndexed -> $boolean |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
getter for cmis:fulltextIndexed |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=cut |
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
sub isFulltextIndexed { |
|
265
|
|
|
|
|
|
|
require WebService::Cmis::Property; |
|
266
|
|
|
|
|
|
|
return WebService::Cmis::Property::parseBoolean($_[0]->getAttribute('fulltextIndexed')); |
|
267
|
|
|
|
|
|
|
} |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=item isIncludedInSupertypeQuery -> $boolean |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
getter for cmis:includedInSupertypeQuery |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=cut |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
sub isIncludedInSupertypeQuery { |
|
276
|
|
|
|
|
|
|
require WebService::Cmis::Property; |
|
277
|
|
|
|
|
|
|
return WebService::Cmis::Property::parseBoolean($_[0]->getAttribute('includedInSupertypeQuery')); |
|
278
|
|
|
|
|
|
|
} |
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=item isControllablePolicy -> $boolean |
|
281
|
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
getter for cmis:controllablePolicy |
|
283
|
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
=cut |
|
285
|
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
sub isControllablePolicy { |
|
287
|
|
|
|
|
|
|
require WebService::Cmis::Property; |
|
288
|
|
|
|
|
|
|
return WebService::Cmis::Property::parseBoolean($_[0]->getAttribute('controllablePolicy')); |
|
289
|
|
|
|
|
|
|
} |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=item isControllableACL -> $boolean |
|
292
|
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
getter for cmis:controllableACL |
|
294
|
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=cut |
|
296
|
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
sub isControllableACL { |
|
298
|
|
|
|
|
|
|
require WebService::Cmis::Property; |
|
299
|
|
|
|
|
|
|
return WebService::Cmis::Property::parseBoolean($_[0]->getAttribute('controllableACL')); |
|
300
|
|
|
|
|
|
|
} |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=item isVersionable -> $boolean |
|
304
|
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
getter for cmis:versionable |
|
306
|
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
=cut |
|
308
|
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
sub isVersionable { |
|
310
|
|
|
|
|
|
|
require WebService::Cmis::Property; |
|
311
|
|
|
|
|
|
|
return WebService::Cmis::Property::parseBoolean($_[0]->getAttribute('versionable')); |
|
312
|
|
|
|
|
|
|
} |
|
313
|
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
=back |
|
315
|
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
317
|
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
Copyright 2012-2013 Michael Daum |
|
319
|
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it under |
|
321
|
|
|
|
|
|
|
the same terms as Perl itself. See F. |
|
322
|
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
=cut |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
1; |