Package org.exoplatform.services.jcr.datamodel

Examples of org.exoplatform.services.jcr.datamodel.QPath


      throws PathNotFoundException, IllegalPathException, RepositoryException
   {
      boolean reloadSNS =
         uuidBehavior == ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING
            || uuidBehavior == ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING;
      QPath newPath = null;
      if (reloadSNS)
      {
         NodeData currentParentData = getParent();
         // current node already in list
         int nodeIndex = getNodeIndex(currentParentData, currentNodeInfo.getQName(), currentNodeInfo.getIdentifier());
View Full Code Here


      // can result in nodes disappearing from locations in the
      // workspace that are remote from the location to which the
      // incoming subtree is being written.
      // parentNodeData = (NodeData) sameUuidItem.getParent().getData();

      QPath sameUuidPath = sameUuidItem.getQPath();

      if (ancestorToSave.isDescendantOf(sameUuidPath) || ancestorToSave.equals(sameUuidPath))
      {
         throw new ConstraintViolationException("The imported document contains a element"
            + " with jcr:uuid attribute the same as the  parent of the import target.");
View Full Code Here

         if (data == null)
         {
            continue;
         }
         // check is this descendant of prevRootPath
         QPath nodeQPath = data.getQPath();
         if (nodeQPath != null && nodeQPath.isDescendantOf(prevRootPath))
         {
            //make relative path
            QPathEntry[] relativePath = null;
            try
            {
               relativePath = nodeQPath.getRelPath(nodeQPath.getDepth() - prevRootPath.getDepth());
            }
            catch (IllegalPathException e)
            {
               // Do nothing. Never happens.
            }

            // make new path - no matter  node or property
            QPath newPath = QPath.makeChildPath(newRootPath, relativePath);

            if (data.isNode())
            {
               // update node
View Full Code Here

   public Object visit(ASTContainsExpression node, Object data)
   {
      NAryQueryNode parent = (NAryQueryNode)data;

      QPath relPath = null;
      if (node.getPropertyName() != null)
      {
         relPath = new QPath(new QPathEntry[]{new QPathEntry(node.getPropertyName(), 0)});
      }
      TextsearchQueryNode tsNode = factory.createTextsearchQueryNode(parent, node.getQuery());
      tsNode.setRelativePath(relPath);
      tsNode.setReferencesProperty(true);
      parent.addOperand(tsNode);
View Full Code Here

      RelationQueryNode node = null;

      try
      {
         QPath relPath = null;
         if (propertyName != null)
         {
            relPath = new QPath(new QPathEntry[]{new QPathEntry(propertyName, 0)});
         }
         if (literal == null)
         {
            node = factory.createRelationQueryNode(parent, operationType);
            node.setRelativePath(relPath);
View Full Code Here

      ConstraintViolationException, LockException, UnsupportedRepositoryOperationException, RepositoryException
   {

      checkInitialized();
      JCRPath path = session.getLocationFactory().parseAbsPath(absPath);
      QPath qpath = path.getInternalPath();
      NodeImpl parent = (NodeImpl)session.getTransientNodesManager().getItem(qpath.makeParentPath(), false);
      if (parent == null)
         throw new PathNotFoundException("Parent not found for " + path.getAsString(false));

      // validate as on parent child node
      parent.validateChildNode(qpath.getName(), Constants.NT_QUERY);

      NodeData queryData =
         TransientNodeData.createNodeData((NodeData)parent.getData(), qpath.getName(), Constants.NT_QUERY);
      NodeImpl queryNode =
         (NodeImpl)session.getTransientNodesManager().update(ItemState.createAddedState(queryData), false);

      NodeTypeDataManager ntmanager = session.getWorkspace().getNodeTypesHolder();
View Full Code Here

                           if (value.startsWith(namePrefix))
                           {
                              // extract value
                              value = value.substring(namePrefix.length());
                              // create new named value
                              QPath p = getRelativePath(state, propState);
                              String path = getNamespaceMappings().translatePath(p);
                              value = FieldNames.createNamedValue(path, value);
                              t.setTermBuffer(value);
                              doc.add(new Field(field.name(), new SingletonTokenStream(t)));
                              doc.add(new Field(FieldNames.AGGREGATED_NODE_UUID, parent.getIdentifier(),
View Full Code Here

    */
   protected QPath getRelativePath(NodeData nodeState, PropertyData propState) throws RepositoryException

   {

      QPath nodePath = nodeState.getQPath();
      QPath propPath = propState.getQPath();
      throw new RepositoryException();
      // Path p = nodePath.computeRelativePath(propPath);
      // // make sure it does not contain indexes
      // boolean clean = true;
      // Path.Element[] elements = p.getElements();
View Full Code Here

    */
   protected NodeData getCorrespondingNodeData(SessionImpl corrSession) throws ItemNotFoundException,
      AccessDeniedException, RepositoryException
   {

      final QPath myPath = nodeData().getQPath();
      final SessionDataManager corrDataManager = corrSession.getTransientNodesManager();

      if (this.isNodeType(Constants.MIX_REFERENCEABLE))
      {
         NodeData corrNode = (NodeData)corrDataManager.getItemData(getUUID());
         if (corrNode != null)
         {
            return corrNode;
         }
      }
      else
      {
         NodeData ancestor = (NodeData)dataManager.getItemData(Constants.ROOT_UUID);
         for (int i = 1; i < myPath.getDepth(); i++)
         {
            ancestor = (NodeData)dataManager.getItemData(ancestor, myPath.getEntries()[i], ItemType.NODE);
            if (corrSession.getWorkspace().getNodeTypesHolder().isNodeType(Constants.MIX_REFERENCEABLE,
               ancestor.getPrimaryTypeName(), ancestor.getMixinTypeNames()))
            {
               NodeData corrAncestor = (NodeData)corrDataManager.getItemData(ancestor.getIdentifier());
               if (corrAncestor == null)
               {
                  throw new ItemNotFoundException("No corresponding path for ancestor "
                     + ancestor.getQPath().getAsString() + " in " + corrSession.getWorkspace().getName());
               }

               NodeData corrNode =
                  (NodeData)corrDataManager.getItemData(corrAncestor, myPath.getRelPath(myPath.getDepth() - i),
                     ItemType.NODE);
               if (corrNode != null)
               {
                  return corrNode;
               }
View Full Code Here

            + getPrimaryNodeType().getName());
      }

      JCRPath sourcePath = locationFactory.createJCRPath(getLocation(), srcName);
      JCRPath destenationPath = destName != null ? locationFactory.createJCRPath(getLocation(), destName) : null;
      QPath srcPath = sourcePath.getInternalPath();
      QPath destPath = destenationPath != null ? destenationPath.getInternalPath() : null;

      doOrderBefore(srcPath, destPath);
   }
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.datamodel.QPath

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.