Package javax.jcr

Examples of javax.jcr.Item


        Node node3 = session.getNode("/node1/node3");
        assertEquals("/node1/node3", node3.getPath());

        node3.setProperty("property1", "value1");
        Item property1 = session.getProperty("/node1/node3/property1");
        assertFalse(property1.isNode());
        assertEquals("value1", ((Property) property1).getString());

        // Make sure these items are still accessible after refresh(true);
        session.refresh(true);
        assertTrue(session.itemExists("/node1"));
View Full Code Here


        NodeImpl n = null;
        // shortcut that avoids executing a query.
        if (principal instanceof ItemBasedPrincipal) {
            String authPath = ((ItemBasedPrincipal) principal).getPath();
            if (session.itemExists(authPath)) {
                Item authItem = session.getItem(authPath);
                if (authItem.isNode()) {
                    n = (NodeImpl) authItem;
                }
            }
        } else {
            // another Principal implementation.
View Full Code Here

            String jcrPath = session.getJCRPath(absPath);

            // retrieve principal-based permissions and privileges
            Result result;
            if (session.itemExists(jcrPath)) {
                Item item = session.getItem(jcrPath);
                result = getResult(item, item.getPath(), isAcItem);
            } else {
                result = getResult(null, jcrPath, isAcItem);
            }
            return result;
        }
View Full Code Here

        String adminId = ((UserPerWorkspaceSecurityManager) secMgr).adminId;
        UserManager umgr = ((JackrabbitSession) superuser).getUserManager();
        Principal p = umgr.getAuthorizable(adminId).getPrincipal();

        if (p instanceof ItemBasedPrincipal) {
            Item item = superuser.getItem(((ItemBasedPrincipal) p).getPath());
            assertFalse(item.isNew());
            assertFalse(item.isModified());
        }
    }
View Full Code Here

        this.filter = config.getItemFilter();
        this.ioManager = config.getIOManager();

        if (locator != null && locator.getResourcePath() != null) {
            try {
                Item item = getJcrSession().getItem(locator.getRepositoryPath());
                if (item != null && item.isNode()) {
                    node = (Node) item;
                    // define what is a collection in webdav
                    isCollection = config.isCollectionResource(node);
                }
            } catch (PathNotFoundException e) {
View Full Code Here

        }


        try {
            String itemPath = member.getLocator().getRepositoryPath();
            Item memItem = getJcrSession().getItem(itemPath);
            memItem.remove();
            getJcrSession().save();

            // make sure, non-jcr locks are removed, once the removal is completed
            try {
                if (!isJsrLockable()) {
View Full Code Here

                contains a Label header, the corresponding Version must be used
                instead.*/
                if (request instanceof DeltaVServletRequest && isVersionControlled(resource)) {
                    String labelHeader = ((DeltaVServletRequest)request).getLabel();
                    if (labelHeader != null && DavMethods.isMethodAffectedByLabel(request)) {
                        Item item = getItem(session, locator);
                        Version v = ((Node)item).getVersionHistory().getVersionByLabel(labelHeader);
                        DavResourceLocator vloc = locator.getFactory().createResourceLocator(locator.getPrefix(), locator.getWorkspacePath(), v.getPath(), false);
                        resource =  new VersionItemCollection(vloc, session, this, v);
                    }
                }
View Full Code Here

     * @return DavResource representing a repository item.
     * @throws RepositoryException if {@link javax.jcr.Session#getItem(String)} fails.
     */
    private DavResource createResourceForItem(DavResourceLocator locator, JcrDavSession sessionImpl) throws RepositoryException, DavException {
        DavResource resource;
        Item item = getItem(sessionImpl, locator);
        if (item.isNode()) {
            // create special resources for Version and VersionHistory
            if (item instanceof Version) {
                resource = new VersionItemCollection(locator, sessionImpl, this, item);
            } else if (item instanceof VersionHistory) {
                resource = new VersionHistoryItemCollection(locator, sessionImpl, this, item);
            } else if (ItemResourceConstants.ROOT_ITEM_PATH.equals(item.getPath())) {
                resource =  new RootItemCollection(locator, sessionImpl, this, item);
            else{
                resource = new VersionControlledItemCollection(locator, sessionImpl, this, item);
            }
        } else {
View Full Code Here

     */
    public boolean canImport(ImportContext context, boolean isCollection) {
        if (context == null || context.isCompleted()) {
            return false;
        }
        Item contextItem = context.getImportRoot();
        return contextItem != null && contextItem.isNode() && context.getSystemId() != null;
    }
View Full Code Here

     */
    public boolean canExport(ExportContext context, boolean isCollection) {
        if (context == null || context.isCompleted()) {
            return false;
        }
        Item exportRoot = context.getExportRoot();
        boolean success = exportRoot != null && exportRoot.isNode();
        if (success && !isCollection) {
            try {
                Node n = ((Node)exportRoot);
                success = n.hasNode(JcrConstants.JCR_CONTENT);
            } catch (RepositoryException e) {
View Full Code Here

TOP

Related Classes of javax.jcr.Item

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.