Package org.exoplatform.services.jcr.impl.core

Examples of org.exoplatform.services.jcr.impl.core.NodeImpl$PropertiesOrderComparator


    *
    * @throws Exception
    */
   public void testRead() throws Exception
   {
      NodeImpl node = (NodeImpl)accessTestRoot.addNode("testRead");
      // node.addMixin("exo:accessControllable");
      node.addMixin("exo:owneable");
      node.addMixin("exo:privilegeable");

      // change permission
      HashMap<String, String[]> perm = new HashMap<String, String[]>();
      perm.put("john", new String[]{PermissionType.READ});
      node.setPermissions(perm);
      node.addNode("node1");
      session.save();

      // ACL is:
      // Owner = exo
      // READ permissions for john
View Full Code Here


   public void testGetNodesByNodeType() throws Exception
   {
      root.addNode("simplenode", "nt:unstructured");

      Node doc1 = root.addNode("document1", "nt:file");
      NodeImpl cont = (NodeImpl)doc1.addNode("jcr:content", "nt:resource");
      cont.setProperty("jcr:mimeType", "text/plain");
      cont.setProperty("jcr:lastModified", Calendar.getInstance());
      cont.setProperty("jcr:encoding", "UTF-8");
      cont.setProperty("jcr:data", new ByteArrayInputStream("".getBytes()));

      Node doc2 = root.addNode("document2", "nt:file");
      cont = (NodeImpl)doc2.addNode("jcr:content", "nt:resource");
      cont.setProperty("jcr:mimeType", "text/plain");
      cont.setProperty("jcr:lastModified", Calendar.getInstance());
      cont.setProperty("jcr:encoding", "UTF-8");
      cont.setProperty("jcr:data", new ByteArrayInputStream("".getBytes()));

      session.save();

      // make SQL query
      QueryManager qman = this.workspace.getQueryManager();
View Full Code Here

      session1 = repository.login(new CredentialsImpl("john", "exo".toCharArray()));
      session1.getRootNode().getNode("accessTestRoot/testAddNode").addNode("legal");
      session1.save();

      NodeImpl addNode = (NodeImpl)session1.getRootNode().getNode("accessTestRoot/testAddNode");
      addNode.setProperty("illegal", "test");
      try
      {
         session1.save();
         fail("AccessDeniedException should have been thrown ");
      }
View Full Code Here

      node.setPermission("john", PermissionType.ALL);
      String owner = node.getACL().getOwner();
      assertEquals(8, node.getACL().getPermissionEntries().size());
      accessTestRoot.save();
      Session session1 = repository.login(new CredentialsImpl("john", "exo".toCharArray()));
      NodeImpl node1 = (NodeImpl)session1.getRootNode().getNode("accessTestRoot/testSetAndRemovePermission");
      assertEquals(8, node1.getACL().getPermissionEntries().size());
      assertEquals(node1.getACL().getOwner(), owner);

   }
View Full Code Here

      doc1.addMixin("mix:title");
      doc1.setProperty("jcr:title", "First document");

      Node doc2 = root.addNode("document1", "nt:file");
      doc2.addMixin("mix:lockable");
      NodeImpl cont = (NodeImpl)doc2.addNode("jcr:content", "nt:resource");
      cont.setProperty("jcr:mimeType", "text/plain");
      cont.setProperty("jcr:lastModified", Calendar.getInstance());
      cont.setProperty("jcr:encoding", "UTF-8");
      cont.setProperty("jcr:data", new ByteArrayInputStream("".getBytes()));

      Node doc3 = root.addNode("document2", "nt:file");
      doc3.addMixin("mix:title");
      doc3.setProperty("jcr:title", "Second document");
      cont = (NodeImpl)doc3.addNode("jcr:content", "nt:resource");
      cont.setProperty("jcr:mimeType", "text/plain");
      cont.setProperty("jcr:lastModified", Calendar.getInstance());
      cont.setProperty("jcr:encoding", "UTF-8");
      cont.setProperty("jcr:data", new ByteArrayInputStream("".getBytes()));

      session.save();

      // make SQL query
      QueryManager qman = this.workspace.getQueryManager();
View Full Code Here

      session1.save();
   }

   private void showPermissions(String path) throws RepositoryException
   {
      NodeImpl node = (NodeImpl)this.repository.getSystemSession().getRootNode().getNode(path);
      AccessControlList acl = node.getACL();
      if (log.isDebugEnabled())
      {
         log.debug("DUMP: " + acl.dump());
      }
View Full Code Here

      Node node2 = root.addNode("document2", "nt:file");
      node2.addMixin("mix:title");
      node2.setProperty("jcr:title", "Prison break");
      node2.setProperty("jcr:description", "Run, Forest, run ))");

      NodeImpl cont = (NodeImpl)node2.addNode("jcr:content", "nt:resource");
      cont.setProperty("jcr:mimeType", "text/plain");
      cont.setProperty("jcr:lastModified", Calendar.getInstance());
      cont.setProperty("jcr:data", "text");

      session.save();

      // make SQL query
      QueryManager qman = this.workspace.getQueryManager();
View Full Code Here

      doc2.addMixin("mix:title");
      doc2.setProperty("jcr:title", "Cinderella");
      doc2.setProperty("jcr:description", "fairytale");
      doc2.setProperty("jcr:pagecount", 100);

      NodeImpl cont = (NodeImpl)doc2.addNode("jcr:content", "nt:resource");
      cont.setProperty("jcr:mimeType", "text/plain");
      cont.setProperty("jcr:lastModified", Calendar.getInstance());
      cont.setProperty("jcr:data", "text");

      Node doc3 = root.addNode("document3", "nt:unstructured");
      doc3.addMixin("mix:title");
      doc3.setProperty("jcr:title", "Puss in Boots");
      doc3.setProperty("jcr:description", "fairytale");
View Full Code Here

      doc2.addMixin("mix:title");
      doc2.setProperty("jcr:title", "Cinderella");
      doc2.setProperty("jcr:description", "fairytale");
      doc2.setProperty("jcr:pagecount", 100);

      NodeImpl cont = (NodeImpl)doc2.addNode("jcr:content", "nt:resource");
      cont.setProperty("jcr:mimeType", "text/plain");
      cont.setProperty("jcr:lastModified", Calendar.getInstance());
      cont.setProperty("jcr:data", "text");

      Node doc3 = root.addNode("document3", "nt:unstructured");
      doc3.addMixin("mix:title");
      doc3.setProperty("jcr:title", "Puss in Boots");
      doc3.setProperty("jcr:description", "fairytale");
View Full Code Here

      assertEquals(node.getACL().getOwner(), "admin");
   }

   public void testAccessPermissionDuringCopy1() throws Exception
   {
      NodeImpl node = (NodeImpl)sessionWS1.getRootNode().addNode("srcNode");
      sessionWS1.save();

      assertEquals(node.getACL().getPermissions("mary").size(), 0);
      assertEquals(node.getACL().getOwner(), SystemIdentity.SYSTEM);

      // destination node has its own permissions and owner
      node = (NodeImpl)sessionWS1.getRootNode().addNode("dstNode");
      node.addMixin("exo:privilegeable");
      node.addMixin("exo:owneable");
      node.setPermission("mary", new String[]{"read", "add_node", "set_property", "remove"});
      sessionWS1.save();

      assertEquals(node.getACL().getPermissions("mary").size(), 4);
      assertEquals(node.getACL().getOwner(), "admin");

      // move node to new destination with new ACL
      sessionWS1.getWorkspace().copy("/srcNode", "/dstNode/newSrc");

      node = (NodeImpl)sessionWS1.getRootNode().getNode("dstNode/newSrc");

      // acl should be changed
      node = (NodeImpl)sessionWS1.getRootNode().getNode("dstNode/newSrc");
      assertEquals(node.getACL().getPermissions("mary").size(), 4);
      assertEquals(node.getACL().getOwner(), "admin");
   }
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.impl.core.NodeImpl$PropertiesOrderComparator

Copyright © 2018 www.massapicom. 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.