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