View Javadoc
1   /**
2    * This file Copyright (c) 2003-2018 Magnolia International
3    * Ltd.  (http://www.magnolia-cms.com). All rights reserved.
4    *
5    *
6    * This file is dual-licensed under both the Magnolia
7    * Network Agreement and the GNU General Public License.
8    * You may elect to use one or the other of these licenses.
9    *
10   * This file is distributed in the hope that it will be
11   * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the
12   * implied warranty of MERCHANTABILITY or FITNESS FOR A
13   * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.
14   * Redistribution, except as permitted by whichever of the GPL
15   * or MNA you select, is prohibited.
16   *
17   * 1. For the GPL license (GPL), you can redistribute and/or
18   * modify this file under the terms of the GNU General
19   * Public License, Version 3, as published by the Free Software
20   * Foundation.  You should have received a copy of the GNU
21   * General Public License, Version 3 along with this program;
22   * if not, write to the Free Software Foundation, Inc., 51
23   * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24   *
25   * 2. For the Magnolia Network Agreement (MNA), this file
26   * and the accompanying materials are made available under the
27   * terms of the MNA which accompanies this distribution, and
28   * is available at http://www.magnolia-cms.com/mna.html
29   *
30   * Any modifications to this file must keep this entire header
31   * intact.
32   *
33   */
34  package info.magnolia.cms.core;
35  
36  import info.magnolia.cms.core.version.ContentVersion;
37  import info.magnolia.cms.security.AccessDeniedException;
38  import info.magnolia.cms.security.AccessManager;
39  import info.magnolia.cms.util.Rule;
40  
41  import java.io.InputStream;
42  import java.util.Calendar;
43  import java.util.Collection;
44  import java.util.Comparator;
45  
46  import javax.jcr.Node;
47  import javax.jcr.PathNotFoundException;
48  import javax.jcr.RepositoryException;
49  import javax.jcr.UnsupportedRepositoryOperationException;
50  import javax.jcr.Value;
51  import javax.jcr.Workspace;
52  import javax.jcr.lock.Lock;
53  import javax.jcr.lock.LockException;
54  import javax.jcr.nodetype.NodeType;
55  import javax.jcr.version.Version;
56  import javax.jcr.version.VersionException;
57  import javax.jcr.version.VersionHistory;
58  import javax.jcr.version.VersionIterator;
59  
60  
61  /**
62   * Represents a piece of content (node) which has nodedatas (properties) containing the values and
63   * which can have sub contents. This is is very similar to the JCR {@link Node} interface.
64   *
65   * @deprecated since 4.5 - use jcr.Node instead.
66   */
67  @Deprecated
68  public interface Content extends Cloneable {
69  
70      /**
71       * Gets the Content node of the current node with the specified name.
72       *
73       * @param name of the node acting as <code>Content</code>
74       * @throws RepositoryException if an error occurs
75       * @throws AccessDeniedException if the current session does not have sufficient access rights
76       * to complete the operation
77       */
78      Content getContent(String name) throws PathNotFoundException, RepositoryException, AccessDeniedException;
79  
80      /**
81       * Creates a Content node under the current node with the specified name. The default node type
82       * {@link ItemType#CONTENT} will be use as the contents primary type.
83       *
84       * @param name of the node to be created as <code>Content</code>
85       * @return newly created <code>Content</code>
86       * @throws RepositoryException if an error occurs
87       * @throws AccessDeniedException if the current session does not have sufficient access rights
88       * to complete the operation
89       */
90      Content createContent(String name) throws PathNotFoundException, RepositoryException, AccessDeniedException;
91  
92      /**
93       * Creates a Content node under the current node with the specified name.
94       *
95       * @param name of the node to be created as <code>Content</code>
96       * @param contentType JCR node type as configured
97       * @return newly created <code>Content</code>
98       * @throws RepositoryException if an error occurs
99       * @throws AccessDeniedException if the current session does not have sufficient access rights
100      * to complete the operation
101      */
102     Content createContent(String name, String contentType) throws PathNotFoundException, RepositoryException, AccessDeniedException;
103 
104     /**
105      * Creates a Content node under the current node with the specified name.
106      *
107      * @param name of the node to be created as <code>Content</code>
108      * @param contentType ItemType
109      * @return newly created <code>Content</code>
110      * @throws RepositoryException if an error occurs
111      * @throws AccessDeniedException if the current session does not have sufficient access rights
112      * to complete the operation
113      */
114     Content createContent(String name, ItemType contentType) throws PathNotFoundException, RepositoryException, AccessDeniedException;
115 
116     /**
117      * Returns the template name which is assigned to this content.
118      */
119     String getTemplate();
120 
121     /**
122      * @return String, title
123      */
124     String getTitle();
125 
126     /**
127      * Returns the meta data of the current node.
128      *
129      * @return MetaData meta information of the content <code>Node</code>
130      */
131     MetaData getMetaData();
132 
133     /**
134      * Returns a {@link NodeData} object. If the node data does not exist (respectively if it has no
135      * value) an empty representation is returned whose {@link NodeData#isExist()} will return
136      * false.
137      *
138      * @return NodeData requested <code>NodeData</code> object
139      */
140     NodeData getNodeData(String name);
141 
142     /**
143      * get node name.
144      *
145      * @return String name of the current <code>Node</code>
146      */
147     String getName();
148 
149     /**
150      * Creates a node data of type STRING with an empty String as default value.
151      *
152      * @deprecated since 4.3, as JCR only supports set or remove operations for properties we
153      *             recommend to use {@link #setNodeData(String, Object)} instead.
154      */
155     @Deprecated
156     NodeData createNodeData(String name) throws PathNotFoundException, RepositoryException, AccessDeniedException;
157 
158     /**
159      * Creates a node data of type with an default value set. If the no default value can be set
160      * (for BINARY, REFERENCE type) the returned node data will be empty and per definition not yet
161      * exist.
162      * <ul>
163      * <li> STRING: empty string
164      * <li> BOOLEAN: false
165      * <li> DATE: now
166      * <li> LONG/DOUBLE: 0
167      * </ul>
168      *
169      * @deprecated since 4.3, as JCR only supports set or remove operations for properties we
170      *             recommend to use {@link #setNodeData(String, Object)} instead.
171      */
172     @Deprecated
173     NodeData createNodeData(String name, int type) throws PathNotFoundException, RepositoryException, AccessDeniedException;
174 
175     /**
176      * Creates a node data setting the value.
177      *
178      * @throws AccessDeniedException if the current session does not have sufficient access rights
179      * to complete the operation
180      * @deprecated since 4.3, as JCR only supports set or remove operations for properties we
181      *             recommend to use {@link #setNodeData(String, Value)} instead.
182      */
183     @Deprecated
184     NodeData createNodeData(String name, Value value) throws PathNotFoundException, RepositoryException, AccessDeniedException;
185 
186     /**
187      * Create a multi value node data.
188      *
189      * @throws AccessDeniedException if the current session does not have sufficient access rights
190      * to complete the operation
191      * @deprecated since 4.3, as JCR only supports set or remove operations for properties we
192      *             recommend to use {@link #setNodeData(String, Value[])} instead.
193      */
194     @Deprecated
195     NodeData createNodeData(String name, Value[] value) throws PathNotFoundException, RepositoryException, AccessDeniedException;
196 
197     /**
198      * Creates a property and set its value immediately, according to the type of the passed
199      * instance, hiding the complexity of using JCR's ValueFactory and providing a sensible default
200      * behavior.
201      *
202      * @deprecated since 4.3, as JCR only supports set or remove operations for properties we
203      *             recommend to use {@link #setNodeData(String, Object)} instead.
204      */
205     @Deprecated
206     NodeData createNodeData(String name, Object obj) throws RepositoryException;
207 
208     /**
209      * Sets the node data. If the node data does not yet exist the node data is created. Setting
210      * null is not allowed
211      */
212     NodeData setNodeData(String name, Value value) throws PathNotFoundException, RepositoryException, AccessDeniedException;
213 
214     /**
215      * Sets the node data. If the node data does not yet exist the node data is created. Setting
216      * null is not allowed.
217      */
218     NodeData setNodeData(String name, Value[] value) throws PathNotFoundException, RepositoryException, AccessDeniedException;
219 
220     /**
221      * Sets the node data. If the node data does not yet exist the node data is created. Setting
222      * null is not allowed.
223      */
224     NodeData setNodeData(String name, String value) throws PathNotFoundException, RepositoryException, AccessDeniedException;
225 
226     /**
227      * Sets the node data. If the node data does not yet exist the node data is created. Setting
228      * null is not allowed.
229      */
230     NodeData setNodeData(String name, long value) throws PathNotFoundException, RepositoryException, AccessDeniedException;
231 
232     /**
233      * Sets the node data. If the node data does not yet exist the node data is created. Setting
234      * null is not allowed.
235      */
236     NodeData setNodeData(String name, InputStream value) throws PathNotFoundException, RepositoryException, AccessDeniedException;
237 
238     /**
239      * Sets the node data. If the node data does not yet exist the node data is created. Setting
240      * null will remove the node data.
241      */
242     NodeData setNodeData(String name, double value) throws PathNotFoundException, RepositoryException, AccessDeniedException;
243 
244     /**
245      * Sets the node data. If the node data does not yet exist the node data is created. Setting
246      * null will remove the node data.
247      */
248     NodeData setNodeData(String name, boolean value) throws PathNotFoundException, RepositoryException, AccessDeniedException;
249 
250     /**
251      * Sets the node data. If the node data does not yet exist the node data is created. Setting
252      * null will remove the node data.
253      */
254     NodeData setNodeData(String name, Calendar value) throws PathNotFoundException, RepositoryException, AccessDeniedException;
255 
256     /**
257      * Sets the node data. If the node data does not yet exist the node data is created. Setting
258      * null will remove the node data.
259      */
260     NodeData setNodeData(String name, Content value) throws PathNotFoundException, RepositoryException, AccessDeniedException;
261 
262     /**
263      * Sets the node data. If the node data does not yet exist the node data is created. Setting
264      * null will remove the node data.<br>
265      * The type of the node data will be determined by the type of the passed value
266      */
267     NodeData setNodeData(String name, Object value) throws PathNotFoundException, RepositoryException, AccessDeniedException;
268 
269     /**
270      * Delete NodeData with the specified name.
271      *
272      * @throws RepositoryException if an error occurs
273      */
274     void deleteNodeData(String name) throws PathNotFoundException, RepositoryException;
275 
276     /**
277      * You could call this method anytime to update working page properties - Modification date &
278      * Author ID.
279      *
280      * @throws AccessDeniedException if the current session does not have sufficient access rights
281      * to complete the operation
282      * @throws RepositoryException if an error occurs
283      */
284     void updateMetaData() throws RepositoryException, AccessDeniedException;
285 
286     /**
287      * Gets a Collection containing all child nodes of the same NodeType as "this" object.
288      *
289      * @return Collection of content objects
290      */
291     Collection<Content> getChildren();
292 
293     /**
294      * Get a collection containing child nodes which satisfies the given filter.
295      *
296      * @return Collection of content objects or empty collection when no children are found.
297      */
298     Collection<Content> getChildren(ContentFilter filter);
299 
300     /**
301      * Get a collection containing child nodes which satisfies the given filter. The returned
302      * collection is ordered according to the passed in criteria.
303      *
304      * @param filter filter for the child nodes
305      * @param orderCriteria ordering for the selected child nodes; if <tt>null</tt> than no
306      * particular order of the child nodes
307      * @return Collection of content objects or empty collection when no children are found.
308      */
309     Collection<Content> getChildren(ContentFilter filter, Comparator<Content> orderCriteria);
310 
311     /**
312      * Get collection of specified content type and its subtypes.
313      *
314      * @param contentType JCR node type as configured
315      * @return Collection of content nodes
316      */
317     Collection<Content> getChildren(String contentType);
318 
319     /**
320      * Get collection of specified content type.
321      *
322      * @param contentType ItemType
323      * @return Collection of content nodes
324      */
325     Collection<Content> getChildren(ItemType contentType);
326 
327     /**
328      * Get collection of specified content type.
329      *
330      * @param contentType JCR node type as configured
331      * @return Collection of content nodes
332      */
333     Collection<Content> getChildren(String contentType, String namePattern);
334 
335     /**
336      * Returns the first child with the given name, any node type.
337      *
338      * @param namePattern child node name
339      * @return first found node with the given name or <code>null</code> if not found
340      * @deprecated since 4.3, either use {@link #getContent(String)} or {@link #getChildren(String)}
341      */
342     @Deprecated
343     Content getChildByName(String namePattern);
344 
345     /**
346      * Gets all properties bind in NodeData object excluding JCR system properties.
347      */
348     Collection<NodeData> getNodeDataCollection();
349 
350     /**
351      * Gets all node datas matching the given pattern. If no pattern is given (null),
352      * gets all node datas.
353      */
354     Collection<NodeData> getNodeDataCollection(String namePattern);
355 
356     /**
357      * @return Boolean, if sub node(s) exists
358      */
359     boolean hasChildren();
360 
361     /**
362      * @param contentType JCR node type as configured
363      * @return Boolean, if sub <code>collectionType</code> exists
364      */
365     boolean hasChildren(String contentType);
366 
367     /**
368      * @throws RepositoryException if an error occurs
369      */
370     boolean hasContent(String name) throws RepositoryException;
371 
372     /**
373      * @throws RepositoryException if an error occurs
374      */
375     boolean hasNodeData(String name) throws RepositoryException;
376 
377     /**
378      * get a handle representing path relative to the content repository.
379      *
380      * @return String representing path (handle) of the content
381      */
382     String getHandle();
383 
384     /**
385      * get parent content object.
386      *
387      * @return Content representing parent node
388      * @throws AccessDeniedException if the current session does not have sufficient access rights
389      * to complete the operation
390      * @throws RepositoryException if an error occurs
391      */
392     Content getParent() throws PathNotFoundException, RepositoryException, AccessDeniedException;
393 
394     /**
395      * get absolute parent object starting from the root node.
396      *
397      * @param level level at which the requested node exist, relative to the ROOT node
398      * @return Content representing parent node
399      * @throws AccessDeniedException if the current session does not have sufficient access rights
400      * to complete the operation
401      * @throws RepositoryException if an error occurs
402      */
403     Content getAncestor(int level) throws PathNotFoundException, RepositoryException, AccessDeniedException;
404 
405     /**
406      * Convenience method for taglib.
407      *
408      * @return Content representing node on level 0
409      * @throws RepositoryException if an error occurs
410      */
411     Collection<Content> getAncestors() throws PathNotFoundException, RepositoryException;
412 
413     /**
414      * get node level from the ROOT node.
415      *
416      * @return level at which current node exist, relative to the ROOT node
417      * @throws RepositoryException if an error occurs
418      */
419     int getLevel() throws PathNotFoundException, RepositoryException;
420 
421     /**
422      * move current node to the specified location above the named <code>beforename</code>.
423      *
424      * @param srcName where current node has to be moved
425      * @param beforeName name of the node before the current node has to be placed
426      * @throws RepositoryException if an error occurs
427      */
428     void orderBefore(String srcName, String beforeName) throws RepositoryException;
429 
430     /**
431      * This method returns the index of this node within the ordered set of its same-name sibling
432      * nodes. This index is the one used to address same-name siblings using the square-bracket
433      * notation, e.g., /a[3]/b[4]. Note that the index always starts at 1 (not 0), for compatibility
434      * with XPath. As a result, for nodes that do not have same-name-siblings, this method will
435      * always return 1.
436      *
437      * @return The index of this node within the ordered set of its same-name sibling nodes.
438      * @throws RepositoryException if an error occurs
439      */
440     int getIndex() throws RepositoryException;
441 
442     /**
443      * utility method to get Node object used to create current content object.
444      */
445     Node getJCRNode();
446 
447     /**
448      * evaluate primary node type of the associated Node of this object.
449      */
450     boolean isNodeType(String type);
451 
452     /**
453      * returns primary node type definition of the associated Node of this object.
454      *
455      * @throws RepositoryException if an error occurs
456      */
457     NodeType getNodeType() throws RepositoryException;
458 
459     /**
460      * returns primary node type name of the associated Node of this object.
461      *
462      * @throws RepositoryException if an error occurs
463      */
464     String getNodeTypeName() throws RepositoryException;
465 
466     /**
467      * Get the magnolia ItemType.
468      *
469      * @return the type
470      */
471     ItemType getItemType() throws RepositoryException;
472 
473     /**
474      * Restores this node to the state defined by the version with the specified versionName.
475      *
476      * @throws VersionException if the specified <code>versionName</code> does not exist in this
477      * node's version history
478      * @throws RepositoryException if an error occurs
479      */
480     void restore(String versionName, boolean removeExisting) throws VersionException, UnsupportedRepositoryOperationException, RepositoryException;
481 
482     /**
483      * Restores this node to the state defined by the specified version.
484      *
485      * @throws VersionException if the specified <code>version</code> is not part of this node's
486      * version history
487      * @throws RepositoryException if an error occurs
488      */
489     void restore(Version version, boolean removeExisting) throws VersionException, UnsupportedRepositoryOperationException, RepositoryException;
490 
491     /**
492      * Restores the specified version to relPath, relative to this node.
493      *
494      * @throws VersionException if the specified <code>version</code> is not part of this node's
495      * version history
496      * @throws RepositoryException if an error occurs
497      */
498     void restore(Version version, String relPath, boolean removeExisting) throws VersionException, UnsupportedRepositoryOperationException, RepositoryException;
499 
500     /**
501      * Restores this node to the state recorded in the version specified by versionLabel.
502      *
503      * @throws VersionException if the specified <code>versionLabel</code> does not exist in this
504      * node's version history
505      * @throws RepositoryException if an error occurs
506      */
507     void restoreByLabel(String versionLabel, boolean removeExisting) throws VersionException, UnsupportedRepositoryOperationException, RepositoryException;
508 
509     /**
510      * add version leaving the node checked out.
511      *
512      * @throws RepositoryException if an error occurs
513      */
514     Version addVersion() throws UnsupportedRepositoryOperationException, RepositoryException;
515 
516     /**
517      * add version leaving the node checked out.
518      *
519      * @param rule to be used to collect content
520      * @throws RepositoryException if an error occurs
521      * @see info.magnolia.cms.util.Rule
522      */
523     Version addVersion(Rule rule) throws UnsupportedRepositoryOperationException, RepositoryException;
524 
525     /**
526      * Returns <code>true</code> if this <code>Item</code> has been saved but has subsequently been
527      * modified through the current session and therefore the state of this item as recorded in the
528      * session differs from the state of this item as saved. Within a transaction,
529      * <code>isModified</code> on an <code>Item</code> may return <code>false</code> (because the
530      * <code>Item</code> has been saved since the modification) even if the modification in question
531      * is not in persistent storage (because the transaction has not yet been committed).
532      * <p/>
533      * Note that in level 1 (that is, read-only) implementations, this method will always return
534      * <code>false</code>.
535      *
536      * @return <code>true</code> if this item is modified; <code>false</code> otherwise.
537      */
538     boolean isModified();
539 
540     /**
541      * @return version history
542      * @throws RepositoryException if an error occurs
543      */
544     VersionHistory getVersionHistory() throws UnsupportedRepositoryOperationException, RepositoryException;
545 
546     /**
547      * @return Version iterator retreived from version history
548      * @throws RepositoryException if an error occurs
549      */
550     VersionIterator getAllVersions() throws UnsupportedRepositoryOperationException, RepositoryException;
551 
552     /**
553      * get the current base version of this node.
554      *
555      * @return base ContentVersion
556      */
557     ContentVersion getBaseVersion() throws UnsupportedRepositoryOperationException, RepositoryException;
558 
559     /**
560      * get content view over the jcr version object.
561      *
562      * @return version object wrapped in ContentVersion
563      * @see info.magnolia.cms.core.version.ContentVersion
564      */
565     ContentVersion getVersionedContent(Version version) throws RepositoryException;
566 
567     /**
568      * get content view over the jcr version object.
569      *
570      * @return version object wrapped in ContentVersion
571      * @see info.magnolia.cms.core.version.ContentVersion
572      */
573     ContentVersion getVersionedContent(String versionName) throws RepositoryException;
574 
575     /**
576      * removes all versions of this node and associated version graph.
577      *
578      * @throws AccessDeniedException If not allowed to do write operations on this node
579      * @throws RepositoryException if unable to remove versions from version store
580      */
581     void removeVersionHistory() throws AccessDeniedException, RepositoryException;
582 
583     /**
584      * Persists all changes to the repository if validation succeeds.
585      *
586      * @throws RepositoryException if an error occurs
587      */
588     void save() throws RepositoryException;
589 
590     /**
591      * Checks for the allowed access rights.
592      *
593      * @param permissions as defined in javax.jcr.Permission
594      * @return <code>true</code> if the current user has specified access on this node.
595      * @deprecated since 4.5. Use {@link PermissionUtil#isGranted(String, String, long)} or {@link PermissionUtil#isGranted(javax.jcr.Session, String, String)} instead. To convert old style permissions to the new ones, please see {@link PermissionUtil#convertPermissions(long)}.
596      */
597     @Deprecated
598     boolean isGranted(long permissions);
599 
600     /**
601      * Remove this path.
602      *
603      * @throws RepositoryException if an error occurs
604      */
605     void delete() throws RepositoryException;
606 
607     /**
608      * Remove specified path.
609      *
610      * @throws RepositoryException if an error occurs
611      */
612     void delete(String path) throws RepositoryException;
613 
614     /**
615      * checks if the requested resource is an NodeData (Property).
616      *
617      * @param path of the requested NodeData
618      * @return boolean true is the requested content is an NodeData
619      * @throws AccessDeniedException if the current session does not have sufficient access rights
620      * to complete the operation
621      * @throws RepositoryException if an error occurs
622      */
623     boolean isNodeData(String path) throws AccessDeniedException, RepositoryException;
624 
625     /**
626      * If keepChanges is false, this method discards all pending changes recorded in this session.
627      *
628      * @throws RepositoryException if an error occurs
629      * @see javax.jcr.Node#refresh(boolean)
630      */
631     void refresh(boolean keepChanges) throws RepositoryException;
632 
633     /**
634      * UUID of the node referenced by this object.
635      */
636     String getUUID();
637 
638     /**
639      * add specified mixin type if allowed.
640      *
641      * @param type mixin type to be added
642      * @throws RepositoryException if an error occurs
643      */
644     void addMixin(String type) throws RepositoryException;
645 
646     /**
647      * Removes the specified mixin node type from this node. Also removes mixinName from this node's
648      * jcr:mixinTypes property. <strong>The mixin node type removal takes effect on save</strong>.
649      *
650      * @param type , mixin type to be removed
651      * @throws RepositoryException if an error occurs
652      */
653     void removeMixin(String type) throws RepositoryException;
654 
655     /**
656      * Returns an array of NodeType objects representing the mixin node types assigned to this node.
657      * This includes only those mixin types explicitly assigned to this node, and therefore listed
658      * in the property jcr:mixinTypes. It does not include mixin types inherited through the addition
659      * of supertypes to the primary type hierarchy.
660      *
661      * @return an array of mixin NodeType objects.
662      * @throws RepositoryException if an error occurs
663      */
664     NodeType[] getMixinNodeTypes() throws RepositoryException;
665 
666     /**
667      * places a lock on this object.
668      *
669      * @param isDeep if true this lock will apply to this node and all its descendants; if false, it
670      * applies only to this node.
671      * @param isSessionScoped if true, this lock expires with the current session; if false it
672      * expires when explicitly or automatically unlocked for some other reason.
673      * @return A Lock object containing a lock token.
674      * @throws LockException if this node is already locked or <code>isDeep</code> is true and a
675      * descendant node of this node already holds a lock.
676      * @throws RepositoryException if an error occurs
677      * @see javax.jcr.Node#lock(boolean, boolean)
678      */
679     Lock lock(boolean isDeep, boolean isSessionScoped) throws LockException, RepositoryException;
680 
681     /**
682      * places a lock on this object.
683      *
684      * @param isDeep if true this lock will apply to this node and all its descendants; if false, it
685      * applies only to this node.
686      * @param isSessionScoped if true, this lock expires with the current session; if false it
687      * expires when explicitly or automatically unlocked for some other reason.
688      * @param yieldFor number of milliseconds for which this method will try to get a lock
689      * @return A Lock object containing a lock token.
690      * @throws LockException if this node is already locked or <code>isDeep</code> is true and a
691      * descendant node of this node already holds a lock.
692      * @throws RepositoryException if an error occurs
693      * @see javax.jcr.Node#lock(boolean, boolean)
694      */
695     Lock lock(boolean isDeep, boolean isSessionScoped, long yieldFor) throws LockException, RepositoryException;
696 
697     /**
698      * Returns the Lock object that applies to this node. This may be either a lock on this node
699      * itself or a deep lock on a node above this node.
700      *
701      * @throws LockException If no lock applies to this node, a LockException is thrown.
702      * @throws RepositoryException if an error occurs
703      */
704     Lock getLock() throws LockException, RepositoryException;
705 
706     /**
707      * Removes the lock on this node. Also removes the properties jcr:lockOwner and jcr:lockIsDeep
708      * from this node. These changes are persisted automatically; <b>there is no need to call
709      * save</b>.
710      *
711      * @throws LockException if either does not currently hold a lock, or holds a lock for which
712      * this Session does not have the correct lock token
713      * @throws RepositoryException if an error occurs
714      */
715     void unlock() throws LockException, RepositoryException;
716 
717     /**
718      * Returns true if this node holds a lock; otherwise returns false. To hold a lock means that
719      * this node has actually had a lock placed on it specifically, as opposed to just having a lock
720      * apply to it due to a deep lock held by a node above.
721      *
722      * @return a boolean
723      * @throws RepositoryException if an error occurs
724      */
725     boolean holdsLock() throws RepositoryException;
726 
727     /**
728      * Returns true if this node is locked either as a result of a lock held by this node or by a
729      * deep lock on a node above this node; otherwise returns false.
730      *
731      * @return a boolean
732      * @throws RepositoryException if an error occurs
733      */
734     boolean isLocked() throws RepositoryException;
735 
736     /**
737      * get workspace to which this node attached to.
738      *
739      * @throws RepositoryException if unable to get this node session
740      */
741     Workspace getWorkspace() throws RepositoryException;
742 
743     /**
744      * @return the underlying AccessManager
745      * @deprecated since 4.0 - use getHierarchyManager instead
746      */
747     @Deprecated
748     AccessManager getAccessManager();
749 
750     HierarchyManager getHierarchyManager();
751 
752     /**
753      * checks if this node has a sub node with name MetaData.
754      *
755      * @return true if MetaData exists
756      */
757     boolean hasMetaData();
758 
759     /**
760      * Checks whether or not given mixin is assigned to a type.
761      */
762     public boolean hasMixin(String mixinName) throws RepositoryException;
763 
764     /**
765      * Implement this interface to be used as node filter by getChildren().
766      *
767      * @deprecated since 4.5 - use {@link org.apache.jackrabbit.commons.predicate.Predicate} instead.
768      */
769     @Deprecated
770     public interface ContentFilter {
771 
772         /**
773          * Test if this content should be included in a resultant collection.
774          *
775          * @return if true this will be a part of collection
776          */
777         public boolean accept(Content content);
778 
779     }
780 }