Package org.springframework.extensions.jcr

Examples of org.springframework.extensions.jcr.JcrCallback


    } );
  }

  public static String addNode( final JcrTemplate jcrTemplate, final String parentAbsPath, final String name,
      final String primaryNodeTypeName ) {
    return (String) jcrTemplate.execute( new JcrCallback() {
      public String doInJcr( final Session session ) throws RepositoryException {
        PentahoJcrConstants pentahoJcrConstants = new PentahoJcrConstants( session );
        Node newNode;
        try {
          Item item = session.getItem( parentAbsPath );
View Full Code Here


      }
    } );
  }

  public static Item getItem( final JcrTemplate jcrTemplate, final String absPath ) {
    return (Item) jcrTemplate.execute( new JcrCallback() {
      public Object doInJcr( final Session session ) throws RepositoryException {
        Item item;
        try {
          item = session.getItem( absPath );
        } catch ( PathNotFoundException e ) {
View Full Code Here

      }
    } );
  }

  public static String getNodeId( final JcrTemplate jcrTemplate, final String absPath ) {
    return (String) jcrTemplate.execute( new JcrCallback() {
      public Object doInJcr( final Session session ) throws RepositoryException {
        Item item;
        try {
          item = session.getItem( absPath );
        } catch ( PathNotFoundException e ) {
View Full Code Here

      }
    } );
  }

  public static int getVersionCount( final JcrTemplate jcrTemplate, final String absPath ) {
    return (Integer) jcrTemplate.execute( new JcrCallback() {
      public Object doInJcr( final Session session ) throws RepositoryException {
        Node fileNode = (Node) session.getItem( absPath );
        VersionHistory versionHistory = fileNode.getVersionHistory();
        VersionIterator versionIterator = versionHistory.getAllVersions();
        int versionCount = 0;
View Full Code Here

      }
    } );
  }

  public static void printAccess( final JcrTemplate jcrTemplate, final String absPath ) {
    jcrTemplate.execute( new JcrCallback() {
      public Object doInJcr( final Session session ) throws RepositoryException {

        SessionImpl jrSession = (SessionImpl) session;
        AccessControlPolicy[] epols = jrSession.getAccessControlManager().getEffectivePolicies( absPath );
        AccessControlPolicy[] pols = jrSession.getAccessControlManager().getPolicies( absPath );
View Full Code Here

    } );
  }

  public static boolean hasPrivileges( final JcrTemplate jcrTemplate, final String absPath,
                                       final String... privNames ) {
    return (Boolean) jcrTemplate.execute( new JcrCallback() {
      public Object doInJcr( final Session session ) throws RepositoryException {
        Assert.notEmpty( privNames );
        Privilege[] privs = new Privilege[privNames.length];
        for ( int i = 0; i < privs.length; i++ ) {
          privs[i] = session.getAccessControlManager().privilegeFromName( privNames[i] );
View Full Code Here

    } );

  }

  public static boolean isLocked( final JcrTemplate jcrTemplate, final String absPath ) {
    return (Boolean) jcrTemplate.execute( new JcrCallback() {
      public Object doInJcr( final Session session ) throws RepositoryException {
        Item item = session.getItem( absPath );
        Assert.isTrue( item.isNode() );
        return ( (Node) item ).isLocked();
      }
View Full Code Here

      }
    } );
  }

  public static String getString( final JcrTemplate jcrTemplate, final String absPath ) {
    return (String) jcrTemplate.execute( new JcrCallback() {
      public Object doInJcr( final Session session ) throws RepositoryException {
        Item item = session.getItem( absPath );
        Assert.isTrue( !item.isNode() );
        return ( (Property) item ).getString();
      }
View Full Code Here

      }
    } );
  }

  public static Date getDate( final JcrTemplate jcrTemplate, final String absPath ) {
    return (Date) jcrTemplate.execute( new JcrCallback() {
      public Object doInJcr( final Session session ) throws RepositoryException {
        Item item = session.getItem( absPath );
        Assert.isTrue( !item.isNode() );
        return ( (Property) item ).getDate().getTime();
      }
View Full Code Here

      }
    } );
  }

  public static void setDate( final JcrTemplate jcrTemplate, final String absPath, final Date date ) {
    jcrTemplate.execute( new JcrCallback() {
      public Void doInJcr( final Session session ) throws RepositoryException {
        if ( !session.itemExists( absPath ) ) {
          int lastSlashIdx = absPath.lastIndexOf( '/' );
          String parentPath = absPath.substring( 0, lastSlashIdx );
          Node parentNode = (Node) session.getItem( parentPath );
View Full Code Here

TOP

Related Classes of org.springframework.extensions.jcr.JcrCallback

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.