Package javax.jcr

Examples of javax.jcr.Node.canAddMixin()


        // create a node that is lockable
        Node node = testRootNode.addNode(nodeName1, testNodeType);
        // or try to make it lockable if it is not
        if (!node.isNodeType(mixLockable)) {
            if (node.canAddMixin(mixLockable)) {
                node.addMixin(mixLockable);
            } else {
                throw new NotExecutableException("Node " + nodeName1 + " is not lockable and does not " +
                        "allow to add mix:lockable");
            }
View Full Code Here


        // create a node that is versionable
        Node node = testRootNode.addNode(nodeName1, testNodeType);
        // or try to make it versionable if it is not
        if (!node.isNodeType(mixVersionable)) {
            if (node.canAddMixin(mixVersionable)) {
                node.addMixin(mixVersionable);
            } else {
                throw new NotExecutableException("Node " + nodeName1 + " is not versionable and does not " +
                        "allow to add mix:versionable");
            }
View Full Code Here

        } catch (PathNotFoundException pnfe) {
            // ok
        }
        // a referenceable node
        Node n1 = testRootNode.addNode(name);
        if (n1.canAddMixin(mixReferenceable)) {
            n1.addMixin(mixReferenceable);
            // make sure jcr:uuid is available
            testRootNode.save();
            return n1;
        }
View Full Code Here

        Node node = testRootNode.addNode(nodeName4, nodeType);

        // try to make it versionable if it is not
        if (!node.isNodeType(mixVersionable)) {
            if (node.canAddMixin(mixVersionable)) {
                node.addMixin(mixVersionable);
            } else {
                throw new NotExecutableException("Failed to set up required test items.");
            }
        }
View Full Code Here

        Query query = superuser.getWorkspace().getQueryManager().createQuery(statement, Query.XPATH);
        // create a node that is versionable
        Node versionable = testRootNode.addNode(nodeName1, testNodeType);
        // or try to make it versionable if it is not
        if (!versionable.isNodeType(mixVersionable)) {
            if (versionable.canAddMixin(mixVersionable)) {
                versionable.addMixin(mixVersionable);
            } else {
                fail("Node " + nodeName1 + " is not versionable and does not allow to add mix:versionable");
            }
        }
View Full Code Here

        }
        // create a node that is lockable
        Node lockable = testRootNode.addNode(nodeName1, testNodeType);
        // or try to make it lockable if it is not
        if (!lockable.isNodeType(mixLockable)) {
            if (lockable.canAddMixin(mixLockable)) {
                lockable.addMixin(mixLockable);
            } else {
                fail("Node " + nodeName1 + " is not lockable and does not allow to add mix:lockable");
            }
        }
View Full Code Here

        } catch (PathNotFoundException pnfe) {
            // ok
        }
        // a referenceable node
        Node n1 = testRootNode.addNode(name, testNodeType);
        if (n1.canAddMixin(mixReferenceable)) {
            n1.addMixin(mixReferenceable);
            // make sure jcr:uuid is available
            testRootNode.save();
            return n1;
        }
View Full Code Here

        } catch (PathNotFoundException pnfe) {
            // ok
        }
        // a referenceable node
        Node n1 = testRootNode.addNode(name, testNodeType);
        if (!n1.isNodeType(mixReferenceable) && !n1.canAddMixin(mixReferenceable)) {
            n1.remove();
            session.save();
            throw new NotExecutableException("node type " + testNodeType +
                    " does not support mix:referenceable");
        }
View Full Code Here

         {
            Node node = (Node)session.getItem(path);

            if (!node.isNodeType("mix:lockable"))
            {
               if (node.canAddMixin("mix:lockable"))
               {
                  node.addMixin("mix:lockable");
                  session.save();
               }
            }
View Full Code Here

      content.setProperty("jcr:lastModified", Calendar.getInstance());
      content.setProperty("jcr:data", inputStream);

      for (String mixinName : mixins)
      {
         if (content.canAddMixin(mixinName))
         {
            content.addMixin(mixinName);
         }
      }
      node.getSession().save();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.