Package javax.jcr

Examples of javax.jcr.Item


                }
            } catch (RepositoryException e) {
                log.error("Failed to retrieve primary nodetype property: " + e.getMessage());
            }
            try {
                Item primaryItem = n.getPrimaryItem();
                addHrefProperty(JCR_PRIMARYITEM, new Item[] {primaryItem}, true);
            } catch (ItemNotFoundException e) {
                log.info("No primary item present on this node '" + getResourcePath() + "'");
            } catch (RepositoryException e) {
                log.error("Error while retrieving primary item: " + e.getMessage());
View Full Code Here


     * @throws RepositoryException
     */
    private static String getCorrespondingResourceHref(DavResource resource, Session session, String workspaceHref) throws RepositoryException {
        DavResourceLocator rLoc = resource.getLocator();
        String itemPath = rLoc.getRepositoryPath();
        Item item = session.getItem(itemPath);
        if (item.isNode()) {
            String workspaceName = rLoc.getFactory().createResourceLocator(rLoc.getPrefix(), workspaceHref).getWorkspaceName();
            String corrPath = ((Node)item).getCorrespondingNodePath(workspaceName);
            DavResourceLocator corrLoc = rLoc.getFactory().createResourceLocator(rLoc.getPrefix(), "/" + workspaceName, corrPath, false);
            return corrLoc.getHref(true);
        } else {
View Full Code Here

        // data
        if (context.hasStream()) {
            PrintWriter writer = new PrintWriter(new OutputStreamWriter(context.getOutputStream(), "utf8"));
            try {
                Item item = context.getExportRoot();
                Repository rep = item.getSession().getRepository();
                String repName = rep.getDescriptor(Repository.REP_NAME_DESC);
                String repURL = rep.getDescriptor(Repository.REP_VENDOR_URL_DESC);
                String repVersion = rep.getDescriptor(Repository.REP_VERSION_DESC);
                writer.print("<html><head><title>");
                writer.print(repName);
                writer.print(" ");
                writer.print(repVersion);
                writer.print(" ");
                writer.print(item.getPath());
                writer.print("</title></head>");
                writer.print("<body><h2>");
                writer.print(item.getPath());
                writer.print("</h2><ul>");
                writer.print("<li><a href=\"..\">..</a></li>");
                if (item.isNode()) {
                    NodeIterator iter = ((Node)item).getNodes();
                    while (iter.hasNext()) {
                        Node child = iter.nextNode();
                        String label = Text.getName(child.getPath());
                        writer.print("<li><a href=\"");
View Full Code Here

        // data
        if (context.hasStream()) {
            PrintWriter writer = new PrintWriter(new OutputStreamWriter(context.getOutputStream(), "utf8"));
            try {
                Item item = context.getExportRoot();
                Repository rep = item.getSession().getRepository();
                String repName = rep.getDescriptor(Repository.REP_NAME_DESC);
                String repURL = rep.getDescriptor(Repository.REP_VENDOR_URL_DESC);
                String repVersion = rep.getDescriptor(Repository.REP_VERSION_DESC);
                writer.print("<html><head><title>");
                writer.print(repName);
View Full Code Here

      // Searching default
      for (NodeTypeData ntData : nodeTypes)
      {
         if (ntData.getPrimaryItemName() != null)
         {
            Item primaryItem =
               dataManager.getItem(nodeData(), new QPathEntry(ntData.getPrimaryItemName(), 0), true, ItemType.UNKNOWN);
            if (primaryItem != null)
            {
               return primaryItem;
            }
View Full Code Here

    * {@inheritDoc}
    */
   public Node getNodeByIdentifier(String identifier) throws ItemNotFoundException, RepositoryException
   {
      checkLive();
      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
   {
      checkLive();
      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

    * {@inheritDoc}
    */
   public Node getRootNode() throws RepositoryException
   {
      checkLive();
      Item item = dataManager.getItemByIdentifier(Constants.ROOT_UUID, true);
      if (item != null && item.isNode())
      {
         return (NodeImpl)item;
      }

      throw new ItemNotFoundException("Node not found " + JCRPath.ROOT_PATH + " at " + workspaceName);
View Full Code Here

      // Searching default
      for (NodeTypeData ntData : nodeTypes)
      {
         if (ntData.getPrimaryItemName() != null)
         {
            Item primaryItem =
               dataManager.getItem(nodeData(), new QPathEntry(ntData.getPrimaryItemName(), 0), true, ItemType.UNKNOWN);
            if (primaryItem != null)
            {
               return primaryItem;
            }
View Full Code Here

    * {@inheritDoc}
    */
   public Node getNodeByIdentifier(String identifier) throws ItemNotFoundException, RepositoryException
   {
      checkLive();
      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

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.