View Javadoc

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