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