@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,1463 @@
1
+ declare module 'org.jahia.services.content' {
2
+ import { ServletRequest } from 'javax.servlet';
3
+ import { Locale, List, Map, Date } from 'java.util';
4
+ import { HttpServletRequest } from 'javax.servlet.http';
5
+ import { QueryWrapper } from 'org.jahia.services.query';
6
+ import { JCRSiteNode } from 'org.jahia.services.content.decorator';
7
+ import { JahiaUser } from 'org.jahia.services.usermanager';
8
+ import { NodeIterator, Item, Node, PropertyIterator, Binary, Property } from 'javax.jcr';
9
+ export class JCRCallback<T> {
10
+ /**
11
+ * Called by {@link JCRTemplate} within an active JCR
12
+ * {@link javax.jcr.JCRSession}. It is not responsible for logging
13
+ * out of the Session or handling transactions.
14
+ *
15
+ * Allows for returning a result object created within the
16
+ * callback, i.e. a domain object or a collection of domain
17
+ * objects. A thrown {@link RuntimeException} is treated as an
18
+ * application exception; it is propagated to the caller of the
19
+ * template.
20
+ *
21
+ * @param session
22
+ * session passed by the JCRTemplate
23
+ * @return a result object returned by the action, or null
24
+ * @throws RepositoryException in case of JCR errors
25
+ */
26
+ doInJCR(session: JCRSessionWrapper): T;
27
+ }
28
+ /**
29
+ * Interface for wrappers around javax.jcr.Item to be able to inject
30
+ * Jahia specific actions.
31
+ *
32
+ * Jahia services should use this interface rather than the original to ensure that
33
+ * we manipulate wrapped nodes and not the ones from the underlying implementation
34
+ *
35
+ * @author toto
36
+ */
37
+ export class JCRItemWrapper {
38
+ /**
39
+ * {@inheritDoc}
40
+ * @return The wrapped ancestor of this
41
+ * Item at the specified depth.
42
+ */
43
+ getAncestor(depth: number): JCRItemWrapper;
44
+ /**
45
+ * {@inheritDoc}
46
+ * @return The wrapped parent of this Item.
47
+ */
48
+ getParent(): JCRNodeWrapper;
49
+ /**
50
+ * {@inheritDoc}
51
+ * @return the JCRSessionWrapper through which this Item was
52
+ * acquired.
53
+ */
54
+ getSession(): JCRSessionWrapper;
55
+ getCanonicalPath(): string;
56
+ /**
57
+ * Returns the normalized absolute path to this item.
58
+ *
59
+ * @return the normalized absolute path of this Item.
60
+ * @throws RepositoryException if an error occurs.
61
+ */
62
+ getPath(): string;
63
+ /**
64
+ * Returns the name of this Item in qualified form. If this
65
+ * Item is the root node of the workspace, an empty string is
66
+ * returned.
67
+ *
68
+ * @return the name of this Item in qualified form or an empty
69
+ * string if this Item is the root node of a
70
+ * workspace.
71
+ * @throws RepositoryException if an error occurs.
72
+ */
73
+ getName(): string;
74
+ /**
75
+ * Returns the depth of this Item in the workspace item graph.
76
+ * The root node returns 0. A property or child node of the
77
+ * root node returns 1. A property or child node of a child node of the
78
+ * root returns 2. And so on to this Item.
79
+ *
80
+ * @return The depth of this Item in the workspace item graph.
81
+ * @throws RepositoryException if an error occurs.
82
+ */
83
+ getDepth(): number;
84
+ /**
85
+ * Indicates whether this Item is a Node or a
86
+ * Property. Returns true if this
87
+ * Item is a Node; Returns false if
88
+ * this Item is a Property.
89
+ *
90
+ * @return true if this Item is a
91
+ * Node, false if it is a
92
+ * Property.
93
+ */
94
+ isNode(): boolean;
95
+ /**
96
+ * Returns true if this is a new item, meaning that it exists
97
+ * only in transient storage on the Session and has not yet
98
+ * been saved. Within a transaction, isNew on an
99
+ * Item may return false (because the item has
100
+ * been saved) even if that Item is not in persistent storage
101
+ * (because the transaction has not yet been committed).
102
+ *
103
+ * Note that if an item returns true on isNew,
104
+ * then by definition is parent will return true on
105
+ * isModified.
106
+ *
107
+ * Note that in read-only implementations, this method will always return
108
+ * false.
109
+ *
110
+ * @return true if this item is new; false
111
+ * otherwise.
112
+ */
113
+ isNew(): boolean;
114
+ /**
115
+ * Returns true if this Item has been saved but
116
+ * has subsequently been modified through the current session and therefore
117
+ * the state of this item as recorded in the session differs from the state
118
+ * of this item as saved. Within a transaction, isModified on
119
+ * an Item may return false (because the
120
+ * Item has been saved since the modification) even if the
121
+ * modification in question is not in persistent storage (because the
122
+ * transaction has not yet been committed).
123
+ *
124
+ * Note that in read-only implementations, this method will always return
125
+ * false.
126
+ *
127
+ * @return true if this item is modified; false
128
+ * otherwise.
129
+ */
130
+ isModified(): boolean;
131
+ /**
132
+ * Returns true if this Item object (the Java
133
+ * object instance) represents the same actual workspace item as the object
134
+ * otherItem.
135
+ *
136
+ * Two Item objects represent the same workspace item if and
137
+ * only if all the following are true: Both objects were acquired
138
+ * through Session objects that were created by the same
139
+ * Repository object. Both objects were acquired
140
+ * through Session objects bound to the same repository
141
+ * workspace. The objects are either both Node objects
142
+ * or both Property objects. If they are
143
+ * Node objects, they have the same identifier. If
144
+ * they are Property objects they have identical names and
145
+ * isSame is true of their parent nodes. This method
146
+ * does not compare the states of the two items. For example, if two
147
+ * Item objects representing the same actual workspace item
148
+ * have been retrieved through two different sessions and one has been
149
+ * modified, then this method will still return true when
150
+ * comparing these two objects. Note that if two Item objects
151
+ * representing the same workspace item are retrieved through the
152
+ * same session they will always reflect the same state.
153
+ *
154
+ * @param otherItem the Item object to be tested for identity
155
+ * with this Item.
156
+ * @return true if this Item object and
157
+ * otherItem represent the same actual repository item;
158
+ * false otherwise.
159
+ * @throws RepositoryException if an error occurs.
160
+ */
161
+ isSame(otherItem: Item): boolean;
162
+ }
163
+ /**
164
+ * @author Christophe Laprun
165
+ */
166
+ export class JCRNodeIteratorWrapper {
167
+ /**
168
+ * Returns the next Node in the iteration.
169
+ *
170
+ * @return the next Node in the iteration.
171
+ * @throws java.util.NoSuchElementException
172
+ * if iteration has no more
173
+ * Nodes.
174
+ */
175
+ nextNode(): Node;
176
+ /**
177
+ * Returns `true` if the iteration has more elements.
178
+ * (In other words, returns `true` if {@link #next} would
179
+ * return an element rather than throwing an exception.)
180
+ *
181
+ * @return `true` if the iteration has more elements
182
+ */
183
+ hasNext(): boolean;
184
+ }
185
+ /**
186
+ * Interface for wrappers around javax.jcr.Node to be able to inject
187
+ * Jahia specific actions.
188
+ *
189
+ * Jahia services should use this interface rather than the original to ensure that
190
+ * we manipulate wrapped nodes and not the ones from the underlying implementation
191
+ *
192
+ * @author toto
193
+ */
194
+ export class JCRNodeWrapper {
195
+ /**
196
+ * {@inheritDoc}
197
+ *
198
+ * @return The wrapped node at relPath.
199
+ */
200
+ getNode(relPath: string): JCRNodeWrapper;
201
+ /**
202
+ * {@inheritDoc}
203
+ *
204
+ * @return The wrapped property at relPath.
205
+ */
206
+ getProperty(relPath: string): JCRPropertyWrapper;
207
+ /**
208
+ * Checks if the current user has a permission or not
209
+ *
210
+ * @param perm The permission to check
211
+ * @return If the permission is allowed
212
+ */
213
+ hasPermission(perm: string): boolean;
214
+ /**
215
+ * Get the absolute file content url
216
+ *
217
+ * @param request the current request.
218
+ * @return the absolute file content url
219
+ */
220
+ getAbsoluteUrl(request: ServletRequest): string;
221
+ /**
222
+ * Get the file content url
223
+ *
224
+ * @return the file content url
225
+ */
226
+ getUrl(): string;
227
+ /**
228
+ * Get the file content url with optional params
229
+ *
230
+ * @return the file content url
231
+ */
232
+ getUrl(params: string[]): string;
233
+ /**
234
+ * Get the absolute webdav url
235
+ *
236
+ * @return the absolute webdav url
237
+ */
238
+ getAbsoluteWebdavUrl(request: HttpServletRequest): string;
239
+ /**
240
+ * Get the webdav url
241
+ *
242
+ * @return the webdav url
243
+ */
244
+ getWebdavUrl(): string;
245
+ /**
246
+ * Get the file content url for a specific thumbnail
247
+ *
248
+ * @param name The thumbnail name
249
+ * @return the file content url for a specific thumbnail
250
+ */
251
+ getThumbnailUrl(name: string): string;
252
+ /**
253
+ * Get a map of all available thumbnails and its URLs.
254
+ *
255
+ * @return a map of all available thumbnails and its URLs.
256
+ */
257
+ getThumbnailUrls(): Map<string, string>;
258
+ /**
259
+ * Returns a map of all property names of this node accessible through the current Session with the value as String.
260
+ *
261
+ * @return a map of all property names and its String values
262
+ * @throws RepositoryException in case of JCR-related errors
263
+ */
264
+ getPropertiesAsString(): Map<string, string>;
265
+ /**
266
+ * Returns the name of the primary node type in effect for this node.
267
+ *
268
+ * @return the name of the primary node type
269
+ * @throws RepositoryException in case of JCR-related errors
270
+ */
271
+ getPrimaryNodeTypeName(): string;
272
+ /**
273
+ * Returns a list holding the primary node type and all mixin node types for this node
274
+ *
275
+ * @return a list holding the primary node type and all mixin node types
276
+ * @throws RepositoryException in case of JCR-related errors
277
+ */
278
+ getNodeTypes(): string[];
279
+ /**
280
+ * Checks whether the current node is a collection node
281
+ *
282
+ * @return true if current node is a collection node
283
+ */
284
+ isCollection(): boolean;
285
+ /**
286
+ * Checks whether the current node is a file node
287
+ *
288
+ * @return true if current node is a file node
289
+ */
290
+ isFile(): boolean;
291
+ /**
292
+ * Checks whether the current node is a portlet node
293
+ *
294
+ * @return true if current node is a portlet node
295
+ */
296
+ isPortlet(): boolean;
297
+ /**
298
+ * Returns the last node modification date as Date object
299
+ *
300
+ * @return the last node modification date as Date object
301
+ */
302
+ getLastModifiedAsDate(): Date;
303
+ /**
304
+ * Returns the last node published date as Date object
305
+ *
306
+ * @return the last node published date as Date object
307
+ */
308
+ getLastPublishedAsDate(): Date;
309
+ /**
310
+ * Returns the last content modification date as Date object
311
+ *
312
+ * @return the last content modification date as Date object
313
+ */
314
+ getContentLastModifiedAsDate(): Date;
315
+ /**
316
+ * Returns the last content published date as Date object
317
+ *
318
+ * @return the last content published date as Date object
319
+ */
320
+ getContentLastPublishedAsDate(): Date;
321
+ /**
322
+ * Returns the node creation date as Date object
323
+ *
324
+ * @return the node creation date as Date object
325
+ */
326
+ getCreationDateAsDate(): Date;
327
+ /**
328
+ * Returns the user name who created this node
329
+ *
330
+ * @return the user name who created this node
331
+ */
332
+ getCreationUser(): string;
333
+ /**
334
+ * Returns the user name who last modified this node
335
+ *
336
+ * @return the user name who last modified this node
337
+ */
338
+ getModificationUser(): string;
339
+ /**
340
+ * Returns the user name who last published this node
341
+ *
342
+ * @return the user name who last published this node
343
+ */
344
+ getPublicationUser(): string;
345
+ /**
346
+ * Returns the language code of this node
347
+ *
348
+ * @return the language code of this node
349
+ */
350
+ getLanguage(): string;
351
+ /**
352
+ * Returns the property value as String at name relative to this
353
+ * node.
354
+ *
355
+ * @param name The relative path of the property to retrieve.
356
+ * @return the property value as String
357
+ */
358
+ getPropertyAsString(name: string): string;
359
+ /**
360
+ * Returns a list of all the ancestor of this item.
361
+ *
362
+ * @return a list of all the ancestor of this item.
363
+ * @throws RepositoryException in case of JCR-related errors
364
+ */
365
+ getAncestors(): JCRItemWrapper[];
366
+ /**
367
+ * {@inheritDoc}
368
+ */
369
+ isLocked(): boolean;
370
+ /**
371
+ * Checks whether the current file node has a mix:versionable mixin type applied
372
+ *
373
+ * @return whether current file has mix:versionable
374
+ */
375
+ isVersioned(): boolean;
376
+ /**
377
+ * Check whether the current node is of mixin type mix:lockable
378
+ *
379
+ * @return true if node can be locked
380
+ */
381
+ isLockable(): boolean;
382
+ /**
383
+ * {@inheritDoc}
384
+ */
385
+ getName(): string;
386
+ /**
387
+ * {@inheritDoc}
388
+ */
389
+ getPath(): string;
390
+ /**
391
+ * Returns available translation sub-nodes of this node.
392
+ *
393
+ * @return available translation sub-nodes of this node
394
+ * @throws RepositoryException in case of a JCR exception
395
+ */
396
+ getI18Ns(): NodeIterator;
397
+ /**
398
+ * Checks if the translation node exists
399
+ * Use only in un-localized session
400
+ *
401
+ * @param locale
402
+ * @return true if the translation node exists
403
+ * @throws RepositoryException in case of JCR-related errors
404
+ */
405
+ hasI18N(locale: Locale): boolean;
406
+ /**
407
+ * Checks if the translation node exists
408
+ * Use only in un-localized session
409
+ *
410
+ * @param locale the locale for which we want to check if a translation exists
411
+ * @param fallback whether or not we should fallback on the default locale if we didn't find an exact translation
412
+ * @return true if the translation node exists
413
+ * @throws RepositoryException in case of JCR-related errors
414
+ */
415
+ hasI18N(locale: Locale, fallback: boolean): boolean;
416
+ /**
417
+ * Retrieves the list of locales available on a node.
418
+ *
419
+ * @return a list of the locales that exist on this node.
420
+ * @throws RepositoryException in case of JCR-related errors
421
+ */
422
+ getExistingLocales(): Locale[];
423
+ getResolveSite(): JCRSiteNode;
424
+ hasTranslations(): boolean;
425
+ getDisplayableName(): string;
426
+ /**
427
+ * Returns true if this node is marked for deletion.
428
+ *
429
+ * @return true if this node is marked for deletion.
430
+ * @throws RepositoryException in case of a repository access error
431
+ */
432
+ isMarkedForDeletion(): boolean;
433
+ /**
434
+ * Returns all child nodes of this node accessible through the current
435
+ * Session. Does not include properties of this
436
+ * Node. The same reacquisition semantics apply as with {@link
437
+ * #getNode(String)}. If this node has no accessible child nodes, then an
438
+ * empty iterator is returned.
439
+ *
440
+ * @return A NodeIterator over all child Nodes of
441
+ * this Node.
442
+ * @throws RepositoryException if an error occurs.
443
+ */
444
+ getNodes(): JCRNodeIteratorWrapper;
445
+ /**
446
+ * Gets all child nodes of this node accessible through the current
447
+ * Session that match namePattern. The pattern may
448
+ * be a full name or a partial name with one or more wildcard characters
449
+ * ("*"), or a disjunction (using the "|"
450
+ * character to represent logical OR) of these. For example,
451
+ *
452
+ * N.getNodes("jcr:* | myapp:report | my doc")
453
+ *
454
+ * would return a NodeIterator holding all accessible child
455
+ * nodes of N that are either called 'myapp:report',
456
+ * begin with the prefix 'jcr:' or are called 'my
457
+ * doc'.
458
+ *
459
+ * The substrings within the pattern that are delimited by "|"
460
+ * characters and which may contain wildcard characters ("*")
461
+ * are called globs.
462
+ *
463
+ * Note that leading and trailing whitespace around a glob is ignored, but
464
+ * whitespace within a disjunct forms part of the pattern to be matched.
465
+ *
466
+ * The pattern is matched against the names (not the paths) of the immediate
467
+ * child nodes of this node.
468
+ *
469
+ * If this node has no accessible matching child nodes, then an empty
470
+ * iterator is returned.
471
+ *
472
+ * The same reacquisition semantics apply as with {@link
473
+ * #getNode(String)}.
474
+ *
475
+ * @param namePattern a name pattern.
476
+ * @return a NodeIterator.
477
+ * @throws RepositoryException if an unexpected error occurs.
478
+ */
479
+ getNodes(namePattern: string): JCRNodeIteratorWrapper;
480
+ /**
481
+ * Gets all child nodes of this node accessible through the current
482
+ * Session that match one or more of the nameGlob
483
+ * strings in the passed array.
484
+ *
485
+ * A glob may be a full name or a partial name with one or more wildcard
486
+ * characters ("*"). For example,
487
+ *
488
+ * N.getNodes(new String[] {"jcr:*", "myapp:report", "my
489
+ * doc"})
490
+ *
491
+ * would return a NodeIterator holding all accessible child
492
+ * nodes of N that are either called 'myapp:report',
493
+ * begin with the prefix 'jcr:' or are called 'my
494
+ * doc'.
495
+ *
496
+ * Note that unlike in the case of the {@link #getNodes(String)} leading and
497
+ * trailing whitespace around a glob is not ignored.
498
+ *
499
+ * The globs are matched against the names (not the paths) of the immediate
500
+ * child nodes of this node.
501
+ *
502
+ * If this node has no accessible matching child nodes, then an empty
503
+ * iterator is returned.
504
+ *
505
+ * The same reacquisition semantics apply as with {@link
506
+ * #getNode(String)}.
507
+ *
508
+ * @param nameGlobs an array of globbing strings.
509
+ * @return a NodeIterator.
510
+ * @throws RepositoryException if an unexpected error occurs.
511
+ * @since JCR 2.0
512
+ */
513
+ getNodes(nameGlobs: string[]): JCRNodeIteratorWrapper;
514
+ /**
515
+ * Returns all properties of this node accessible through the current
516
+ * Session. Does not include child nodes of this
517
+ * node. The same reacquisition semantics apply as with {@link
518
+ * #getNode(String)}. If this node has no accessible properties, then
519
+ * an empty iterator is returned.
520
+ *
521
+ * @return A PropertyIterator.
522
+ * @throws RepositoryException if an error occurs.
523
+ */
524
+ getProperties(): PropertyIterator;
525
+ /**
526
+ * Gets all properties of this node accessible through the current
527
+ * Session that match namePattern. The pattern may
528
+ * be a full name or a partial name with one or more wildcard characters
529
+ * ("*"), or a disjunction (using the "|"
530
+ * character to represent logical OR) of these. For example,
531
+ *
532
+ * N.getProperties("jcr:* | myapp:name | my doc")
533
+ *
534
+ * would return a PropertyIterator holding all accessible
535
+ * properties of N that are either called
536
+ * 'myapp:name', begin with the prefix 'jcr:' or
537
+ * are called 'my doc'.
538
+ *
539
+ *
540
+ * The substrings within the pattern that are delimited by "|"
541
+ * characters and which may contain wildcard characters ("*")
542
+ * are called globs.
543
+ *
544
+ * Note that leading and trailing whitespace around a glob is ignored, but
545
+ * whitespace within a disjunct forms part of the pattern to be matched.
546
+ *
547
+ * The pattern is matched against the names (not the paths) of the immediate
548
+ * child properties of this node.
549
+ *
550
+ * If this node has no accessible matching properties, then an empty
551
+ * iterator is returned.
552
+ *
553
+ * The same reacquisition semantics apply as with {@link
554
+ * #getNode(String)}.
555
+ *
556
+ * @param namePattern a name pattern.
557
+ * @return a PropertyIterator.
558
+ * @throws RepositoryException if an unexpected error occurs.
559
+ */
560
+ getProperties(namePattern: string): PropertyIterator;
561
+ /**
562
+ * Gets all properties of this node accessible through the current
563
+ * Session that match one or more of the nameGlob
564
+ * strings in the passed array.
565
+ *
566
+ * A glob may be a full name or a partial name with one or more wildcard
567
+ * characters ("*"). For example,
568
+ *
569
+ * N.getProperties(new String[] {"jcr:*", "myapp:report", "my
570
+ * doc"})
571
+ *
572
+ * would return a PropertyIterator holding all accessible
573
+ * properties of N that are either called
574
+ * 'myapp:report', begin with the prefix 'jcr:' or
575
+ * are called 'my doc'.
576
+ *
577
+ * Note that unlike in the case of the {@link #getProperties(String)}
578
+ * leading and trailing whitespace around a glob is not ignored.
579
+ *
580
+ * The globs are matched against the names (not the paths) of the properties
581
+ * of this node.
582
+ *
583
+ * If this node has no accessible matching properties, then an empty
584
+ * iterator is returned.
585
+ *
586
+ * The same reacquisition semantics apply as with {@link
587
+ * #getProperty(String)}.
588
+ *
589
+ * @param nameGlobs an array of globbing strings.
590
+ * @return a PropertyIterator.
591
+ * @throws RepositoryException if an unexpected error occurs.
592
+ * @since JCR 2.0
593
+ */
594
+ getProperties(nameGlobs: string[]): PropertyIterator;
595
+ /**
596
+ * Returns the UUID of this node as recorded in this node's
597
+ * jcr:uuid property. This method only works on nodes of mixin
598
+ * node type mix:referenceable.
599
+ *
600
+ * On nonreferenceable nodes, this method throws an UnsupportedRepositoryOperationException.
601
+ * To avoid throwing an exception to determine whether a node has a UUID, a
602
+ * call to {@link #isNodeType(String) isNodeType("mix:referenceable")} can
603
+ * be made.
604
+ *
605
+ * @return the UUID of this node.
606
+ * @throws UnsupportedRepositoryOperationException
607
+ * if this node
608
+ * nonreferenceable.
609
+ * @throws RepositoryException if another error occurs.
610
+ * @deprecated As of JCR 2.0, {@link #getIdentifier()} should be used
611
+ * instead.
612
+ */
613
+ getUUID(): string;
614
+ /**
615
+ * Returns the identifier of this node. Applies to both referenceable and
616
+ * non-referenceable nodes.
617
+ *
618
+ * A RepositoryException is thrown if an error occurs.
619
+ *
620
+ * @return the identifier of this node.
621
+ * @throws RepositoryException if an error occurs.
622
+ * @since JCR 2.0
623
+ */
624
+ getIdentifier(): string;
625
+ /**
626
+ * This method returns all REFERENCE properties that refer to
627
+ * this node and that are accessible through the current
628
+ * Session. Equivalent to Node.getReferences(null).
629
+ *
630
+ * If this node has no referring REFERENCE properties, an
631
+ * empty iterator is returned. This includes the case where this node is not referenceable.
632
+ *
633
+ * @return A PropertyIterator.
634
+ * @throws RepositoryException if an error occurs.
635
+ * @see #getReferences(String).
636
+ */
637
+ getReferences(): PropertyIterator;
638
+ /**
639
+ * This method returns all REFERENCE properties that refer to
640
+ * this node, have the specified name and that are accessible
641
+ * through the current Session.
642
+ *
643
+ * If the name parameter is null then all
644
+ * referring REFERENCES are returned regardless of name.
645
+ *
646
+ * Some implementations may only return properties that have been persisted.
647
+ * Some may return both properties that have been persisted and those that
648
+ * have been dispatched but not persisted (for example, those saved within a
649
+ * transaction but not yet committed) while others implementations may
650
+ * return these two categories of property as well as properties that are
651
+ * still pending and not yet dispatched.
652
+ *
653
+ * In implementations that support versioning, this method does not return
654
+ * properties that are part of the frozen state of a version in version
655
+ * storage.
656
+ *
657
+ * If this node has no referring REFERENCE properties with the specified name, an
658
+ * empty iterator is returned. This includes the case where this node is not referenceable.
659
+ *
660
+ * @param name name of referring REFERENCE properties to be
661
+ * returned; if null then all referring REFERENCEs
662
+ * are returned.
663
+ * @return A PropertyIterator.
664
+ * @throws RepositoryException if an error occurs.
665
+ * @since JCR 2.0
666
+ */
667
+ getReferences(name: string): PropertyIterator;
668
+ /**
669
+ * This method returns all WEAKREFERENCE properties that refer
670
+ * to this node and that are accessible through the current
671
+ * Session. Equivalent to Node.getWeakReferences(null).
672
+ *
673
+ * If this node has no referring WEAKREFERENCE properties, an
674
+ * empty iterator is returned. This includes the case where this node is not referenceable.
675
+ *
676
+ * @return A PropertyIterator.
677
+ * @throws RepositoryException if an error occurs.
678
+ * @see #getWeakReferences(String).
679
+ * @since JCR 2.0
680
+ */
681
+ getWeakReferences(): PropertyIterator;
682
+ /**
683
+ * This method returns all WEAKREFERENCE properties that refer
684
+ * to this node, have the specified name and that are
685
+ * accessible through the current Session.
686
+ *
687
+ * If the name parameter is null then all
688
+ * referring WEAKREFERENCE are returned regardless of name.
689
+ *
690
+ * Some implementations may only return properties that have been persisted.
691
+ * Some may return both properties that have been persisted and those that
692
+ * have been dispatched but not persisted (for example, those saved within a
693
+ * transaction but not yet committed) while others implementations may
694
+ * return these two categories of property as well as properties that are
695
+ * still pending and not yet dispatched.
696
+ *
697
+ * In implementations that support versioning, this method does not return
698
+ * properties that are part of the frozen state of a version in version
699
+ * storage.
700
+ *
701
+ * If this node has no referring WEAKREFERENCE properties with the specified name, an
702
+ * empty iterator is returned. This includes the case where this node is not referenceable.
703
+ *
704
+ * @param name name of referring WEAKREFERENCE properties to be
705
+ * returned; if null then all referring
706
+ * WEAKREFERENCEs are returned.
707
+ * @return A PropertyIterator.
708
+ * @throws RepositoryException if an error occurs.
709
+ * @since JCR 2.0
710
+ */
711
+ getWeakReferences(name: string): PropertyIterator;
712
+ /**
713
+ * Indicates whether a node exists at relPath Returns
714
+ * true if a node accessible through the current
715
+ * Session exists at relPath and
716
+ * false otherwise.
717
+ *
718
+ * @param relPath The path of a (possible) node.
719
+ * @return true if a node exists at relPath;
720
+ * false otherwise.
721
+ * @throws RepositoryException if an error occurs.
722
+ */
723
+ hasNode(relPath: string): boolean;
724
+ /**
725
+ * Indicates whether a property exists at relPath Returns
726
+ * true if a property accessible through the current
727
+ * Session exists at relPath and
728
+ * false otherwise.
729
+ *
730
+ * @param relPath The path of a (possible) property.
731
+ * @return true if a property exists at relPath;
732
+ * false otherwise.
733
+ * @throws RepositoryException if an error occurs.
734
+ */
735
+ hasProperty(relPath: string): boolean;
736
+ /**
737
+ * Indicates whether this node has child nodes. Returns true if
738
+ * this node has one or more child nodes accessible through the current
739
+ * Session; false otherwise.
740
+ *
741
+ * @return true if this node has one or more child nodes;
742
+ * false otherwise.
743
+ * @throws RepositoryException if an error occurs.
744
+ */
745
+ hasNodes(): boolean;
746
+ /**
747
+ * Indicates whether this node has properties. Returns true if
748
+ * this node has one or more properties accessible through the current
749
+ * Session; false otherwise.
750
+ *
751
+ * @return true if this node has one or more properties;
752
+ * false otherwise.
753
+ * @throws RepositoryException if an error occurs.
754
+ */
755
+ hasProperties(): boolean;
756
+ /**
757
+ * Returns true if this node is of the specified primary node
758
+ * type or mixin type, or a subtype thereof. Returns false
759
+ * otherwise.
760
+ *
761
+ * This method respects the effective node type of the node.
762
+ *
763
+ * @param nodeTypeName the name of a node type.
764
+ * @return true If this node is of the specified primary node
765
+ * type or mixin type, or a subtype thereof. Returns
766
+ * false otherwise.
767
+ * @throws RepositoryException if an error occurs.
768
+ */
769
+ isNodeType(nodeTypeName: string): boolean;
770
+ /**
771
+ * Returns false if this node is currently in the checked-in state
772
+ * (either due to its own status as a versionable node or due to the effect of
773
+ * a versionable node being checked in above it). Otherwise this method returns
774
+ * true. This includes the case where the repository does not
775
+ * support versioning (and therefore all nodes are always "checked-out",
776
+ * by default).
777
+ *
778
+ * @return a boolean
779
+ * @throws RepositoryException if an error occurs.
780
+ */
781
+ isCheckedOut(): boolean;
782
+ /**
783
+ * Returns the ancestor of this Item at the specified depth. An
784
+ * ancestor of depth x is the Item that is x
785
+ * levels down along the path from the root node to this
786
+ * Item. depth = 0 returns the root node of a
787
+ * workspace. depth = 1 returns the child of the root node along
788
+ * the path to this Item. depth = 2 returns
789
+ * the grandchild of the root node along the path to this
790
+ * Item. And so on to depth = n, where
791
+ * n is the depth of this Item, which returns
792
+ * this Item itself.
793
+ *
794
+ * If this node has more than one path (i.e., if it is a descendant of a
795
+ * shared node) then the path used to define the ancestor is
796
+ * implementaion-dependent.
797
+ *
798
+ * @param depth An integer, 0 <= depth <= n where
799
+ * n is the depth of this Item.
800
+ * @return The ancestor of this Item at the specified
801
+ * depth.
802
+ * @throws ItemNotFoundException if depth < 0 or depth >
803
+ * n where n is the is the depth of this item.
804
+ * @throws AccessDeniedException if the current session does not have
805
+ * sufficent access to retrieve the specified node.
806
+ * @throws RepositoryException if another error occurs.
807
+ */
808
+ getAncestor(depth: number): Item;
809
+ /**
810
+ * Returns the parent of this Item.
811
+ *
812
+ * @return The parent of this Item.
813
+ * @throws ItemNotFoundException if this Item is the root node
814
+ * of a workspace.
815
+ * @throws AccessDeniedException if the current session does not have
816
+ * sufficent access to retrieve the parent of this item.
817
+ * @throws RepositoryException if another error occurs.
818
+ */
819
+ getParent(): Node;
820
+ /**
821
+ * Indicates whether this Item is a Node or a
822
+ * Property. Returns true if this
823
+ * Item is a Node; Returns false if
824
+ * this Item is a Property.
825
+ *
826
+ * @return true if this Item is a
827
+ * Node, false if it is a
828
+ * Property.
829
+ */
830
+ isNode(): boolean;
831
+ /**
832
+ * Returns true if this is a new item, meaning that it exists
833
+ * only in transient storage on the Session and has not yet
834
+ * been saved. Within a transaction, isNew on an
835
+ * Item may return false (because the item has
836
+ * been saved) even if that Item is not in persistent storage
837
+ * (because the transaction has not yet been committed).
838
+ *
839
+ * Note that if an item returns true on isNew,
840
+ * then by definition is parent will return true on
841
+ * isModified.
842
+ *
843
+ * Note that in read-only implementations, this method will always return
844
+ * false.
845
+ *
846
+ * @return true if this item is new; false
847
+ * otherwise.
848
+ */
849
+ isNew(): boolean;
850
+ /**
851
+ * Returns true if this Item has been saved but
852
+ * has subsequently been modified through the current session and therefore
853
+ * the state of this item as recorded in the session differs from the state
854
+ * of this item as saved. Within a transaction, isModified on
855
+ * an Item may return false (because the
856
+ * Item has been saved since the modification) even if the
857
+ * modification in question is not in persistent storage (because the
858
+ * transaction has not yet been committed).
859
+ *
860
+ * Note that in read-only implementations, this method will always return
861
+ * false.
862
+ *
863
+ * @return true if this item is modified; false
864
+ * otherwise.
865
+ */
866
+ isModified(): boolean;
867
+ /**
868
+ * Returns true if this Item object (the Java
869
+ * object instance) represents the same actual workspace item as the object
870
+ * otherItem.
871
+ *
872
+ * Two Item objects represent the same workspace item if and
873
+ * only if all the following are true: Both objects were acquired
874
+ * through Session objects that were created by the same
875
+ * Repository object. Both objects were acquired
876
+ * through Session objects bound to the same repository
877
+ * workspace. The objects are either both Node objects
878
+ * or both Property objects. If they are
879
+ * Node objects, they have the same identifier. If
880
+ * they are Property objects they have identical names and
881
+ * isSame is true of their parent nodes. This method
882
+ * does not compare the states of the two items. For example, if two
883
+ * Item objects representing the same actual workspace item
884
+ * have been retrieved through two different sessions and one has been
885
+ * modified, then this method will still return true when
886
+ * comparing these two objects. Note that if two Item objects
887
+ * representing the same workspace item are retrieved through the
888
+ * same session they will always reflect the same state.
889
+ *
890
+ * @param otherItem the Item object to be tested for identity
891
+ * with this Item.
892
+ * @return true if this Item object and
893
+ * otherItem represent the same actual repository item;
894
+ * false otherwise.
895
+ * @throws RepositoryException if an error occurs.
896
+ */
897
+ isSame(otherItem: Item): boolean;
898
+ /**
899
+ * {@inheritDoc}
900
+ * @return the JCRSessionWrapper through which this Item was
901
+ * acquired.
902
+ */
903
+ getSession(): JCRSessionWrapper;
904
+ getCanonicalPath(): string;
905
+ }
906
+ /**
907
+ * Interface for wrappers for javax.jcr.property to allow more data format.
908
+ *
909
+ * @author : toto
910
+ */
911
+ export class JCRPropertyWrapper {
912
+ /**
913
+ * Returns the value of this property as a Value object.
914
+ *
915
+ * The object returned is a copy of the stored value and is immutable.
916
+ *
917
+ * @return the Value.
918
+ * @throws ValueFormatException if the property is multi-valued.
919
+ * @throws RepositoryException if another error occurs.
920
+ */
921
+ getValue(): JCRValueWrapper;
922
+ /**
923
+ * Returns an array of all the values of this property. Used to access
924
+ * multi-value properties. The array returned is a copy of the stored
925
+ * values, so changes to it are not reflected in internal storage.
926
+ *
927
+ * @return a Value array.
928
+ * @throws ValueFormatException if the property is single-valued.
929
+ * @throws RepositoryException if another error occurs.
930
+ */
931
+ getValues(): JCRValueWrapper[];
932
+ /**
933
+ * @return
934
+ * @throws ValueFormatException
935
+ * @throws RepositoryException in case of JCR-related errors
936
+ */
937
+ getRealValue(): JCRValueWrapper;
938
+ /**
939
+ * @return
940
+ * @throws ValueFormatException
941
+ * @throws RepositoryException in case of JCR-related errors
942
+ */
943
+ getRealValues(): JCRValueWrapper[];
944
+ getContextualizedNode(): JCRNodeWrapper;
945
+ getLocale(): string;
946
+ /**
947
+ * Gets the real Property wrapped by this JCRPropertyWrapper
948
+ *
949
+ * @return the real JCR Property
950
+ */
951
+ getRealProperty(): Property;
952
+ /**
953
+ * Returns a String representation of the value of this
954
+ * property. A shortcut for Property.getValue().getString().
955
+ *
956
+ * @return A string representation of the value of this property.
957
+ * @throws ValueFormatException if conversion to a String is
958
+ * not possible or if the property is multi-valued.
959
+ * @throws RepositoryException if another error occurs.
960
+ * @see Value
961
+ */
962
+ getString(): string;
963
+ /**
964
+ * Returns a Binary representation of the value of this
965
+ * property. A shortcut for Property.getValue().getBinary().
966
+ *
967
+ * @return A Binary representation of the value of this
968
+ * property.
969
+ * @throws ValueFormatException if the property is multi-valued.
970
+ * @throws RepositoryException if another error occurs.
971
+ * @see Value
972
+ * @see Binary
973
+ * @since JCR 2.0
974
+ */
975
+ getBinary(): Binary;
976
+ /**
977
+ * Returns a long representation of the value of this property.
978
+ * A shortcut for Property.getValue().getLong().
979
+ *
980
+ * @return A long representation of the value of this
981
+ * property.
982
+ * @throws ValueFormatException if conversion to a long is not
983
+ * possible or if the property is multi-valued.
984
+ * @throws RepositoryException if another error occurs.
985
+ * @see Value
986
+ */
987
+ getLong(): number;
988
+ /**
989
+ * Returns a double representation of the value of this
990
+ * property. A shortcut for Property.getValue().getDouble().
991
+ *
992
+ * @return A double representation of the value of this
993
+ * property.
994
+ * @throws ValueFormatException if conversion to a double is
995
+ * not possible or if the property is multi-valued.
996
+ * @throws RepositoryException if another error occurs.
997
+ * @see Value
998
+ */
999
+ getDouble(): number;
1000
+ /**
1001
+ * Returns a boolean representation of the value of this
1002
+ * property. A shortcut for Property.getValue().getBoolean().
1003
+ *
1004
+ * @return A boolean representation of the value of this
1005
+ * property.
1006
+ * @throws ValueFormatException if conversion to a boolean is
1007
+ * not possible or if the property is multi-valued.
1008
+ * @throws RepositoryException if another error occurs.
1009
+ * @see Value
1010
+ */
1011
+ getBoolean(): boolean;
1012
+ /**
1013
+ * If this property is of type REFERENCE,
1014
+ * WEAKREFERENCE or PATH (or convertible to one of
1015
+ * these types) this method returns the Node to which this
1016
+ * property refers.
1017
+ *
1018
+ * If this property is of type PATH and it contains a relative
1019
+ * path, it is interpreted relative to the parent node of this property. For
1020
+ * example "." refers to the parent node itself,
1021
+ * ".." to the parent of the parent node and "foo"
1022
+ * to a sibling node of this property.
1023
+ *
1024
+ * @return the referenced Node
1025
+ * @throws ValueFormatException if this property cannot be converted to a
1026
+ * referring type (REFERENCE, WEAKREFERENCE or
1027
+ * PATH), if the property is multi-valued or if this property
1028
+ * is a referring type but is currently part of the frozen state of a
1029
+ * version in version storage.
1030
+ * @throws ItemNotFoundException If this property is of type
1031
+ * PATH or WEAKREFERENCE and no target node
1032
+ * accessible by the current Session exists in this workspace.
1033
+ * Note that this applies even if the property is a PATHS and a
1034
+ * property exists at the specified location. To dereference to a
1035
+ * target property (as opposed to a target node), the method
1036
+ * Property.getProperty is used.
1037
+ * @throws RepositoryException if another error occurs.
1038
+ */
1039
+ getNode(): Node;
1040
+ /**
1041
+ * If this property is of type PATH (or convertible to this
1042
+ * type) this method returns the Property to which this
1043
+ * property refers.
1044
+ *
1045
+ * If this property contains a relative path, it is interpreted relative to
1046
+ * the parent node of this property. Therefore, when resolving such a
1047
+ * relative path, the segment "." refers to
1048
+ * the parent node itself, ".." to the parent of the parent
1049
+ * node and "foo" to a sibling property of this property or
1050
+ * this property itself.
1051
+ *
1052
+ * For example, if this property is located at
1053
+ * /a/b/c and it has a value of "../d" then this
1054
+ * method will return the property at /a/d if such exists.
1055
+ *
1056
+ * If this property is multi-valued, this method throws a
1057
+ * ValueFormatException.
1058
+ *
1059
+ * If this property cannot be converted to a PATH then a
1060
+ * ValueFormatException is thrown.
1061
+ *
1062
+ * If this property is currently part of the frozen state of a version in
1063
+ * version storage, this method will throw a ValueFormatException.
1064
+ *
1065
+ * @return the referenced property
1066
+ * @throws ValueFormatException if this property cannot be converted to a
1067
+ * PATH, if the property is multi-valued or if this property is
1068
+ * a referring type but is currently part of the frozen state of a version
1069
+ * in version storage.
1070
+ * @throws ItemNotFoundException If no property accessible by the current
1071
+ * Session exists in this workspace at the specified path. Note
1072
+ * that this applies even if a node exists at the specified location.
1073
+ * To dereference to a target node, the method Property.getNode
1074
+ * is used.
1075
+ * @throws RepositoryException if another error occurs.
1076
+ * @since JCR 2.0
1077
+ */
1078
+ getProperty(): Property;
1079
+ /**
1080
+ * Returns the length of the value of this property.
1081
+ *
1082
+ * For a BINARY property, getLength returns the
1083
+ * number of bytes. For other property types, getLength returns
1084
+ * the same value that would be returned by calling {@link
1085
+ * java.lang.String#length()} on the value when it has been converted to a
1086
+ * STRING according to standard JCR property type conversion.
1087
+ *
1088
+ * Returns -1 if the implementation cannot determine the length.
1089
+ *
1090
+ * @return an long.
1091
+ * @throws ValueFormatException if this property is multi-valued.
1092
+ * @throws RepositoryException if another error occurs.
1093
+ */
1094
+ getLength(): number;
1095
+ /**
1096
+ * Returns an array holding the lengths of the values of this (multi-value)
1097
+ * property in bytes where each is individually calculated as described in
1098
+ * {@link #getLength()}.
1099
+ *
1100
+ * Returns a -1 in the appropriate position if the
1101
+ * implementation cannot determine the length of a value.
1102
+ *
1103
+ * @return an array of lengths
1104
+ * @throws ValueFormatException if this property is single-valued.
1105
+ * @throws RepositoryException if another error occurs.
1106
+ */
1107
+ getLengths(): number[];
1108
+ /**
1109
+ * Returns the type of this Property. One of:
1110
+ * PropertyType.STRING PropertyType.BINARY
1111
+ * PropertyType.DATE PropertyType.DOUBLE
1112
+ * PropertyType.LONG PropertyType.BOOLEAN
1113
+ * PropertyType.NAME PropertyType.PATH
1114
+ * PropertyType.REFERENCE PropertyType.WEAKREFERENCE
1115
+ * PropertyType.URI The type returned is that
1116
+ * which was set at property creation. Note that for some property
1117
+ * p, the type returned by p.getType() will differ
1118
+ * from the type returned by p.getDefinition.getRequiredType()
1119
+ * only in the case where the latter returns UNDEFINED. The
1120
+ * type of a property instance is never UNDEFINED (it must
1121
+ * always have some actual type).
1122
+ *
1123
+ * @return an int
1124
+ * @throws RepositoryException if an error occurs
1125
+ */
1126
+ getType(): number;
1127
+ /**
1128
+ * Returns true if this property is multi-valued and
1129
+ * false if this property is single-valued.
1130
+ *
1131
+ * @return true if this property is multi-valued;
1132
+ * false otherwise.
1133
+ * @throws RepositoryException if an error occurs.
1134
+ */
1135
+ isMultiple(): boolean;
1136
+ /**
1137
+ * Returns the normalized absolute path to this item.
1138
+ *
1139
+ * @return the normalized absolute path of this Item.
1140
+ * @throws RepositoryException if an error occurs.
1141
+ */
1142
+ getPath(): string;
1143
+ /**
1144
+ * Returns the name of this Item in qualified form. If this
1145
+ * Item is the root node of the workspace, an empty string is
1146
+ * returned.
1147
+ *
1148
+ * @return the name of this Item in qualified form or an empty
1149
+ * string if this Item is the root node of a
1150
+ * workspace.
1151
+ * @throws RepositoryException if an error occurs.
1152
+ */
1153
+ getName(): string;
1154
+ /**
1155
+ * Returns the ancestor of this Item at the specified depth. An
1156
+ * ancestor of depth x is the Item that is x
1157
+ * levels down along the path from the root node to this
1158
+ * Item. depth = 0 returns the root node of a
1159
+ * workspace. depth = 1 returns the child of the root node along
1160
+ * the path to this Item. depth = 2 returns
1161
+ * the grandchild of the root node along the path to this
1162
+ * Item. And so on to depth = n, where
1163
+ * n is the depth of this Item, which returns
1164
+ * this Item itself.
1165
+ *
1166
+ * If this node has more than one path (i.e., if it is a descendant of a
1167
+ * shared node) then the path used to define the ancestor is
1168
+ * implementaion-dependent.
1169
+ *
1170
+ * @param depth An integer, 0 <= depth <= n where
1171
+ * n is the depth of this Item.
1172
+ * @return The ancestor of this Item at the specified
1173
+ * depth.
1174
+ * @throws ItemNotFoundException if depth < 0 or depth >
1175
+ * n where n is the is the depth of this item.
1176
+ * @throws AccessDeniedException if the current session does not have
1177
+ * sufficent access to retrieve the specified node.
1178
+ * @throws RepositoryException if another error occurs.
1179
+ */
1180
+ getAncestor(depth: number): Item;
1181
+ /**
1182
+ * Returns the parent of this Item.
1183
+ *
1184
+ * @return The parent of this Item.
1185
+ * @throws ItemNotFoundException if this Item is the root node
1186
+ * of a workspace.
1187
+ * @throws AccessDeniedException if the current session does not have
1188
+ * sufficent access to retrieve the parent of this item.
1189
+ * @throws RepositoryException if another error occurs.
1190
+ */
1191
+ getParent(): Node;
1192
+ /**
1193
+ * Returns the depth of this Item in the workspace item graph.
1194
+ * The root node returns 0. A property or child node of the
1195
+ * root node returns 1. A property or child node of a child node of the
1196
+ * root returns 2. And so on to this Item.
1197
+ *
1198
+ * @return The depth of this Item in the workspace item graph.
1199
+ * @throws RepositoryException if an error occurs.
1200
+ */
1201
+ getDepth(): number;
1202
+ /**
1203
+ * Indicates whether this Item is a Node or a
1204
+ * Property. Returns true if this
1205
+ * Item is a Node; Returns false if
1206
+ * this Item is a Property.
1207
+ *
1208
+ * @return true if this Item is a
1209
+ * Node, false if it is a
1210
+ * Property.
1211
+ */
1212
+ isNode(): boolean;
1213
+ /**
1214
+ * Returns true if this is a new item, meaning that it exists
1215
+ * only in transient storage on the Session and has not yet
1216
+ * been saved. Within a transaction, isNew on an
1217
+ * Item may return false (because the item has
1218
+ * been saved) even if that Item is not in persistent storage
1219
+ * (because the transaction has not yet been committed).
1220
+ *
1221
+ * Note that if an item returns true on isNew,
1222
+ * then by definition is parent will return true on
1223
+ * isModified.
1224
+ *
1225
+ * Note that in read-only implementations, this method will always return
1226
+ * false.
1227
+ *
1228
+ * @return true if this item is new; false
1229
+ * otherwise.
1230
+ */
1231
+ isNew(): boolean;
1232
+ /**
1233
+ * Returns true if this Item has been saved but
1234
+ * has subsequently been modified through the current session and therefore
1235
+ * the state of this item as recorded in the session differs from the state
1236
+ * of this item as saved. Within a transaction, isModified on
1237
+ * an Item may return false (because the
1238
+ * Item has been saved since the modification) even if the
1239
+ * modification in question is not in persistent storage (because the
1240
+ * transaction has not yet been committed).
1241
+ *
1242
+ * Note that in read-only implementations, this method will always return
1243
+ * false.
1244
+ *
1245
+ * @return true if this item is modified; false
1246
+ * otherwise.
1247
+ */
1248
+ isModified(): boolean;
1249
+ /**
1250
+ * Returns true if this Item object (the Java
1251
+ * object instance) represents the same actual workspace item as the object
1252
+ * otherItem.
1253
+ *
1254
+ * Two Item objects represent the same workspace item if and
1255
+ * only if all the following are true: Both objects were acquired
1256
+ * through Session objects that were created by the same
1257
+ * Repository object. Both objects were acquired
1258
+ * through Session objects bound to the same repository
1259
+ * workspace. The objects are either both Node objects
1260
+ * or both Property objects. If they are
1261
+ * Node objects, they have the same identifier. If
1262
+ * they are Property objects they have identical names and
1263
+ * isSame is true of their parent nodes. This method
1264
+ * does not compare the states of the two items. For example, if two
1265
+ * Item objects representing the same actual workspace item
1266
+ * have been retrieved through two different sessions and one has been
1267
+ * modified, then this method will still return true when
1268
+ * comparing these two objects. Note that if two Item objects
1269
+ * representing the same workspace item are retrieved through the
1270
+ * same session they will always reflect the same state.
1271
+ *
1272
+ * @param otherItem the Item object to be tested for identity
1273
+ * with this Item.
1274
+ * @return true if this Item object and
1275
+ * otherItem represent the same actual repository item;
1276
+ * false otherwise.
1277
+ * @throws RepositoryException if an error occurs.
1278
+ */
1279
+ isSame(otherItem: Item): boolean;
1280
+ /**
1281
+ * {@inheritDoc}
1282
+ * @return the JCRSessionWrapper through which this Item was
1283
+ * acquired.
1284
+ */
1285
+ getSession(): JCRSessionWrapper;
1286
+ getCanonicalPath(): string;
1287
+ }
1288
+ /**
1289
+ * Jahia specific wrapper around javax.jcr.Session to be able to inject
1290
+ * Jahia specific actions and to manage sessions to multiple repository providers in
1291
+ * the backend.
1292
+ *
1293
+ * Jahia services should use this wrapper rather than the original session interface to
1294
+ * ensure that we manipulate wrapped nodes and not the ones from the underlying
1295
+ * implementation.
1296
+ *
1297
+ * @author toto
1298
+ */
1299
+ export class JCRSessionWrapper {
1300
+ getRootNode(): JCRNodeWrapper;
1301
+ getUserID(): string;
1302
+ getAttribute(s: string): any;
1303
+ getAttributeNames(): string[];
1304
+ getWorkspace(): JCRWorkspaceWrapper;
1305
+ getLocale(): Locale;
1306
+ getNodeByUUID(uuid: string): JCRNodeWrapper;
1307
+ getNodeByUUID(uuid: string, checkVersion: boolean): JCRNodeWrapper;
1308
+ getNodeByUUID(providerKey: string, uuid: string): JCRNodeWrapper;
1309
+ getItem(path: string): JCRItemWrapper;
1310
+ getItem(path: string, checkVersion: boolean): JCRItemWrapper;
1311
+ getNode(path: string): JCRNodeWrapper;
1312
+ getNode(path: string, checkVersion: boolean): JCRNodeWrapper;
1313
+ getUser(): JahiaUser;
1314
+ getNodeByIdentifier(id: string): JCRNodeWrapper;
1315
+ getProperty(absPath: string): Property;
1316
+ nodeExists(absPath: string): boolean;
1317
+ propertyExists(absPath: string): boolean;
1318
+ getFallbackLocale(): Locale;
1319
+ getIdentifier(): string;
1320
+ }
1321
+ /**
1322
+ * This is a wrapper for interface {@link javax.jcr.Value} to allow more types of properties.
1323
+ *
1324
+ * @author Cedric Mailleux
1325
+ * @since 6.1
1326
+ */
1327
+ export class JCRValueWrapper {
1328
+ /**
1329
+ * Returns a Date representation of the Calendar's time of this value.
1330
+ *
1331
+ * The object returned is a copy of the stored value, so changes to it are
1332
+ * not reflected in internal storage.
1333
+ *
1334
+ * @return A Date representation of this value.
1335
+ * @throws ValueFormatException if conversion to a Date is
1336
+ * not possible.
1337
+ * @throws RepositoryException if another error occurs.
1338
+ */
1339
+ getTime(): Date;
1340
+ /**
1341
+ * Returns a JCRNodeWrapper instance referred by this value. The property has to be one of the following
1342
+ * types PropertyType.STRING PropertyType.REFERENCE
1343
+ * PropertyType.WEAKREFERENCE
1344
+ *
1345
+ * For other types a ValueFormatException is thrown. If the reference in the value cannot be resolved to an existing node,
1346
+ * the method returns null.
1347
+ *
1348
+ * @return A JCRNodeWrapper referred by the value of this
1349
+ * property.
1350
+ * @throws ValueFormatException if conversion to a JCRNodeWrapper is
1351
+ * not possible.
1352
+ * @throws IllegalStateException if getStream has previously
1353
+ * been called on this Value instance. In this case a new
1354
+ * Value instance must be acquired in order to successfully
1355
+ * call this method.
1356
+ * @throws RepositoryException if another error occurs.
1357
+ */
1358
+ getNode(): JCRNodeWrapper;
1359
+ /**
1360
+ * Returns a String representation of this value.
1361
+ *
1362
+ * @return A String representation of the value of this
1363
+ * property.
1364
+ * @throws ValueFormatException if conversion to a String is
1365
+ * not possible.
1366
+ * @throws IllegalStateException if getStream has previously
1367
+ * been called on this Value instance. In this case a new
1368
+ * Value instance must be acquired in order to successfully
1369
+ * call this method.
1370
+ * @throws RepositoryException if another error occurs.
1371
+ */
1372
+ getString(): string;
1373
+ /**
1374
+ * Returns a Binary representation of this value. The {@link
1375
+ * Binary} object in turn provides methods to access the binary data itself.
1376
+ * Uses the standard conversion to binary (see JCR specification).
1377
+ *
1378
+ * @return A Binary representation of this value.
1379
+ * @throws RepositoryException if an error occurs.
1380
+ * @since JCR 2.0
1381
+ */
1382
+ getBinary(): Binary;
1383
+ /**
1384
+ * Returns a long representation of this value.
1385
+ *
1386
+ * @return A long representation of this value.
1387
+ * @throws ValueFormatException if conversion to an long is not
1388
+ * possible.
1389
+ * @throws RepositoryException if another error occurs.
1390
+ */
1391
+ getLong(): number;
1392
+ /**
1393
+ * Returns a double representation of this value.
1394
+ *
1395
+ * @return A double representation of this value.
1396
+ * @throws ValueFormatException if conversion to a double is
1397
+ * not possible.
1398
+ * @throws RepositoryException if another error occurs.
1399
+ */
1400
+ getDouble(): number;
1401
+ /**
1402
+ * Returns a Boolean representation of this value.
1403
+ *
1404
+ * @return A Boolean representation of this value.
1405
+ * @throws ValueFormatException if conversion to a Boolean is
1406
+ * not possible.
1407
+ * @throws RepositoryException if another error occurs.
1408
+ */
1409
+ getBoolean(): boolean;
1410
+ /**
1411
+ * Returns the type of this Value. One of:
1412
+ * PropertyType.STRING PropertyType.DATE
1413
+ * PropertyType.BINARY PropertyType.DOUBLE
1414
+ * PropertyType.DECIMAL
1415
+ * PropertyType.LONG PropertyType.BOOLEAN
1416
+ * PropertyType.NAME PropertyType.PATH
1417
+ * PropertyType.REFERENCE PropertyType.WEAKREFERENCE
1418
+ * PropertyType.URI See {@link
1419
+ * PropertyType}.
1420
+ *
1421
+ * The type returned is that which was set at property creation.
1422
+ *
1423
+ * @return an int
1424
+ */
1425
+ getType(): number;
1426
+ }
1427
+ /**
1428
+ * Jahia specific wrapper around javax.jcr.Workspace to be able to inject
1429
+ * Jahia specific actions and to manage workspaces on multiple repository providers in
1430
+ * the backend.
1431
+ *
1432
+ * Jahia services should use this wrapper rather than the original workspace interface to
1433
+ * ensure that we manipulate wrapped nodes and not the ones from the underlying
1434
+ * implementation.
1435
+ *
1436
+ * @author toto
1437
+ */
1438
+ export class JCRWorkspaceWrapper {
1439
+ getSession(): JCRSessionWrapper;
1440
+ getName(): string;
1441
+ getQueryManager(): QueryManagerWrapper;
1442
+ }
1443
+ /**
1444
+ * Extension of the QueryManager interface, with wrapped return types
1445
+ */
1446
+ export class QueryManagerWrapper {
1447
+ /**
1448
+ * Creates a new query by specifying the query statement itself
1449
+ * and the language in which the query is stated. The
1450
+ * language must be a string from among those returned by
1451
+ * QueryManager.getSupportedQueryLanguages().
1452
+ *
1453
+ * @param statement a String
1454
+ * @param language a String
1455
+ * @return a Query object
1456
+ * @throws javax.jcr.query.InvalidQueryException if the query statement is syntactically
1457
+ * invalid or the specified language is not supported.
1458
+ * @throws javax.jcr.RepositoryException if another error occurs.
1459
+ */
1460
+ createQuery(statement: string, language: string): QueryWrapper;
1461
+ }
1462
+
1463
+ }