Examples of VersionHistoryDataHelper


Examples of org.exoplatform.services.jcr.impl.dataflow.version.VersionHistoryDataHelper

      DataManager dmanager = restoreSession.getTransientNodesManager().getTransactManager();

      NodeData vh = (NodeData)dmanager.getItemData(nodeData().getParentIdentifier()); // version
      // parent it's a VH
      VersionHistoryDataHelper historyHelper =
         new VersionHistoryDataHelper(vh, dmanager, session.getWorkspace().getNodeTypesHolder());

      SessionChangesLog changesLog = restoreLog(destParent, name, historyHelper, restoreSession, removeExisting, null);
      dmanager.save(changesLog);
   }
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.dataflow.version.VersionHistoryDataHelper

    */
   @Override
   public void loadData(ItemData vhData, NodeData parent) throws RepositoryException, InvalidItemStateException,
      ConstraintViolationException
   {
      super.loadData(new VersionHistoryDataHelper((NodeData)vhData, session.getTransientNodesManager()
         .getTransactManager(), session.getWorkspace().getNodeTypesHolder()), parent);
   }
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.dataflow.version.VersionHistoryDataHelper

      DataManager dmanager = restoreSession.getTransientNodesManager().getTransactManager();

      NodeData vh = (NodeData)dmanager.getItemData(nodeData().getParentIdentifier()); // version
      // parent it's a VH
      VersionHistoryDataHelper historyHelper =
         new VersionHistoryDataHelper(vh, dmanager, session.getWorkspace().getNodeTypesHolder());

      SessionChangesLog changesLog = restoreLog(destParent, name, historyHelper, restoreSession, removeExisting, null);
      dmanager.save(changesLog);
   }
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.dataflow.version.VersionHistoryDataHelper

         nodeData.setBaseVersionIdentifier(IdGenerator.generate());
      }

      PlainChangesLogImpl changes = new PlainChangesLogImpl();
      // using VH helper as for one new VH, all changes in changes log
      new VersionHistoryDataHelper(nodeData, changes, dataConsumer, nodeTypeDataManager, nodeData
         .getVersionHistoryIdentifier(), nodeData.getBaseVersionIdentifier());

      if (uuidBehavior == ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING && !newVersionHistory)
      {
         for (ItemState state : changes.getAllStates())
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.dataflow.version.VersionHistoryDataHelper

      DataManager dmanager = restoreSession.getTransientNodesManager().getTransactManager();

      NodeData vh = (NodeData)dmanager.getItemData(nodeData().getParentIdentifier()); // version
      // parent it's a VH
      VersionHistoryDataHelper historyHelper =
         new VersionHistoryDataHelper(vh, dmanager, session.getWorkspace().getNodeTypesHolder());

      SessionChangesLog changesLog = restoreLog(destParent, name, historyHelper, restoreSession, removeExisting, null);
      dmanager.save(changesLog);
   }
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.dataflow.version.VersionHistoryDataHelper

         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))).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))).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));

            ItemDataRestoreVisitor restoreVisitor =
               new ItemDataRestoreVisitor(currentNode(), qname, childHistory, userSession, removeExisting, changes);
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.dataflow.version.VersionHistoryDataHelper

    * @throws RepositoryException
    */
   public PlainChangesLog makeMixVesionableChanges(final NodeData parent) throws RepositoryException
   {
      PlainChangesLog changesLog = new PlainChangesLogImpl();
      new VersionHistoryDataHelper(parent, changesLog, dataConsumer, nodeTypeDataManager);
      return changesLog;
   }
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.dataflow.version.VersionHistoryDataHelper

   @Override
   public void loadData(ItemData vhData) throws RepositoryException, InvalidItemStateException,
      ConstraintViolationException
   {

      super.loadData(new VersionHistoryDataHelper((NodeData)vhData, session.getTransientNodesManager()
         .getTransactManager(), session.getWorkspace().getNodeTypesHolder()));
   }
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.dataflow.version.VersionHistoryDataHelper

         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 JCRItemExistsException("Item with the same UUID " + versionableIdentifier
                  + " as versionable child node "
                  + userSession.getLocationFactory().createJCRPath(versionable.getQPath()).getAsString(false)
                  + " already exists and removeExisting=false", versionableIdentifier);
            }
            // 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 =
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.dataflow.version.VersionHistoryDataHelper

         nodeData.setBaseVersionIdentifier(IdGenerator.generate());
      }

      PlainChangesLogImpl changes = new PlainChangesLogImpl();
      // using VH helper as for one new VH, all changes in changes log
      new VersionHistoryDataHelper(nodeData, changes, dataConsumer, nodeTypeDataManager, nodeData
         .getVersionHistoryIdentifier(), nodeData.getBaseVersionIdentifier());

      if (uuidBehavior == ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING && !newVersionHistory)
      {
         for (ItemState state : changes.getAllStates())
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.