Package javax.jcr

Examples of javax.jcr.Item


        final String absStoragePath = "/" + storagePath;
       
        try {
            session = repository.loginAdministrative(null);
            if(session.itemExists(absStoragePath)) {
                final Item i = session.getItem(absStoragePath);
                if(i.isNode()) {
                    storageRoot = (Node)i;
                } else {
                    throw new WebloaderException("Item at " + storagePath + " is not a Node");
                }
            } else {
View Full Code Here


     */
    public Node deepCreateNode(String path, Session session, String nodeType)
    throws RepositoryException {
        Node result = null;
        if (session.itemExists(path)) {
            final Item it = session.getItem(path);
            if (it.isNode()) {
                result = (Node) it;
            }
        } else {
            final int slashPos = path.lastIndexOf("/");
            String parentPath = path.substring(0, slashPos);
View Full Code Here

       
        try {
            while(!paths.isEmpty()) {
                final String path = paths.remove(0);
                if(session.itemExists(path)) {
                    final Item it = session.getItem(path);
                    if(!it.isNode()) {
                        final Property p = (Property)it;
                        final Node n = p.getParent();
                        if(!n.hasProperty(SlingbucksConstants.LAST_MODIFIED_PROPERTY_NAME)) {
                            log.debug("Node {} doesn't have property {}, ignored", n.getPath(), SlingbucksConstants.LAST_MODIFIED_PROPERTY_NAME);
                        } else {
View Full Code Here

            // the destination is newly created, hence a create request
            response.setCreateRequest(true);
        }

        Iterator<Resource> resources = getApplyToResources(request);
        Item destItem = null;
        if (resources == null) {

            // ensure we have an item underlying the request's resource
            Item item = resource.adaptTo(Item.class);
            if (item == null) {
                response.setStatus(HttpServletResponse.SC_NOT_FOUND,
                    "Missing source " + resource + " for " + getOperationName());
                return;
            }

            String dstName = trailingSlash ? null : ResourceUtil.getName(dest);
            destItem = execute(changes, item, dstParent, dstName, versioningConfiguration);

        } else {

            // multiple applyTo requires trailing slash on destination
            if (!trailingSlash) {
                throw new IllegalArgumentException(
                    "Applying "
                        + getOperationName()
                        + " to multiple resources requires a trailing slash on the destination");
            }

            // multiple copy will never return 201/CREATED
            response.setCreateRequest(false);

            while (resources.hasNext()) {
                Resource applyTo = resources.next();
                Item item = applyTo.adaptTo(Item.class);
                if (item != null) {
                    execute(changes, item, dstParent, null, versioningConfiguration);
                }
            }
            destItem = session.getItem(dest);
View Full Code Here

                    checkoutIfNecessary(node, changes, versioningConfiguration);
                }
            }

            // move through the session and record operation
            Item sourceItem = session.getItem(source);
            if (sourceItem.isNode()) {

                // node move/copy through session
                if (isMove) {
                    checkoutIfNecessary(sourceItem.getParent(), changes, versioningConfiguration);
                    session.move(source, propPath);
                } else {
                    Node sourceNode = (Node) sourceItem;
                    Node destParent = (Node) session.getItem(property.getParentPath());
                    checkoutIfNecessary(destParent, changes, versioningConfiguration);
View Full Code Here

    @Override
    protected Item execute(List<Modification> changes, Item source,
            String destParent, String destName,
            VersioningConfiguration versioningConfiguration) throws RepositoryException {

        Item destItem = copy(source, (Node) source.getSession().getItem(destParent), destName);

        String dest = destParent + "/" + destName;
        changes.add(Modification.onCopied(source.getPath(), dest));
        log.debug("copy {} to {}", source, dest);
        return destItem;
View Full Code Here

        log.debug("Scanning {}", path);
        needsScan = false;

        Node folder = null;
        if (session.itemExists(path)) {
          final Item i = session.getItem(path);
          if(i.isNode()) {
            folder = (Node)i;
          }
        }

        // Return an InstallableResource for all child nodes for which we have a NodeConverter
View Full Code Here

     * Test method for 'org.springmodules.jcr.JcrTemplate.getItem(String)'
     */
    public void testGetItem() throws RepositoryException{
        String path = "path";
        MockControl resultMock = MockControl.createControl(Item.class);
        Item result = (Item) resultMock.getMock();

        sessionControl.expectAndReturn(session.getItem(path), result);
        sessionControl.replay();
        sfControl.replay();

View Full Code Here

   /**
    * {@inheritDoc}
    */
   public Node getNodeByIdentifier(String identifier) throws ItemNotFoundException, RepositoryException
   {
      Item item = dataManager.getItemByIdentifier(identifier, true);
      if (item != null && item.isNode())
         return (Node)item;

      throw new ItemNotFoundException("Node not found " + identifier + " at " + workspaceName);
   }
View Full Code Here

   /**
    * {@inheritDoc}
    */
   public Node getNodeByUUID(String uuid) throws ItemNotFoundException, RepositoryException
   {
      Item item = dataManager.getItemByIdentifier(uuid, true);

      if (item != null && item.isNode())
      {
         NodeImpl node = (NodeImpl)item;
         node.getUUID(); // throws exception
         return node;
      }
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.