Examples of QPath


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

   @Override
   public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException
   {
      if (parentData != null)
      {
         final QPath ipath = QPath.makeChildPath(parentData.getQPath(), name);
         if (isSystemDescendant(ipath) && !this.equals(versionDataManager))
         {
            return versionDataManager.getItemData(parentData, name, itemType);
         }
      }
View Full Code Here

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

         final int li = path.length - 1;
         System.arraycopy(path, 0, siblingPath, 0, li);

         siblingPath[li] = new QPathEntry(path[li], path[li].getIndex() - 1);

         if (addedNodes.contains(new QPath(siblingPath)))
         {
            // current changes log has the older same-name sibling
            return;
         }
         else
View Full Code Here

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

   protected void initRestoreRoot(NodeData parentData, InternalQName name, NodeData frozen) throws RepositoryException
   {

      // WARNING: path with index=1
      QPath nodePath = QPath.makeChildPath(parentData.getQPath(), name);

      if (log.isDebugEnabled())
         log.debug("Restore: " + nodePath.getAsString() + ", removeExisting=" + removeExisting);

      PropertyData frozenIdentifier =
         (PropertyData)dataManager.getItemData(frozen, new QPathEntry(Constants.JCR_FROZENUUID, 1), ItemType.PROPERTY);

      String fidentifier = null;
      NodeData existing = null;
      // make new node from frozen
      try
      {
         fidentifier = new String(frozenIdentifier.getValues().get(0).getAsByteArray());
         NodeData sameIdentifierNodeRestored = (NodeData)findDelegated(fidentifier);
         if (sameIdentifierNodeRestored != null)
         {
            // already restored from delegated call, remove it as we interested in
            // this version state
            deleteDelegated(sameIdentifierNodeRestored.getQPath());
         }
         else
         {
            NodeData sameIdentifierNode = (NodeData)dataManager.getItemData(fidentifier);
            if (sameIdentifierNode != null)
            {
               QPath sameIdentifierPath = sameIdentifierNode.getQPath();
               if (sameIdentifierPath.makeParentPath().equals(nodePath.makeParentPath()) && // same
                  // parent
                  sameIdentifierPath.getName().equals(nodePath.getName()))
               { // same
                  // name

                  if (sameIdentifierPath.getIndex() != nodePath.getIndex())
                     // but different index, see below... fix it
                     nodePath = QPath.makeChildPath(parentData.getQPath(), name, sameIdentifierPath.getIndex());

                  // if it's a target node
                  existing = sameIdentifierNode;

                  // remove existed node, with validation
                  ItemDataRemoveVisitor removeVisitor = new RemoveVisitor();
                  removeVisitor.visit(existing);

                  changes.addAll(removeVisitor.getRemovedStates());
               }
               else if (!sameIdentifierPath.isDescendantOf(nodePath))
               {
                  if (removeExisting)
                  {
                     final QPath restorePath = nodePath;
                     // remove same uuid node, with validation
                     class RemoveVisitor extends ItemDataRemoveVisitor
                     {
                        RemoveVisitor() throws RepositoryException
                        {
View Full Code Here

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

      }
      else if (nodeTypeDataManager.isNodeType(Constants.NT_VERSIONEDCHILD, frozen.getPrimaryTypeName()))
      {

         QPath cvhpPropPath = QPath.makeChildPath(frozen.getQPath(), Constants.JCR_CHILDVERSIONHISTORY);

         if (log.isDebugEnabled())
         {
            log.debug("Versioned child node " + cvhpPropPath.getAsString());
         }

         VersionHistoryDataHelper childHistory = null;
         try
         {

            String vhIdentifier =
               new String(((PropertyData)dataManager.getItemData(frozen, new QPathEntry(
                  Constants.JCR_CHILDVERSIONHISTORY, 0), ItemType.PROPERTY)).getValues().get(0).getAsByteArray());

            NodeData cHistory = null;
            if ((cHistory = (NodeData)dataManager.getItemData(vhIdentifier)) == null)
               throw new RepositoryException("Version history is not found with uuid " + vhIdentifier);

            childHistory = new VersionHistoryDataHelper(cHistory, dataManager, nodeTypeDataManager);
         }
         catch (IllegalStateException e)
         {
            throw new RepositoryException("jcr:childVersionHistory, error of data read "
               + userSession.getLocationFactory().createJCRPath(cvhpPropPath).getAsString(false), e);
         }
         catch (IOException e)
         {
            throw new RepositoryException("jcr:childVersionHistory, error of data read "
               + userSession.getLocationFactory().createJCRPath(cvhpPropPath).getAsString(false), e);
         }

         String versionableIdentifier = null;
         try
         {
            versionableIdentifier =
               new String(((PropertyData)dataManager.getItemData(childHistory, new QPathEntry(
                  Constants.JCR_VERSIONABLEUUID, 0), ItemType.PROPERTY)).getValues().get(0).getAsByteArray());

         }
         catch (IOException e)
         {
            throw new RepositoryException("jcr:childVersionHistory, error of data read "
               + userSession.getLocationFactory().createJCRPath(cvhpPropPath).getAsString(false), e);
         }

         NodeData versionable = (NodeData)dataManager.getItemData(versionableIdentifier);
         if (versionable != null)
         {
            // exists,
            // On restore of VN, if the workspace currently has an already
            // existing node corresponding to C’s version history and the
            // removeExisting flag of the restore is set to true, then that
            // instance of C becomes the child of the restored N.
            if (!removeExisting)
            {
               throw new ItemExistsException("Item with the same UUID " + versionableIdentifier
                  + " as versionable child node "
                  + userSession.getLocationFactory().createJCRPath(versionable.getQPath()).getAsString(false)
                  + " already exists and removeExisting=false");
            }
            // else - leaving existed unchanged
         }
         else
         {
            // not found, gets last version (by time of creation) and restore it
            NodeData lastVersionData = childHistory.getLastVersionData();
            NodeData cvFrozen =
               (NodeData)dataManager.getItemData(lastVersionData, new QPathEntry(Constants.JCR_FROZENNODE, 1),
                  ItemType.NODE);

            ItemDataRestoreVisitor restoreVisitor =
               new ItemDataRestoreVisitor(currentNode(), qname, childHistory, userSession, removeExisting, changes);
            cvFrozen.accept(restoreVisitor);
            changes.addAll(restoreVisitor.getRestoreChanges().getAllStates());
         }
         pushCurrent(null); // skip any childs of that node
      }
      else if (currentNode() != null)
      {
         // ordinary node for copy under nt:frozenNode
         // [PN] 10.04.06 In case of COPY - copy node, otherwise we don't
         // 8.2.11.3 INITIALIZE; 8.2.11.4 COMPUTE
         // On restore of VN, the C stored as its child will be ignored, and the
         // current C in the workspace will be left unchanged.

         int action =
            nodeTypeDataManager.getChildNodeDefinition(qname, frozen.getPrimaryTypeName(),
               currentNode().getPrimaryTypeName(),
               currentNode().getMixinTypeNames()).getOnParentVersion();

         if (log.isDebugEnabled())
         {
            log.debug("Stored node " + frozen.getQPath().getAsString() + ", "
               + OnParentVersionAction.nameFromValue(action));
         }

         if (action == OnParentVersionAction.COPY || action == OnParentVersionAction.VERSION)
         {
            // copy
            QPath restoredPath =
               QPath.makeChildPath(currentNode().getQPath(), frozen.getQPath().getName(), frozen.getQPath().getIndex());

            // jcr:uuid
            String jcrUuid = null;
            NodeData existing = null;
            if (nodeTypeDataManager.isNodeType(Constants.MIX_REFERENCEABLE, frozen.getPrimaryTypeName(), frozen
               .getMixinTypeNames()))
            {
               // copy uuid from frozen state of mix:referenceable,
               // NOTE: mix:referenceable stored in frozen state with genereted ID
               // (JCR_XITEM PK) as UUID must be unique,
               // but jcr:uuid property containts real UUID.
               QPath jcrUuidPath = QPath.makeChildPath(frozen.getQPath(), Constants.JCR_UUID);
               try
               {
                  jcrUuid =
                     new String(((PropertyData)dataManager.getItemData(frozen, new QPathEntry(Constants.JCR_UUID, 0),
                        ItemType.PROPERTY)).getValues().get(0).getAsByteArray());
View Full Code Here

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

      {
         AccessControlList acl =
            ntManager.isNodeType(Constants.EXO_PRIVILEGEABLE, node.getPrimaryTypeName(), node.getMixinTypeNames())
               ? node.getACL() : currentNode().getACL();

         QPath frozenPath = QPath.makeChildPath(currentNode().getQPath(), qname, node.getQPath().getIndex());
         frozenNode =
            new TransientNodeData(frozenPath, IdGenerator.generate(), node.getPersistedVersion(), node
               .getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(), currentNode().getIdentifier(), // parent
               acl);

         contextNodes.push(frozenNode);
         changesLog.add(ItemState.createAddedState(frozenNode));
      }
      else if (action == OnParentVersionAction.VERSION)
      {
         if (ntManager.isNodeType(Constants.MIX_VERSIONABLE, node.getPrimaryTypeName(), node.getMixinTypeNames()))
         {
            frozenNode =
               TransientNodeData.createNodeData(currentNode(), qname, Constants.NT_VERSIONEDCHILD, node.getQPath()
                  .getIndex());

            PropertyData pt =
               TransientPropertyData.createPropertyData(frozenNode, Constants.JCR_PRIMARYTYPE, PropertyType.NAME,
                  false, new TransientValueData(Constants.NT_VERSIONEDCHILD));

            ValueData vh =
               ((PropertyData)dataManager.getItemData(node, new QPathEntry(Constants.JCR_VERSIONHISTORY, 0),
                  ItemType.PROPERTY)).getValues().get(0);

            PropertyData pd =
               TransientPropertyData.createPropertyData(frozenNode, Constants.JCR_CHILDVERSIONHISTORY,
                  PropertyType.REFERENCE, false, vh);

            contextNodes.push(null);
            changesLog.add(ItemState.createAddedState(frozenNode));
            changesLog.add(ItemState.createAddedState(pt));
            changesLog.add(ItemState.createAddedState(pd));
         }
         else
         { // behaviour of COPY
            AccessControlList acl =
               ntManager.isNodeType(Constants.EXO_PRIVILEGEABLE, node.getPrimaryTypeName(), node.getMixinTypeNames())
                  ? node.getACL() : currentNode().getACL();

            QPath frozenPath = QPath.makeChildPath(currentNode().getQPath(), qname, node.getQPath().getIndex());
            frozenNode =
               new TransientNodeData(frozenPath, IdGenerator.generate(), node.getPersistedVersion(), node
                  .getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
                  currentNode().getIdentifier(), // parent
                  acl);
View Full Code Here

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

      // reindexed
      while (nextSibling != null && !nextSibling.getIdentifier().equals(cause.getIdentifier())
         && !nextSibling.getIdentifier().equals(reindexedId))
      {
         // update with new index
         QPath siblingPath =
            QPath.makeChildPath(nextSibling.getQPath().makeParentPath(), nextSibling.getQPath().getName(), nextSibling
               .getQPath().getIndex() - 1);

         NodeData reindexed =
            new TransientNodeData(siblingPath, nextSibling.getIdentifier(), nextSibling.getPersistedVersion(),
View Full Code Here

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

      for (Iterator<ItemImpl> removedIter = invalidated.iterator(); removedIter.hasNext();)
      {
         ItemImpl removed = removedIter.next();

         QPath removedPath = removed.getLocation().getInternalPath();
         ItemState rstate = changes.getItemState(removedPath);

         if (rstate == null)
         {
            exceptions +=
View Full Code Here

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

    */
   public static TransientNodeData createNodeData(NodeData parent, InternalQName name, InternalQName primaryTypeName,
      InternalQName[] mixinTypeNames, String identifier)
   {
      TransientNodeData nodeData = null;
      QPath path = QPath.makeChildPath(parent.getQPath(), name);
      nodeData =
         new TransientNodeData(path, identifier, -1, primaryTypeName, mixinTypeNames, 0, parent.getIdentifier(), parent
            .getACL());
      return nodeData;
   }
View Full Code Here

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

    * @return TransientNodeData
    */
   public static TransientNodeData createNodeData(NodeData parent, InternalQName name, InternalQName primaryTypeName)
   {
      TransientNodeData nodeData = null;
      QPath path = QPath.makeChildPath(parent.getQPath(), name);
      nodeData =
         new TransientNodeData(path, IdGenerator.generate(), -1, primaryTypeName, new InternalQName[0], 0, parent
            .getIdentifier(), parent.getACL());
      return nodeData;
   }
View Full Code Here

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

    */
   public static TransientNodeData createNodeData(NodeData parent, InternalQName name, InternalQName primaryTypeName,
      InternalQName[] mixinTypesName)
   {
      TransientNodeData nodeData = null;
      QPath path = QPath.makeChildPath(parent.getQPath(), name);
      nodeData =
         new TransientNodeData(path, IdGenerator.generate(), -1, primaryTypeName, mixinTypesName, 0, parent
            .getIdentifier(), parent.getACL());
      return nodeData;
   }
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.