Examples of itemExists()


Examples of javax.jcr.Session.itemExists()

    private boolean getJcrBooleanProperty(String pNodePath, String pPropertName) {
        String absolutePropertyPath = pNodePath + "/" + pPropertName;
        Session session = resolver.adaptTo(Session.class);
        try {
            if (!session.itemExists(absolutePropertyPath)) {
                return false;
            }
            return session.getProperty(absolutePropertyPath).getBoolean();
        }
        catch (RepositoryException ex) {
View Full Code Here

Examples of javax.jcr.Session.itemExists()

        }

        final Session s = repository.loginAdministrative(null);
        try {
            for(String path : toDelete) {
                if(s.itemExists(path)) {
                    s.getItem(path).remove();
                }
            }
            s.save();
            toDelete.clear();
View Full Code Here

Examples of javax.jcr.Session.itemExists()

    @Test
    public void testAnonymousHasReadAccess() throws RepositoryException {
        final String path = assertCreateRetrieveNode(null);
        final Session s = repository.login();
        try {
            assertTrue("Expecting anonymous to see " + path, s.itemExists(path));
            final Node n = s.getNode(path);
            assertEquals("Expecting anonymous to see the foo property", path, n.getProperty("foo").getString());
        } finally {
            s.logout();
        }
View Full Code Here

Examples of javax.jcr.Session.itemExists()

    protected synchronized void initRepository() {
        if ( !this.initialized ) {
            Session session = null;
            try {
                session = this.repository.loginAdministrative(null);
                if ( !session.itemExists(this.rootNodePath) ) {
                    this.createNodePath(session.getRootNode(), this.rootNodePath.substring(1));
                    session.save();
                }
                try {
                    String prefix = session.getWorkspace().getNamespaceRegistry().getPrefix(this.namespace);
View Full Code Here

Examples of javax.jcr.Session.itemExists()

     */
    public PreferencesImpl load(BackingStoreManager manager, PreferencesDescription desc) throws BackingStoreException {
        final Session session = this.checkInitialized();
        try {
            final String path = this.getNodePath(desc);
            if ( session.itemExists(path) ) {
                final PreferencesImpl root = new PreferencesImpl(desc, manager);
                this.readTree(root, session, (Node)session.getItem(path));

                return root;
            }
View Full Code Here

Examples of javax.jcr.Session.itemExists()

        try {
            final List<PreferencesImpl> list = new ArrayList<PreferencesImpl>();
            // check for system preferences
            final PreferencesDescription systemDesc = new PreferencesDescription(bundleId, null);
            final String systemPath = this.getNodePath(systemDesc);
            if ( session.itemExists(systemPath) ) {
                final Node rootNode = (Node)session.getItem(systemPath);
                final PreferencesImpl root = new PreferencesImpl(systemDesc, manager);
                this.readTree(root, session, rootNode);
            }
            // user preferences
View Full Code Here

Examples of javax.jcr.Session.itemExists()

                final PreferencesImpl root = new PreferencesImpl(systemDesc, manager);
                this.readTree(root, session, rootNode);
            }
            // user preferences
            final String userPath = this.rootNodePath + '/' + bundleId + '/' + "users";
            if ( session.itemExists(userPath) ) {
                final NodeIterator iterator = ((Node)session.getItem(userPath)).getNodes();
                while ( iterator.hasNext() ) {
                    final Node current = iterator.nextNode();
                    final PreferencesDescription desc = new PreferencesDescription(bundleId, current.getName());
                    final PreferencesImpl root = new PreferencesImpl(desc, manager);
View Full Code Here

Examples of javax.jcr.Session.itemExists()

     */
    public void remove(Long bundleId) throws BackingStoreException {
        final Session session = this.checkInitialized();
        try {
            final String nodePath = this.rootNodePath + '/' + bundleId;
            if ( session.itemExists(nodePath) ) {
                final Node node = ((Node)session).getNode(nodePath);
                final Node parent = node.getParent();
                node.remove();
                parent.save();
            }
View Full Code Here

Examples of javax.jcr.Session.itemExists()

        Session session = null;
        try {
            if (replicationPackage != null) {
                session = getSession(resourceResolver);
                for (String path : replicationPackage.getPaths()) {
                    if (session.itemExists(path)) {
                        session.removeItem(path);
                    }
                }
                session.save();
                return true;
View Full Code Here

Examples of javax.jcr.Session.itemExists()

            HtmlResponse response, List<Modification> changes)
            throws RepositoryException {

        Session session = request.getResourceResolver().adaptTo(Session.class);
        String resourcePath = request.getResource().getPath();
        if (session.itemExists(resourcePath)) {
            Node source = (Node) session.getItem(resourcePath);

            // create a symetric link
            RequestParameter linkParam = request.getRequestParameter("target");
            if (linkParam != null) {
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.