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