@jahia/javascript-modules-library 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +35 -0
  3. package/core/index.js +1 -0
  4. package/core/server/components/AbsoluteArea.js +1 -0
  5. package/core/server/components/AddContentButtons.js +1 -0
  6. package/core/server/components/AddResources.js +1 -0
  7. package/core/server/components/Area.js +1 -0
  8. package/core/server/components/index.js +1 -0
  9. package/core/server/components/render/HydrateInBrowser.js +1 -0
  10. package/core/server/components/render/Render.js +1 -0
  11. package/core/server/components/render/RenderInBrowser.js +1 -0
  12. package/core/server/components/render/index.js +1 -0
  13. package/core/server/components/render/internal/InBrowser.js +1 -0
  14. package/core/server/framework/defineJahiaComponent.js +1 -0
  15. package/core/server/framework/index.js +1 -0
  16. package/core/server/framework/register.js +1 -0
  17. package/core/server/hooks/index.js +1 -0
  18. package/core/server/hooks/useGQLQuery.js +1 -0
  19. package/core/server/hooks/useJCRQuery.js +1 -0
  20. package/core/server/hooks/useServerContext.js +1 -0
  21. package/core/server/hooks/useUrlBuilder.js +1 -0
  22. package/core/server/index.js +1 -0
  23. package/core/server/utils/index.js +1 -0
  24. package/core/server/utils/jcr/getChildNodes.js +1 -0
  25. package/core/server/utils/jcr/getNodeFromPathOrId.js +1 -0
  26. package/core/server/utils/jcr/getNodeProps.js +1 -0
  27. package/core/server/utils/jcr/getNodesByJCRQuery.js +1 -0
  28. package/core/server/utils/jcr/index.js +1 -0
  29. package/core/server/utils/urlBuilder/index.js +1 -0
  30. package/core/server/utils/urlBuilder/urlBuilder.js +1 -0
  31. package/index.js +1 -0
  32. package/nav/index.js +1 -0
  33. package/nav/server/index.js +1 -0
  34. package/nav/server/navBuilder/index.js +1 -0
  35. package/nav/server/navBuilder/navBuilder.js +24 -0
  36. package/package.json +60 -0
  37. package/types/@jahia/javascript-modules-library-private.d.ts +60 -0
  38. package/types/core/index.d.ts +1 -0
  39. package/types/core/server/components/AbsoluteArea.d.ts +29 -0
  40. package/types/core/server/components/AddContentButtons.d.ts +13 -0
  41. package/types/core/server/components/AddResources.d.ts +31 -0
  42. package/types/core/server/components/Area.d.ts +27 -0
  43. package/types/core/server/components/index.d.ts +5 -0
  44. package/types/core/server/components/render/HydrateInBrowser.d.ts +13 -0
  45. package/types/core/server/components/render/Render.d.ts +23 -0
  46. package/types/core/server/components/render/RenderInBrowser.d.ts +13 -0
  47. package/types/core/server/components/render/index.d.ts +3 -0
  48. package/types/core/server/components/render/internal/InBrowser.d.ts +8 -0
  49. package/types/core/server/framework/defineJahiaComponent.d.ts +41 -0
  50. package/types/core/server/framework/index.d.ts +2 -0
  51. package/types/core/server/framework/register.d.ts +7 -0
  52. package/types/core/server/hooks/index.d.ts +4 -0
  53. package/types/core/server/hooks/useGQLQuery.d.ts +5 -0
  54. package/types/core/server/hooks/useJCRQuery.d.ts +3 -0
  55. package/types/core/server/hooks/useServerContext.d.ts +14 -0
  56. package/types/core/server/hooks/useUrlBuilder.d.ts +31 -0
  57. package/types/core/server/index.d.ts +4 -0
  58. package/types/core/server/utils/index.d.ts +2 -0
  59. package/types/core/server/utils/jcr/getChildNodes.d.ts +9 -0
  60. package/types/core/server/utils/jcr/getNodeFromPathOrId.d.ts +12 -0
  61. package/types/core/server/utils/jcr/getNodeProps.d.ts +7 -0
  62. package/types/core/server/utils/jcr/getNodesByJCRQuery.d.ts +9 -0
  63. package/types/core/server/utils/jcr/index.d.ts +4 -0
  64. package/types/core/server/utils/urlBuilder/index.d.ts +1 -0
  65. package/types/core/server/utils/urlBuilder/urlBuilder.d.ts +27 -0
  66. package/types/globals.d.ts +11 -0
  67. package/types/index.d.ts +19 -0
  68. package/types/java.io.d.ts +694 -0
  69. package/types/java.net.d.ts +190 -0
  70. package/types/java.security.d.ts +27 -0
  71. package/types/java.util.d.ts +1536 -0
  72. package/types/javax.jcr.d.ts +1250 -0
  73. package/types/javax.servlet.d.ts +426 -0
  74. package/types/javax.servlet.http.d.ts +1431 -0
  75. package/types/nav/index.d.ts +1 -0
  76. package/types/nav/server/index.d.ts +1 -0
  77. package/types/nav/server/navBuilder/index.d.ts +1 -0
  78. package/types/nav/server/navBuilder/navBuilder.d.ts +78 -0
  79. package/types/org.jahia.modules.npm.modules.engine.js.server.d.ts +292 -0
  80. package/types/org.jahia.services.content.d.ts +1463 -0
  81. package/types/org.jahia.services.content.decorator.d.ts +92 -0
  82. package/types/org.jahia.services.query.d.ts +35 -0
  83. package/types/org.jahia.services.render.d.ts +168 -0
  84. package/types/org.jahia.services.usermanager.d.ts +85 -0
  85. package/types/org.osgi.framework.d.ts +1004 -0
  86. package/types/server.d.ts +27 -0
  87. package/types/servercontext.d.ts +29 -0
