Package org.exoplatform.services.jcr.impl.dataflow.session

Examples of org.exoplatform.services.jcr.impl.dataflow.session.SessionChangesLog


      if (!checkLocking())
      {
         throw new LockException("Node " + getPath() + " is locked ");
      }

      SessionChangesLog changes = new SessionChangesLog(session);

      String srcPath;
      try
      {
         srcPath = getCorrespondingNodePath(srcWorkspaceName);

         ItemDataRemoveVisitor remover =
            new ItemDataRemoveVisitor(session.getTransientNodesManager(), null, session.getWorkspace()
               .getNodeTypesHolder(), session.getAccessManager(), session.getUserState());
         nodeData().accept(remover);

         changes.addAll(remover.getRemovedStates());
      }
      catch (ItemNotFoundException e)
      {
         LOG.debug("No corresponding node in workspace: " + srcWorkspaceName);
         return;
View Full Code Here


      boolean removeExisting, SessionChangesLog delegatedChanges) throws RepositoryException
   {
      super(userSession.getTransientNodesManager().getTransactManager());

      this.userSession = userSession;
      this.changes = new SessionChangesLog(userSession.getId());
      this.context = context;
      this.destName = destName;
      this.history = history;
      this.parents.push(new NodeDataContext(context));
      this.removeExisting = removeExisting;
View Full Code Here

   protected final TransactionableDataManager transactionableManager;

   public SessionDataManager(SessionImpl session, LocalWorkspaceDataManagerStub dataManager) throws RepositoryException
   {
      this.session = session;
      this.changesLog = new SessionChangesLog(session.getId());
      this.itemsPool = new ItemReferencePool();
      this.itemFactory = new SessionItemFactory();
      this.accessManager = session.getAccessManager();
      this.transactionableManager = new TransactionableDataManager(dataManager, session);
   }
View Full Code Here

   void rollback(ItemData item) throws InvalidItemStateException, RepositoryException
   {

      // remove from changes log (Session pending changes)
      PlainChangesLog slog = changesLog.pushLog(item.getQPath());
      SessionChangesLog changes = new SessionChangesLog(slog.getAllStates(), session.getId());

      String exceptions = "";

      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 +=
               "Can't find removed item " + removed.getLocation().getAsString(false) + " in changes for rollback.\n";
            continue;
         }

         if (rstate.getState() == ItemState.RENAMED)
         {
            // find DELETED
            rstate = changes.findItemState(rstate.getData().getIdentifier(), false, new int[]{ItemState.DELETED});
            if (rstate == null)
            {
               exceptions +=
                  "Can't find removed item (of move operation) " + removed.getLocation().getAsString(false)
                     + " in changes for rollback.\n";
View Full Code Here

      boolean removeExisting, SessionChangesLog delegatedChanges) throws RepositoryException
   {
      super(userSession.getTransientNodesManager().getTransactManager());

      this.userSession = userSession;
      this.changes = new SessionChangesLog(userSession.getId());
      this.context = context;
      this.destName = destName;
      this.history = history;
      this.parents.push(new NodeDataContext(context));
      this.removeExisting = removeExisting;
View Full Code Here

      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

   public void clone(String srcWorkspace, String srcAbsPath, String destAbsPath, boolean removeExisting)
      throws NoSuchWorkspaceException, ConstraintViolationException, VersionException, AccessDeniedException,
      PathNotFoundException, ItemExistsException, RepositoryException
   {

      SessionChangesLog changes = new SessionChangesLog(session.getId());

      clone(srcWorkspace, srcAbsPath, destAbsPath, removeExisting, changes);

      session.getTransientNodesManager().getTransactManager().save(changes);
   }
View Full Code Here

                  + versionableIdentifier);

         }
      }

      SessionChangesLog changesLog = new SessionChangesLog(session.getId());

      for (VersionImpl v : existedVersions.keySet())
      {
         try
         {
            NodeData node = existedVersions.get(v);

            NodeData destParent = (NodeData)dataManager.getItemData(node.getParentIdentifier());
            NodeData vh = (NodeData)dataManager.getItemData(v.getParentIdentifier()); // version
            // parent
            // it's a VH
            VersionHistoryDataHelper historyHelper =
               new VersionHistoryDataHelper((NodeData)vh, dataManager, nodeTypeManager);

            changesLog.addAll(v.restoreLog(destParent, node.getQPath().getName(), historyHelper, session,
               removeExisting, changesLog).getAllStates());
         }
         catch (ItemExistsException e)
         {
            throw new ItemExistsException("Workspace restore. Can't restore a node. "
               + v.getContainingHistory().getVersionableUUID() + ". " + e.getMessage(), e);
         }
         catch (RepositoryException e)
         {
            throw new RepositoryException("Workspace restore. Can't restore a node. "
               + v.getContainingHistory().getVersionableUUID() + ". Repository error: " + e.getMessage(), e);
         }
      }

      for (VersionImpl v : notExistedVersions)
      {
         String versionableIdentifier = v.getContainingHistory().getVersionableUUID();
         try
         {
            NodeData node = null;
            for (ItemState change : changesLog.getAllStates())
            {
               if (change.isNode() && change.isAdded()
                  && ((NodeData)change.getData()).getIdentifier().equals(versionableIdentifier))
               {
                  node = (NodeData)change.getData();
                  break;
               }
            }
            if (node != null)
            {
               NodeData destParent = (NodeData)dataManager.getItemData(node.getParentIdentifier());
               // version parent it's a VH
               NodeData vh = (NodeData)dataManager.getItemData(v.getParentIdentifier());
               VersionHistoryDataHelper historyHelper =
                  new VersionHistoryDataHelper((NodeData)vh, dataManager, nodeTypeManager);

               changesLog.addAll(v.restoreLog(destParent, node.getQPath().getName(), historyHelper, session,
                  removeExisting, changesLog).getAllStates());
            }
            else
            {
               throw new VersionException("No such node restored before (for version, from the array of versions, "
View Full Code Here

         }
      }

      NodeData versionData = getVersionData(versionName);

      SessionChangesLog changesLog = new SessionChangesLog(session.getId());

      PropertyData labelData =
         TransientPropertyData.createPropertyData(labels, labelQName, PropertyType.REFERENCE, false,
            new TransientValueData(versionData.getIdentifier()));
      changesLog.add(ItemState.createAddedState(labelData));

      dataManager.getTransactManager().save(changesLog);
   }
View Full Code Here

         throw new LockException("Node " + parent().getPath() + " is locked ");

      // the new version identifier
      String verIdentifier = IdGenerator.generate();

      SessionChangesLog changesLog = new SessionChangesLog(session.getId());

      VersionHistoryImpl vh = versionHistory(false);
      vh.addVersion(this.nodeData(), verIdentifier, changesLog);

      changesLog.add(ItemState.createUpdatedState(updatePropertyData(Constants.JCR_ISCHECKEDOUT,
         new TransientValueData(false))));

      changesLog.add(ItemState.createUpdatedState(updatePropertyData(Constants.JCR_BASEVERSION, new TransientValueData(
         new Identifier(verIdentifier)))));

      changesLog.add(ItemState.createUpdatedState(updatePropertyData(Constants.JCR_PREDECESSORS,
         new ArrayList<ValueData>())));

      dataManager.getTransactManager().save(changesLog);

      VersionImpl version = (VersionImpl)dataManager.getItemByIdentifier(verIdentifier, true, false);
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.impl.dataflow.session.SessionChangesLog

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.