@@ -0,0 +1,1250 @@
1
+ declare module 'javax.jcr' {
2
+ /**
3
+ * A Binary object holds a JCR property value of type
4
+ * BINARY. The Binary interface and the related
5
+ * methods in {@link Property}, {@link Value} and {@link ValueFactory} replace
6
+ * the deprecated {@link Value#getStream} and {@link Property#getStream}
7
+ * methods.
8
+ *
9
+ * @since JCR 2.0
10
+ */
11
+ export class Binary {
12
+ /**
13
+ * Returns the size of this Binary value in bytes.
14
+ *
15
+ * If {@link #dispose()} has been called on this Binary
16
+ * object, then this method will throw the runtime exception
17
+ * {@link java.lang.IllegalStateException}.
18
+ *
19
+ * @return the size of this value in bytes.
20
+ * @throws RepositoryException if an error occurs.
21
+ */
22
+ getSize(): number;
23
+ }
24
+ /**
25
+ * The Item is the base interface of {@link Node} and
26
+ * {@link Property}.
27
+ */
28
+ export class Item {
29
+ /**
30
+ * Returns the normalized absolute path to this item.
31
+ *
32
+ * @return the normalized absolute path of this Item.
33
+ * @throws RepositoryException if an error occurs.
34
+ */
35
+ getPath(): string;
36
+ /**
37
+ * Returns the name of this Item in qualified form. If this
38
+ * Item is the root node of the workspace, an empty string is
39
+ * returned.
40
+ *
41
+ * @return the name of this Item in qualified form or an empty
42
+ * string if this Item is the root node of a
43
+ * workspace.
44
+ * @throws RepositoryException if an error occurs.
45
+ */
46
+ getName(): string;
47
+ /**
48
+ * Returns the ancestor of this Item at the specified depth. An
49
+ * ancestor of depth x is the Item that is x
50
+ * levels down along the path from the root node to this
51
+ * Item. depth = 0 returns the root node of a
52
+ * workspace. depth = 1 returns the child of the root node along
53
+ * the path to this Item. depth = 2 returns
54
+ * the grandchild of the root node along the path to this
55
+ * Item. And so on to depth = n, where
56
+ * n is the depth of this Item, which returns
57
+ * this Item itself.
58
+ *
59
+ * If this node has more than one path (i.e., if it is a descendant of a
60
+ * shared node) then the path used to define the ancestor is
61
+ * implementaion-dependent.
62
+ *
63
+ * @param depth An integer, 0 <= depth <= n where
64
+ * n is the depth of this Item.
65
+ * @return The ancestor of this Item at the specified
66
+ * depth.
67
+ * @throws ItemNotFoundException if depth < 0 or depth >
68
+ * n where n is the is the depth of this item.
69
+ * @throws AccessDeniedException if the current session does not have
70
+ * sufficent access to retrieve the specified node.
71
+ * @throws RepositoryException if another error occurs.
72
+ */
73
+ getAncestor(depth: number): Item;
74
+ /**
75
+ * Returns the parent of this Item.
76
+ *
77
+ * @return The parent of this Item.
78
+ * @throws ItemNotFoundException if this Item is the root node
79
+ * of a workspace.
80
+ * @throws AccessDeniedException if the current session does not have
81
+ * sufficent access to retrieve the parent of this item.
82
+ * @throws RepositoryException if another error occurs.
83
+ */
84
+ getParent(): Node;
85
+ /**
86
+ * Returns the depth of this Item in the workspace item graph.
87
+ * The root node returns 0. A property or child node of the
88
+ * root node returns 1. A property or child node of a child node of the
89
+ * root returns 2. And so on to this Item.
90
+ *
91
+ * @return The depth of this Item in the workspace item graph.
92
+ * @throws RepositoryException if an error occurs.
93
+ */
94
+ getDepth(): number;
95
+ /**
96
+ * Indicates whether this Item is a Node or a
97
+ * Property. Returns true if this
98
+ * Item is a Node; Returns false if
99
+ * this Item is a Property.
100
+ *
101
+ * @return true if this Item is a
102
+ * Node, false if it is a
103
+ * Property.
104
+ */
105
+ isNode(): boolean;
106
+ /**
107
+ * Returns true if this is a new item, meaning that it exists
108
+ * only in transient storage on the Session and has not yet
109
+ * been saved. Within a transaction, isNew on an
110
+ * Item may return false (because the item has
111
+ * been saved) even if that Item is not in persistent storage
112
+ * (because the transaction has not yet been committed).
113
+ *
114
+ * Note that if an item returns true on isNew,
115
+ * then by definition is parent will return true on
116
+ * isModified.
117
+ *
118
+ * Note that in read-only implementations, this method will always return
119
+ * false.
120
+ *
121
+ * @return true if this item is new; false
122
+ * otherwise.
123
+ */
124
+ isNew(): boolean;
125
+ /**
126
+ * Returns true if this Item has been saved but
127
+ * has subsequently been modified through the current session and therefore
128
+ * the state of this item as recorded in the session differs from the state
129
+ * of this item as saved. Within a transaction, isModified on
130
+ * an Item may return false (because the
131
+ * Item has been saved since the modification) even if the
132
+ * modification in question is not in persistent storage (because the
133
+ * transaction has not yet been committed).
134
+ *
135
+ * Note that in read-only implementations, this method will always return
136
+ * false.
137
+ *
138
+ * @return true if this item is modified; false
139
+ * otherwise.
140
+ */
141
+ isModified(): boolean;
142
+ /**
143
+ * Returns true if this Item object (the Java
144
+ * object instance) represents the same actual workspace item as the object
145
+ * otherItem.
146
+ *
147
+ * Two Item objects represent the same workspace item if and
148
+ * only if all the following are true: Both objects were acquired
149
+ * through Session objects that were created by the same
150
+ * Repository object. Both objects were acquired
151
+ * through Session objects bound to the same repository
152
+ * workspace. The objects are either both Node objects
153
+ * or both Property objects. If they are
154
+ * Node objects, they have the same identifier. If
155
+ * they are Property objects they have identical names and
156
+ * isSame is true of their parent nodes. This method
157
+ * does not compare the states of the two items. For example, if two
158
+ * Item objects representing the same actual workspace item
159
+ * have been retrieved through two different sessions and one has been
160
+ * modified, then this method will still return true when
161
+ * comparing these two objects. Note that if two Item objects
162
+ * representing the same workspace item are retrieved through the
163
+ * same session they will always reflect the same state.
164
+ *
165
+ * @param otherItem the Item object to be tested for identity
166
+ * with this Item.
167
+ * @return true if this Item object and
168
+ * otherItem represent the same actual repository item;
169
+ * false otherwise.
170
+ * @throws RepositoryException if an error occurs.
171
+ */
172
+ isSame(otherItem: Item): boolean;
173
+ }
174
+ /**
175
+ * The Node interface represents a node in a workspace.
176
+ */
177
+ export class Node {
178
+ /**
179
+ * Returns the node at relPath relative to this node.
180
+ *
181
+ * If relPath contains a path element that refers to a node
182
+ * with same-name sibling nodes without explicitly including an index using
183
+ * the array-style notation ([x]), then the index [1] is
184
+ * assumed (indexing of same name siblings begins at 1, not 0, in order to
185
+ * preserve compatibility with XPath).
186
+ *
187
+ * Within the scope of a single Session object, if a
188
+ * Node object has been acquired, any subsequent call of
189
+ * getNode reacquiring the same node must return a
190
+ * Node object reflecting the same state as the earlier
191
+ * Node object. Whether this object is actually the same
192
+ * Node instance, or simply one wrapping the same state, is up
193
+ * to the implementation.
194
+ *
195
+ * @param relPath The relative path of the node to retrieve.
196
+ * @return The node at relPath.
197
+ * @throws PathNotFoundException if no node exists at the specified path or
198
+ * the current Session does not read access to the node at the
199
+ * specified path.
200
+ * @throws RepositoryException If another error occurs.
201
+ */
202
+ getNode(relPath: string): Node;
203
+ /**
204
+ * Returns all child nodes of this node accessible through the current
205
+ * Session. Does not include properties of this
206
+ * Node. The same reacquisition semantics apply as with {@link
207
+ * #getNode(String)}. If this node has no accessible child nodes, then an
208
+ * empty iterator is returned.
209
+ *
210
+ * @return A NodeIterator over all child Nodes of
211
+ * this Node.
212
+ * @throws RepositoryException if an error occurs.
213
+ */
214
+ getNodes(): NodeIterator;
215
+ /**
216
+ * Gets all child nodes of this node accessible through the current
217
+ * Session that match namePattern. The pattern may
218
+ * be a full name or a partial name with one or more wildcard characters
219
+ * ("*"), or a disjunction (using the "|"
220
+ * character to represent logical OR) of these. For example,
221
+ *
222
+ * N.getNodes("jcr:* | myapp:report | my doc")
223
+ *
224
+ * would return a NodeIterator holding all accessible child
225
+ * nodes of N that are either called 'myapp:report',
226
+ * begin with the prefix 'jcr:' or are called 'my
227
+ * doc'.
228
+ *
229
+ * The substrings within the pattern that are delimited by "|"
230
+ * characters and which may contain wildcard characters ("*")
231
+ * are called globs.
232
+ *
233
+ * Note that leading and trailing whitespace around a glob is ignored, but
234
+ * whitespace within a disjunct forms part of the pattern to be matched.
235
+ *
236
+ * The pattern is matched against the names (not the paths) of the immediate
237
+ * child nodes of this node.
238
+ *
239
+ * If this node has no accessible matching child nodes, then an empty
240
+ * iterator is returned.
241
+ *
242
+ * The same reacquisition semantics apply as with {@link
243
+ * #getNode(String)}.
244
+ *
245
+ * @param namePattern a name pattern.
246
+ * @return a NodeIterator.
247
+ * @throws RepositoryException if an unexpected error occurs.
248
+ */
249
+ getNodes(namePattern: string): NodeIterator;
250
+ /**
251
+ * Gets all child nodes of this node accessible through the current
252
+ * Session that match one or more of the nameGlob
253
+ * strings in the passed array.
254
+ *
255
+ * A glob may be a full name or a partial name with one or more wildcard
256
+ * characters ("*"). For example,
257
+ *
258
+ * N.getNodes(new String[] {"jcr:*", "myapp:report", "my
259
+ * doc"})
260
+ *
261
+ * would return a NodeIterator holding all accessible child
262
+ * nodes of N that are either called 'myapp:report',
263
+ * begin with the prefix 'jcr:' or are called 'my
264
+ * doc'.
265
+ *
266
+ * Note that unlike in the case of the {@link #getNodes(String)} leading and
267
+ * trailing whitespace around a glob is not ignored.
268
+ *
269
+ * The globs are matched against the names (not the paths) of the immediate
270
+ * child nodes of this node.
271
+ *
272
+ * If this node has no accessible matching child nodes, then an empty
273
+ * iterator is returned.
274
+ *
275
+ * The same reacquisition semantics apply as with {@link
276
+ * #getNode(String)}.
277
+ *
278
+ * @param nameGlobs an array of globbing strings.
279
+ * @return a NodeIterator.
280
+ * @throws RepositoryException if an unexpected error occurs.
281
+ * @since JCR 2.0
282
+ */
283
+ getNodes(nameGlobs: string[]): NodeIterator;
284
+ /**
285
+ * Returns the property at relPath relative to
286
+ * this node. The same reacquisition semantics apply as with
287
+ * {@link #getNode(String)}.
288
+ *
289
+ * @param relPath The relative path of the property to retrieve.
290
+ * @return The property at relPath.
291
+ * @throws PathNotFoundException if no property exists at the specified path
292
+ * or if the current
293
+ *
294
+ * Session does not have read access to the specified
295
+ * property.
296
+ * @throws RepositoryException If another error occurs.
297
+ */
298
+ getProperty(relPath: string): Property;
299
+ /**
300
+ * Returns all properties of this node accessible through the current
301
+ * Session. Does not include child nodes of this
302
+ * node. The same reacquisition semantics apply as with {@link
303
+ * #getNode(String)}. If this node has no accessible properties, then
304
+ * an empty iterator is returned.
305
+ *
306
+ * @return A PropertyIterator.
307
+ * @throws RepositoryException if an error occurs.
308
+ */
309
+ getProperties(): PropertyIterator;
310
+ /**
311
+ * Gets all properties of this node accessible through the current
312
+ * Session that match namePattern. The pattern may
313
+ * be a full name or a partial name with one or more wildcard characters
314
+ * ("*"), or a disjunction (using the "|"
315
+ * character to represent logical OR) of these. For example,
316
+ *
317
+ * N.getProperties("jcr:* | myapp:name | my doc")
318
+ *
319
+ * would return a PropertyIterator holding all accessible
320
+ * properties of N that are either called
321
+ * 'myapp:name', begin with the prefix 'jcr:' or
322
+ * are called 'my doc'.
323
+ *
324
+ *
325
+ * The substrings within the pattern that are delimited by "|"
326
+ * characters and which may contain wildcard characters ("*")
327
+ * are called globs.
328
+ *
329
+ * Note that leading and trailing whitespace around a glob is ignored, but
330
+ * whitespace within a disjunct forms part of the pattern to be matched.
331
+ *
332
+ * The pattern is matched against the names (not the paths) of the immediate
333
+ * child properties of this node.
334
+ *
335
+ * If this node has no accessible matching properties, then an empty
336
+ * iterator is returned.
337
+ *
338
+ * The same reacquisition semantics apply as with {@link
339
+ * #getNode(String)}.
340
+ *
341
+ * @param namePattern a name pattern.
342
+ * @return a PropertyIterator.
343
+ * @throws RepositoryException if an unexpected error occurs.
344
+ */
345
+ getProperties(namePattern: string): PropertyIterator;
346
+ /**
347
+ * Gets all properties of this node accessible through the current
348
+ * Session that match one or more of the nameGlob
349
+ * strings in the passed array.
350
+ *
351
+ * A glob may be a full name or a partial name with one or more wildcard
352
+ * characters ("*"). For example,
353
+ *
354
+ * N.getProperties(new String[] {"jcr:*", "myapp:report", "my
355
+ * doc"})
356
+ *
357
+ * would return a PropertyIterator holding all accessible
358
+ * properties of N that are either called
359
+ * 'myapp:report', begin with the prefix 'jcr:' or
360
+ * are called 'my doc'.
361
+ *
362
+ * Note that unlike in the case of the {@link #getProperties(String)}
363
+ * leading and trailing whitespace around a glob is not ignored.
364
+ *
365
+ * The globs are matched against the names (not the paths) of the properties
366
+ * of this node.
367
+ *
368
+ * If this node has no accessible matching properties, then an empty
369
+ * iterator is returned.
370
+ *
371
+ * The same reacquisition semantics apply as with {@link
372
+ * #getProperty(String)}.
373
+ *
374
+ * @param nameGlobs an array of globbing strings.
375
+ * @return a PropertyIterator.
376
+ * @throws RepositoryException if an unexpected error occurs.
377
+ * @since JCR 2.0
378
+ */
379
+ getProperties(nameGlobs: string[]): PropertyIterator;
380
+ /**
381
+ * Returns the UUID of this node as recorded in this node's
382
+ * jcr:uuid property. This method only works on nodes of mixin
383
+ * node type mix:referenceable.
384
+ *
385
+ * On nonreferenceable nodes, this method throws an UnsupportedRepositoryOperationException.
386
+ * To avoid throwing an exception to determine whether a node has a UUID, a
387
+ * call to {@link #isNodeType(String) isNodeType("mix:referenceable")} can
388
+ * be made.
389
+ *
390
+ * @return the UUID of this node.
391
+ * @throws UnsupportedRepositoryOperationException
392
+ * if this node
393
+ * nonreferenceable.
394
+ * @throws RepositoryException if another error occurs.
395
+ * @deprecated As of JCR 2.0, {@link #getIdentifier()} should be used
396
+ * instead.
397
+ */
398
+ getUUID(): string;
399
+ /**
400
+ * Returns the identifier of this node. Applies to both referenceable and
401
+ * non-referenceable nodes.
402
+ *
403
+ * A RepositoryException is thrown if an error occurs.
404
+ *
405
+ * @return the identifier of this node.
406
+ * @throws RepositoryException if an error occurs.
407
+ * @since JCR 2.0
408
+ */
409
+ getIdentifier(): string;
410
+ /**
411
+ * This method returns all REFERENCE properties that refer to
412
+ * this node and that are accessible through the current
413
+ * Session. Equivalent to Node.getReferences(null).
414
+ *
415
+ * If this node has no referring REFERENCE properties, an
416
+ * empty iterator is returned. This includes the case where this node is not referenceable.
417
+ *
418
+ * @return A PropertyIterator.
419
+ * @throws RepositoryException if an error occurs.
420
+ * @see #getReferences(String).
421
+ */
422
+ getReferences(): PropertyIterator;
423
+ /**
424
+ * This method returns all REFERENCE properties that refer to
425
+ * this node, have the specified name and that are accessible
426
+ * through the current Session.
427
+ *
428
+ * If the name parameter is null then all
429
+ * referring REFERENCES are returned regardless of name.
430
+ *
431
+ * Some implementations may only return properties that have been persisted.
432
+ * Some may return both properties that have been persisted and those that
433
+ * have been dispatched but not persisted (for example, those saved within a
434
+ * transaction but not yet committed) while others implementations may
435
+ * return these two categories of property as well as properties that are
436
+ * still pending and not yet dispatched.
437
+ *
438
+ * In implementations that support versioning, this method does not return
439
+ * properties that are part of the frozen state of a version in version
440
+ * storage.
441
+ *
442
+ * If this node has no referring REFERENCE properties with the specified name, an
443
+ * empty iterator is returned. This includes the case where this node is not referenceable.
444
+ *
445
+ * @param name name of referring REFERENCE properties to be
446
+ * returned; if null then all referring REFERENCEs
447
+ * are returned.
448
+ * @return A PropertyIterator.
449
+ * @throws RepositoryException if an error occurs.
450
+ * @since JCR 2.0
451
+ */
452
+ getReferences(name: string): PropertyIterator;
453
+ /**
454
+ * This method returns all WEAKREFERENCE properties that refer
455
+ * to this node and that are accessible through the current
456
+ * Session. Equivalent to Node.getWeakReferences(null).
457
+ *
458
+ * If this node has no referring WEAKREFERENCE properties, an
459
+ * empty iterator is returned. This includes the case where this node is not referenceable.
460
+ *
461
+ * @return A PropertyIterator.
462
+ * @throws RepositoryException if an error occurs.
463
+ * @see #getWeakReferences(String).
464
+ * @since JCR 2.0
465
+ */
466
+ getWeakReferences(): PropertyIterator;
467
+ /**
468
+ * This method returns all WEAKREFERENCE properties that refer
469
+ * to this node, have the specified name and that are
470
+ * accessible through the current Session.
471
+ *
472
+ * If the name parameter is null then all
473
+ * referring WEAKREFERENCE are returned regardless of name.
474
+ *
475
+ * Some implementations may only return properties that have been persisted.
476
+ * Some may return both properties that have been persisted and those that
477
+ * have been dispatched but not persisted (for example, those saved within a
478
+ * transaction but not yet committed) while others implementations may
479
+ * return these two categories of property as well as properties that are
480
+ * still pending and not yet dispatched.
481
+ *
482
+ * In implementations that support versioning, this method does not return
483
+ * properties that are part of the frozen state of a version in version
484
+ * storage.
485
+ *
486
+ * If this node has no referring WEAKREFERENCE properties with the specified name, an
487
+ * empty iterator is returned. This includes the case where this node is not referenceable.
488
+ *
489
+ * @param name name of referring WEAKREFERENCE properties to be
490
+ * returned; if null then all referring
491
+ * WEAKREFERENCEs are returned.
492
+ * @return A PropertyIterator.
493
+ * @throws RepositoryException if an error occurs.
494
+ * @since JCR 2.0
495
+ */
496
+ getWeakReferences(name: string): PropertyIterator;
497
+ /**
498
+ * Indicates whether a node exists at relPath Returns
499
+ * true if a node accessible through the current
500
+ * Session exists at relPath and
501
+ * false otherwise.
502
+ *
503
+ * @param relPath The path of a (possible) node.
504
+ * @return true if a node exists at relPath;
505
+ * false otherwise.
506
+ * @throws RepositoryException if an error occurs.
507
+ */
508
+ hasNode(relPath: string): boolean;
509
+ /**
510
+ * Indicates whether a property exists at relPath Returns
511
+ * true if a property accessible through the current
512
+ * Session exists at relPath and
513
+ * false otherwise.
514
+ *
515
+ * @param relPath The path of a (possible) property.
516
+ * @return true if a property exists at relPath;
517
+ * false otherwise.
518
+ * @throws RepositoryException if an error occurs.
519
+ */
520
+ hasProperty(relPath: string): boolean;
521
+ /**
522
+ * Indicates whether this node has child nodes. Returns true if
523
+ * this node has one or more child nodes accessible through the current
524
+ * Session; false otherwise.
525
+ *
526
+ * @return true if this node has one or more child nodes;
527
+ * false otherwise.
528
+ * @throws RepositoryException if an error occurs.
529
+ */
530
+ hasNodes(): boolean;
531
+ /**
532
+ * Indicates whether this node has properties. Returns true if
533
+ * this node has one or more properties accessible through the current
534
+ * Session; false otherwise.
535
+ *
536
+ * @return true if this node has one or more properties;
537
+ * false otherwise.
538
+ * @throws RepositoryException if an error occurs.
539
+ */
540
+ hasProperties(): boolean;
541
+ /**
542
+ * Returns true if this node is of the specified primary node
543
+ * type or mixin type, or a subtype thereof. Returns false
544
+ * otherwise.
545
+ *
546
+ * This method respects the effective node type of the node.
547
+ *
548
+ * @param nodeTypeName the name of a node type.
549
+ * @return true If this node is of the specified primary node
550
+ * type or mixin type, or a subtype thereof. Returns
551
+ * false otherwise.
552
+ * @throws RepositoryException if an error occurs.
553
+ */
554
+ isNodeType(nodeTypeName: string): boolean;
555
+ /**
556
+ * Returns false if this node is currently in the checked-in state
557
+ * (either due to its own status as a versionable node or due to the effect of
558
+ * a versionable node being checked in above it). Otherwise this method returns
559
+ * true. This includes the case where the repository does not
560
+ * support versioning (and therefore all nodes are always "checked-out",
561
+ * by default).
562
+ *
563
+ * @return a boolean
564
+ * @throws RepositoryException if an error occurs.
565
+ */
566
+ isCheckedOut(): boolean;
567
+ /**
568
+ * Returns true if this node is locked either as a result of a
569
+ * lock held by this node or by a deep lock on a node above this node;
570
+ * otherwise returns false. This includes the case
571
+ * where a repository does not support locking (in which case all
572
+ * nodes are "unlocked" by default).
573
+ *
574
+ * @return a boolean.
575
+ * @throws RepositoryException if an error occurs.
576
+ */
577
+ isLocked(): boolean;
578
+ /**
579
+ * Returns the normalized absolute path to this item.
580
+ *
581
+ * @return the normalized absolute path of this Item.
582
+ * @throws RepositoryException if an error occurs.
583
+ */
584
+ getPath(): string;
585
+ /**
586
+ * Returns the name of this Item in qualified form. If this
587
+ * Item is the root node of the workspace, an empty string is
588
+ * returned.
589
+ *
590
+ * @return the name of this Item in qualified form or an empty
591
+ * string if this Item is the root node of a
592
+ * workspace.
593
+ * @throws RepositoryException if an error occurs.
594
+ */
595
+ getName(): string;
596
+ /**
597
+ * Returns the ancestor of this Item at the specified depth. An
598
+ * ancestor of depth x is the Item that is x
599
+ * levels down along the path from the root node to this
600
+ * Item. depth = 0 returns the root node of a
601
+ * workspace. depth = 1 returns the child of the root node along
602
+ * the path to this Item. depth = 2 returns
603
+ * the grandchild of the root node along the path to this
604
+ * Item. And so on to depth = n, where
605
+ * n is the depth of this Item, which returns
606
+ * this Item itself.
607
+ *
608
+ * If this node has more than one path (i.e., if it is a descendant of a
609
+ * shared node) then the path used to define the ancestor is
610
+ * implementaion-dependent.
611
+ *
612
+ * @param depth An integer, 0 <= depth <= n where
613
+ * n is the depth of this Item.
614
+ * @return The ancestor of this Item at the specified
615
+ * depth.
616
+ * @throws ItemNotFoundException if depth < 0 or depth >
617
+ * n where n is the is the depth of this item.
618
+ * @throws AccessDeniedException if the current session does not have
619
+ * sufficent access to retrieve the specified node.
620
+ * @throws RepositoryException if another error occurs.
621
+ */
622
+ getAncestor(depth: number): Item;
623
+ /**
624
+ * Returns the parent of this Item.
625
+ *
626
+ * @return The parent of this Item.
627
+ * @throws ItemNotFoundException if this Item is the root node
628
+ * of a workspace.
629
+ * @throws AccessDeniedException if the current session does not have
630
+ * sufficent access to retrieve the parent of this item.
631
+ * @throws RepositoryException if another error occurs.
632
+ */
633
+ getParent(): Node;
634
+ /**
635
+ * Indicates whether this Item is a Node or a
636
+ * Property. Returns true if this
637
+ * Item is a Node; Returns false if
638
+ * this Item is a Property.
639
+ *
640
+ * @return true if this Item is a
641
+ * Node, false if it is a
642
+ * Property.
643
+ */
644
+ isNode(): boolean;
645
+ /**
646
+ * Returns true if this is a new item, meaning that it exists
647
+ * only in transient storage on the Session and has not yet
648
+ * been saved. Within a transaction, isNew on an
649
+ * Item may return false (because the item has
650
+ * been saved) even if that Item is not in persistent storage
651
+ * (because the transaction has not yet been committed).
652
+ *
653
+ * Note that if an item returns true on isNew,
654
+ * then by definition is parent will return true on
655
+ * isModified.
656
+ *
657
+ * Note that in read-only implementations, this method will always return
658
+ * false.
659
+ *
660
+ * @return true if this item is new; false
661
+ * otherwise.
662
+ */
663
+ isNew(): boolean;
664
+ /**
665
+ * Returns true if this Item has been saved but
666
+ * has subsequently been modified through the current session and therefore
667
+ * the state of this item as recorded in the session differs from the state
668
+ * of this item as saved. Within a transaction, isModified on
669
+ * an Item may return false (because the
670
+ * Item has been saved since the modification) even if the
671
+ * modification in question is not in persistent storage (because the
672
+ * transaction has not yet been committed).
673
+ *
674
+ * Note that in read-only implementations, this method will always return
675
+ * false.
676
+ *
677
+ * @return true if this item is modified; false
678
+ * otherwise.
679
+ */
680
+ isModified(): boolean;
681
+ /**
682
+ * Returns true if this Item object (the Java
683
+ * object instance) represents the same actual workspace item as the object
684
+ * otherItem.
685
+ *
686
+ * Two Item objects represent the same workspace item if and
687
+ * only if all the following are true: Both objects were acquired
688
+ * through Session objects that were created by the same
689
+ * Repository object. Both objects were acquired
690
+ * through Session objects bound to the same repository
691
+ * workspace. The objects are either both Node objects
692
+ * or both Property objects. If they are
693
+ * Node objects, they have the same identifier. If
694
+ * they are Property objects they have identical names and
695
+ * isSame is true of their parent nodes. This method
696
+ * does not compare the states of the two items. For example, if two
697
+ * Item objects representing the same actual workspace item
698
+ * have been retrieved through two different sessions and one has been
699
+ * modified, then this method will still return true when
700
+ * comparing these two objects. Note that if two Item objects
701
+ * representing the same workspace item are retrieved through the
702
+ * same session they will always reflect the same state.
703
+ *
704
+ * @param otherItem the Item object to be tested for identity
705
+ * with this Item.
706
+ * @return true if this Item object and
707
+ * otherItem represent the same actual repository item;
708
+ * false otherwise.
709
+ * @throws RepositoryException if an error occurs.
710
+ */
711
+ isSame(otherItem: Item): boolean;
712
+ }
713
+ /**
714
+ * Allows easy iteration through a list of Nodes with
715
+ * nextNode as well as a skip method inherited from
716
+ * RangeIterator.
717
+ */
718
+ export class NodeIterator {
719
+ /**
720
+ * Returns the next Node in the iteration.
721
+ *
722
+ * @return the next Node in the iteration.
723
+ * @throws java.util.NoSuchElementException
724
+ * if iteration has no more
725
+ * Nodes.
726
+ */
727
+ nextNode(): Node;
728
+ /**
729
+ * Returns `true` if the iteration has more elements.
730
+ * (In other words, returns `true` if {@link #next} would
731
+ * return an element rather than throwing an exception.)
732
+ *
733
+ * @return `true` if the iteration has more elements
734
+ */
735
+ hasNext(): boolean;
736
+ }
737
+ /**
738
+ * A Property object represents the smallest granularity of content
739
+ * storage. It has a single parent node and no children. A property consists of
740
+ * a name and a value, or in the case of multi-value properties, a set of values
741
+ * all of the same type. See {@link Value}.
742
+ */
743
+ export class Property {
744
+ /**
745
+ * Returns the value of this property as a Value object.
746
+ *
747
+ * The object returned is a copy of the stored value and is immutable.
748
+ *
749
+ * @return the Value.
750
+ * @throws ValueFormatException if the property is multi-valued.
751
+ * @throws RepositoryException if another error occurs.
752
+ */
753
+ getValue(): Value;
754
+ /**
755
+ * Returns an array of all the values of this property. Used to access
756
+ * multi-value properties. The array returned is a copy of the stored
757
+ * values, so changes to it are not reflected in internal storage.
758
+ *
759
+ * @return a Value array.
760
+ * @throws ValueFormatException if the property is single-valued.
761
+ * @throws RepositoryException if another error occurs.
762
+ */
763
+ getValues(): Value[];
764
+ /**
765
+ * Returns a String representation of the value of this
766
+ * property. A shortcut for Property.getValue().getString().
767
+ *
768
+ * @return A string representation of the value of this property.
769
+ * @throws ValueFormatException if conversion to a String is
770
+ * not possible or if the property is multi-valued.
771
+ * @throws RepositoryException if another error occurs.
772
+ * @see Value
773
+ */
774
+ getString(): string;
775
+ /**
776
+ * Returns a Binary representation of the value of this
777
+ * property. A shortcut for Property.getValue().getBinary().
778
+ *
779
+ * @return A Binary representation of the value of this
780
+ * property.
781
+ * @throws ValueFormatException if the property is multi-valued.
782
+ * @throws RepositoryException if another error occurs.
783
+ * @see Value
784
+ * @see Binary
785
+ * @since JCR 2.0
786
+ */
787
+ getBinary(): Binary;
788
+ /**
789
+ * Returns a long representation of the value of this property.
790
+ * A shortcut for Property.getValue().getLong().
791
+ *
792
+ * @return A long representation of the value of this
793
+ * property.
794
+ * @throws ValueFormatException if conversion to a long is not
795
+ * possible or if the property is multi-valued.
796
+ * @throws RepositoryException if another error occurs.
797
+ * @see Value
798
+ */
799
+ getLong(): number;
800
+ /**
801
+ * Returns a double representation of the value of this
802
+ * property. A shortcut for Property.getValue().getDouble().
803
+ *
804
+ * @return A double representation of the value of this
805
+ * property.
806
+ * @throws ValueFormatException if conversion to a double is
807
+ * not possible or if the property is multi-valued.
808
+ * @throws RepositoryException if another error occurs.
809
+ * @see Value
810
+ */
811
+ getDouble(): number;
812
+ /**
813
+ * Returns a boolean representation of the value of this
814
+ * property. A shortcut for Property.getValue().getBoolean().
815
+ *
816
+ * @return A boolean representation of the value of this
817
+ * property.
818
+ * @throws ValueFormatException if conversion to a boolean is
819
+ * not possible or if the property is multi-valued.
820
+ * @throws RepositoryException if another error occurs.
821
+ * @see Value
822
+ */
823
+ getBoolean(): boolean;
824
+ /**
825
+ * If this property is of type REFERENCE,
826
+ * WEAKREFERENCE or PATH (or convertible to one of
827
+ * these types) this method returns the Node to which this
828
+ * property refers.
829
+ *
830
+ * If this property is of type PATH and it contains a relative
831
+ * path, it is interpreted relative to the parent node of this property. For
832
+ * example "." refers to the parent node itself,
833
+ * ".." to the parent of the parent node and "foo"
834
+ * to a sibling node of this property.
835
+ *
836
+ * @return the referenced Node
837
+ * @throws ValueFormatException if this property cannot be converted to a
838
+ * referring type (REFERENCE, WEAKREFERENCE or
839
+ * PATH), if the property is multi-valued or if this property
840
+ * is a referring type but is currently part of the frozen state of a
841
+ * version in version storage.
842
+ * @throws ItemNotFoundException If this property is of type
843
+ * PATH or WEAKREFERENCE and no target node
844
+ * accessible by the current Session exists in this workspace.
845
+ * Note that this applies even if the property is a PATHS and a
846
+ * property exists at the specified location. To dereference to a
847
+ * target property (as opposed to a target node), the method
848
+ * Property.getProperty is used.
849
+ * @throws RepositoryException if another error occurs.
850
+ */
851
+ getNode(): Node;
852
+ /**
853
+ * If this property is of type PATH (or convertible to this
854
+ * type) this method returns the Property to which this
855
+ * property refers.
856
+ *
857
+ * If this property contains a relative path, it is interpreted relative to
858
+ * the parent node of this property. Therefore, when resolving such a
859
+ * relative path, the segment "." refers to
860
+ * the parent node itself, ".." to the parent of the parent
861
+ * node and "foo" to a sibling property of this property or
862
+ * this property itself.
863
+ *
864
+ * For example, if this property is located at
865
+ * /a/b/c and it has a value of "../d" then this
866
+ * method will return the property at /a/d if such exists.
867
+ *
868
+ * If this property is multi-valued, this method throws a
869
+ * ValueFormatException.
870
+ *
871
+ * If this property cannot be converted to a PATH then a
872
+ * ValueFormatException is thrown.
873
+ *
874
+ * If this property is currently part of the frozen state of a version in
875
+ * version storage, this method will throw a ValueFormatException.
876
+ *
877
+ * @return the referenced property
878
+ * @throws ValueFormatException if this property cannot be converted to a
879
+ * PATH, if the property is multi-valued or if this property is
880
+ * a referring type but is currently part of the frozen state of a version
881
+ * in version storage.
882
+ * @throws ItemNotFoundException If no property accessible by the current
883
+ * Session exists in this workspace at the specified path. Note
884
+ * that this applies even if a node exists at the specified location.
885
+ * To dereference to a target node, the method Property.getNode
886
+ * is used.
887
+ * @throws RepositoryException if another error occurs.
888
+ * @since JCR 2.0
889
+ */
890
+ getProperty(): Property;
891
+ /**
892
+ * Returns the length of the value of this property.
893
+ *
894
+ * For a BINARY property, getLength returns the
895
+ * number of bytes. For other property types, getLength returns
896
+ * the same value that would be returned by calling {@link
897
+ * java.lang.String#length()} on the value when it has been converted to a
898
+ * STRING according to standard JCR property type conversion.
899
+ *
900
+ * Returns -1 if the implementation cannot determine the length.
901
+ *
902
+ * @return an long.
903
+ * @throws ValueFormatException if this property is multi-valued.
904
+ * @throws RepositoryException if another error occurs.
905
+ */
906
+ getLength(): number;
907
+ /**
908
+ * Returns an array holding the lengths of the values of this (multi-value)
909
+ * property in bytes where each is individually calculated as described in
910
+ * {@link #getLength()}.
911
+ *
912
+ * Returns a -1 in the appropriate position if the
913
+ * implementation cannot determine the length of a value.
914
+ *
915
+ * @return an array of lengths
916
+ * @throws ValueFormatException if this property is single-valued.
917
+ * @throws RepositoryException if another error occurs.
918
+ */
919
+ getLengths(): number[];
920
+ /**
921
+ * Returns the type of this Property. One of:
922
+ * PropertyType.STRING PropertyType.BINARY
923
+ * PropertyType.DATE PropertyType.DOUBLE
924
+ * PropertyType.LONG PropertyType.BOOLEAN
925
+ * PropertyType.NAME PropertyType.PATH
926
+ * PropertyType.REFERENCE PropertyType.WEAKREFERENCE
927
+ * PropertyType.URI The type returned is that
928
+ * which was set at property creation. Note that for some property
929
+ * p, the type returned by p.getType() will differ
930
+ * from the type returned by p.getDefinition.getRequiredType()
931
+ * only in the case where the latter returns UNDEFINED. The
932
+ * type of a property instance is never UNDEFINED (it must
933
+ * always have some actual type).
934
+ *
935
+ * @return an int
936
+ * @throws RepositoryException if an error occurs
937
+ */
938
+ getType(): number;
939
+ /**
940
+ * Returns true if this property is multi-valued and
941
+ * false if this property is single-valued.
942
+ *
943
+ * @return true if this property is multi-valued;
944
+ * false otherwise.
945
+ * @throws RepositoryException if an error occurs.
946
+ */
947
+ isMultiple(): boolean;
948
+ /**
949
+ * Returns the normalized absolute path to this item.
950
+ *
951
+ * @return the normalized absolute path of this Item.
952
+ * @throws RepositoryException if an error occurs.
953
+ */
954
+ getPath(): string;
955
+ /**
956
+ * Returns the name of this Item in qualified form. If this
957
+ * Item is the root node of the workspace, an empty string is
958
+ * returned.
959
+ *
960
+ * @return the name of this Item in qualified form or an empty
961
+ * string if this Item is the root node of a
962
+ * workspace.
963
+ * @throws RepositoryException if an error occurs.
964
+ */
965
+ getName(): string;
966
+ /**
967
+ * Returns the ancestor of this Item at the specified depth. An
968
+ * ancestor of depth x is the Item that is x
969
+ * levels down along the path from the root node to this
970
+ * Item. depth = 0 returns the root node of a
971
+ * workspace. depth = 1 returns the child of the root node along
972
+ * the path to this Item. depth = 2 returns
973
+ * the grandchild of the root node along the path to this
974
+ * Item. And so on to depth = n, where
975
+ * n is the depth of this Item, which returns
976
+ * this Item itself.
977
+ *
978
+ * If this node has more than one path (i.e., if it is a descendant of a
979
+ * shared node) then the path used to define the ancestor is
980
+ * implementaion-dependent.
981
+ *
982
+ * @param depth An integer, 0 <= depth <= n where
983
+ * n is the depth of this Item.
984
+ * @return The ancestor of this Item at the specified
985
+ * depth.
986
+ * @throws ItemNotFoundException if depth < 0 or depth >
987
+ * n where n is the is the depth of this item.
988
+ * @throws AccessDeniedException if the current session does not have
989
+ * sufficent access to retrieve the specified node.
990
+ * @throws RepositoryException if another error occurs.
991
+ */
992
+ getAncestor(depth: number): Item;
993
+ /**
994
+ * Returns the parent of this Item.
995
+ *
996
+ * @return The parent of this Item.
997
+ * @throws ItemNotFoundException if this Item is the root node
998
+ * of a workspace.
999
+ * @throws AccessDeniedException if the current session does not have
1000
+ * sufficent access to retrieve the parent of this item.
1001
+ * @throws RepositoryException if another error occurs.
1002
+ */
1003
+ getParent(): Node;
1004
+ /**
1005
+ * Returns the depth of this Item in the workspace item graph.
1006
+ * The root node returns 0. A property or child node of the
1007
+ * root node returns 1. A property or child node of a child node of the
1008
+ * root returns 2. And so on to this Item.
1009
+ *
1010
+ * @return The depth of this Item in the workspace item graph.
1011
+ * @throws RepositoryException if an error occurs.
1012
+ */
1013
+ getDepth(): number;
1014
+ /**
1015
+ * Indicates whether this Item is a Node or a
1016
+ * Property. Returns true if this
1017
+ * Item is a Node; Returns false if
1018
+ * this Item is a Property.
1019
+ *
1020
+ * @return true if this Item is a
1021
+ * Node, false if it is a
1022
+ * Property.
1023
+ */
1024
+ isNode(): boolean;
1025
+ /**
1026
+ * Returns true if this is a new item, meaning that it exists
1027
+ * only in transient storage on the Session and has not yet
1028
+ * been saved. Within a transaction, isNew on an
1029
+ * Item may return false (because the item has
1030
+ * been saved) even if that Item is not in persistent storage
1031
+ * (because the transaction has not yet been committed).
1032
+ *
1033
+ * Note that if an item returns true on isNew,
1034
+ * then by definition is parent will return true on
1035
+ * isModified.
1036
+ *
1037
+ * Note that in read-only implementations, this method will always return
1038
+ * false.
1039
+ *
1040
+ * @return true if this item is new; false
1041
+ * otherwise.
1042
+ */
1043
+ isNew(): boolean;
1044
+ /**
1045
+ * Returns true if this Item has been saved but
1046
+ * has subsequently been modified through the current session and therefore
1047
+ * the state of this item as recorded in the session differs from the state
1048
+ * of this item as saved. Within a transaction, isModified on
1049
+ * an Item may return false (because the
1050
+ * Item has been saved since the modification) even if the
1051
+ * modification in question is not in persistent storage (because the
1052
+ * transaction has not yet been committed).
1053
+ *
1054
+ * Note that in read-only implementations, this method will always return
1055
+ * false.
1056
+ *
1057
+ * @return true if this item is modified; false
1058
+ * otherwise.
1059
+ */
1060
+ isModified(): boolean;
1061
+ /**
1062
+ * Returns true if this Item object (the Java
1063
+ * object instance) represents the same actual workspace item as the object
1064
+ * otherItem.
1065
+ *
1066
+ * Two Item objects represent the same workspace item if and
1067
+ * only if all the following are true: Both objects were acquired
1068
+ * through Session objects that were created by the same
1069
+ * Repository object. Both objects were acquired
1070
+ * through Session objects bound to the same repository
1071
+ * workspace. The objects are either both Node objects
1072
+ * or both Property objects. If they are
1073
+ * Node objects, they have the same identifier. If
1074
+ * they are Property objects they have identical names and
1075
+ * isSame is true of their parent nodes. This method
1076
+ * does not compare the states of the two items. For example, if two
1077
+ * Item objects representing the same actual workspace item
1078
+ * have been retrieved through two different sessions and one has been
1079
+ * modified, then this method will still return true when
1080
+ * comparing these two objects. Note that if two Item objects
1081
+ * representing the same workspace item are retrieved through the
1082
+ * same session they will always reflect the same state.
1083
+ *
1084
+ * @param otherItem the Item object to be tested for identity
1085
+ * with this Item.
1086
+ * @return true if this Item object and
1087
+ * otherItem represent the same actual repository item;
1088
+ * false otherwise.
1089
+ * @throws RepositoryException if an error occurs.
1090
+ */
1091
+ isSame(otherItem: Item): boolean;
1092
+ }
1093
+ /**
1094
+ * Allows easy iteration through a list of Propertys with
1095
+ * nextProperty as well as a skip method.
1096
+ */
1097
+ export class PropertyIterator {
1098
+ /**
1099
+ * Returns the next Property in the iteration.
1100
+ *
1101
+ * @return the next Property in the iteration.
1102
+ * @throws java.util.NoSuchElementException
1103
+ * if iteration has no more
1104
+ * Propertys.
1105
+ */
1106
+ nextProperty(): Property;
1107
+ /**
1108
+ * Returns the total number of of items available through this iterator. For
1109
+ * example, for some node N, N.getNodes().getSize()
1110
+ * returns the number of child nodes of N visible through the
1111
+ * current Session. In some implementations precise information
1112
+ * about the number of elements may not be available. In such cases this
1113
+ * method must return -1. API clients will then be able to use
1114
+ * RangeIterator.getNumberRemaining to get an estimate on the
1115
+ * number of elements.
1116
+ *
1117
+ * @return a long
1118
+ */
1119
+ getSize(): number;
1120
+ /**
1121
+ * Returns `true` if the iteration has more elements.
1122
+ * (In other words, returns `true` if {@link #next} would
1123
+ * return an element rather than throwing an exception.)
1124
+ *
1125
+ * @return `true` if the iteration has more elements
1126
+ */
1127
+ hasNext(): boolean;
1128
+ }
1129
+ /**
1130
+ * A generic holder for the value of a property. A Value object can
1131
+ * be used without knowing the actual property type (STRING,
1132
+ * DOUBLE, BINARY etc.).
1133
+ *
1134
+ * The Binary interface and its related methods in
1135
+ * Property, Value and ValueFactory
1136
+ * replace the deprecated Value.getStream and
1137
+ * Property.getStream methods from JCR 1.0. However, though
1138
+ * getStream has been deprecated, for reasons of backward
1139
+ * compatibility its behavior must still conform to the following rules:
1140
+ * A Value object can be read using type-specific
1141
+ * get methods. These methods are divided into two groups:
1142
+ * The non-stream get methods getString(),
1143
+ * getBinary(), getDate(), getDecimal(),
1144
+ * getLong(), getDouble() and
1145
+ * getBoolean(). getStream().
1146
+ * Once a Value object has been read once using
1147
+ * getStream(), all subsequent calls to getStream()
1148
+ * will return the same Stream object. This may mean, for example,
1149
+ * that the stream returned is fully or partially consumed. In order to get a
1150
+ * fresh stream the Value object must be reacquired via {@link
1151
+ * Property#getValue()} or {@link Property#getValues()}. Once a
1152
+ * Value object has been read once using getStream(),
1153
+ * any subsequent call to any of the non-stream get methods will
1154
+ * throw an IllegalStateException. In order to successfully invoke
1155
+ * a non-stream get method, the Value must be
1156
+ * reacquired via {@link Property#getValue()} or {@link Property#getValues()}.
1157
+ * Once a Value object has been read once using a
1158
+ * non-stream get method, any subsequent call to getStream() will
1159
+ * throw an IllegalStateException. In order to successfully invoke
1160
+ * getStream(), the Value must be reacquired via
1161
+ * {@link Property#getValue()} or {@link Property#getValues()}.
1162
+ *
1163
+ * Two Value instances, v1 and v2, are
1164
+ * considered equal if and only if: v1.getType() ==
1165
+ * v2.getType(), and, v1.getString().equals(v2.getString())
1166
+ * Actually comparing two Value instances by converting them
1167
+ * to string form may not be practical in some cases (for example, if the values
1168
+ * are very large binaries). Consequently, the above is intended as a normative
1169
+ * definition of Value equality but not as a procedural test of
1170
+ * equality. It is assumed that implementations will have efficient means of
1171
+ * determining equality that conform with the above definition.
1172
+ *
1173
+ * An implementation is only required to support equality comparisons on
1174
+ * Value instances that were acquired from the same
1175
+ * Session and whose contents have not been read. The equality
1176
+ * comparison must not change the state of the Value instances even
1177
+ * though the getString() method in the above definition implies a
1178
+ * state change.
1179
+ */
1180
+ export class Value {
1181
+ /**
1182
+ * Returns a String representation of this value.
1183
+ *
1184
+ * @return A String representation of the value of this
1185
+ * property.
1186
+ * @throws ValueFormatException if conversion to a String is
1187
+ * not possible.
1188
+ * @throws IllegalStateException if getStream has previously
1189
+ * been called on this Value instance. In this case a new
1190
+ * Value instance must be acquired in order to successfully
1191
+ * call this method.
1192
+ * @throws RepositoryException if another error occurs.
1193
+ */
1194
+ getString(): string;
1195
+ /**
1196
+ * Returns a Binary representation of this value. The {@link
1197
+ * Binary} object in turn provides methods to access the binary data itself.
1198
+ * Uses the standard conversion to binary (see JCR specification).
1199
+ *
1200
+ * @return A Binary representation of this value.
1201
+ * @throws RepositoryException if an error occurs.
1202
+ * @since JCR 2.0
1203
+ */
1204
+ getBinary(): Binary;
1205
+ /**
1206
+ * Returns a long representation of this value.
1207
+ *
1208
+ * @return A long representation of this value.
1209
+ * @throws ValueFormatException if conversion to an long is not
1210
+ * possible.
1211
+ * @throws RepositoryException if another error occurs.
1212
+ */
1213
+ getLong(): number;
1214
+ /**
1215
+ * Returns a double representation of this value.
1216
+ *
1217
+ * @return A double representation of this value.
1218
+ * @throws ValueFormatException if conversion to a double is
1219
+ * not possible.
1220
+ * @throws RepositoryException if another error occurs.
1221
+ */
1222
+ getDouble(): number;
1223
+ /**
1224
+ * Returns a Boolean representation of this value.
1225
+ *
1226
+ * @return A Boolean representation of this value.
1227
+ * @throws ValueFormatException if conversion to a Boolean is
1228
+ * not possible.
1229
+ * @throws RepositoryException if another error occurs.
1230
+ */
1231
+ getBoolean(): boolean;
1232
+ /**
1233
+ * Returns the type of this Value. One of:
1234
+ * PropertyType.STRING PropertyType.DATE
1235
+ * PropertyType.BINARY PropertyType.DOUBLE
1236
+ * PropertyType.DECIMAL
1237
+ * PropertyType.LONG PropertyType.BOOLEAN
1238
+ * PropertyType.NAME PropertyType.PATH
1239
+ * PropertyType.REFERENCE PropertyType.WEAKREFERENCE
1240
+ * PropertyType.URI See {@link
1241
+ * PropertyType}.
1242
+ *
1243
+ * The type returned is that which was set at property creation.
1244
+ *
1245
+ * @return an int
1246
+ */
1247
+ getType(): number;
1248
+ }
1249
+
1250
+ }