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

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


         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);
View Full Code Here


            "Node.checkout() is not supported for not mix:versionable node ");

      if (checkedOut())
         return;

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

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

      ValueData baseVersion =
         ((PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_BASEVERSION, 0))).getValues()
            .get(0);

      changesLog.add(ItemState.createUpdatedState(updatePropertyData(Constants.JCR_PREDECESSORS, baseVersion)));

      dataManager.getTransactManager().save(changesLog);

      session.getActionHandler().postCheckout(this);
   }
View Full Code Here

         ((RepositoryImpl)session.getRepository()).internalLogin(session.getUserState(), srcWorkspace);

      ItemDataMergeVisitor visitor = new ItemDataMergeVisitor(this.session, corrSession, failed, bestEffort);
      this.nodeData().accept(visitor);

      SessionChangesLog changes = visitor.getMergeChanges();

      EntityCollection failedIter = createMergeFailed(failed, changes);

      if (changes.getSize() > 0)
         dataManager.getTransactManager().save(changes);

      return failedIter;
   }
View Full Code Here

      // Check locking
      if (!checkLocking())
         throw new LockException("Node " + getPath() + " is locked ");

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

      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

   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

         ItemData storage = session.getTransientNodesManager().getItemData(AUDIT_STORAGE_ID);

         if (storage == null)
         {
            SessionChangesLog changesLog = new SessionChangesLog(session);

            // here should be added to TransactionalDataManager (i.e. saved
            // immediatelly!
            // nodeData: /exo:audit with UUID = AUDIT_STORAGE_ID
            // its primaryType exo:auditStorage
            List<AccessControlEntry> access = new ArrayList<AccessControlEntry>();
            access.add(new AccessControlEntry(IdentityConstants.ANY, PermissionType.ADD_NODE));

            for (String identity : adminIdentitys)
            {
               access.add(new AccessControlEntry(identity, PermissionType.READ));
            }

            access.add(new AccessControlEntry(IdentityConstants.ANY, PermissionType.REMOVE));

            AccessControlList exoAuditAccessControlList = new AccessControlList(IdentityConstants.SYSTEM, access);

            InternalQName[] mixins = new InternalQName[]{Constants.EXO_PRIVILEGEABLE, Constants.MIX_REFERENCEABLE};

            TransientNodeData exoAuditNode =
               new TransientNodeData(QPath.makeChildPath(Constants.ROOT_PATH, AuditService.EXO_AUDIT),
                  AuditService.AUDIT_STORAGE_ID, -1, AuditService.EXO_AUDITSTORAGE, mixins, 0, Constants.ROOT_UUID,
                  exoAuditAccessControlList);

            // jcr:primaryType
            TransientPropertyData exoAuditPrType =
               TransientPropertyData.createPropertyData(exoAuditNode, Constants.JCR_PRIMARYTYPE, PropertyType.NAME,
                  false, new TransientValueData(exoAuditNode.getPrimaryTypeName()));
            // jcr:uuid
            TransientPropertyData exoAuditUuid =
               TransientPropertyData.createPropertyData(exoAuditNode, Constants.JCR_UUID, PropertyType.STRING, false,
                  new TransientValueData(exoAuditNode.getIdentifier()));
            // jcr:mixinTypes
            List<ValueData> mixValues = new ArrayList<ValueData>();
            mixValues.add(new TransientValueData(Constants.MIX_REFERENCEABLE));
            mixValues.add(new TransientValueData(Constants.EXO_PRIVILEGEABLE));

            TransientPropertyData exoAuditMixinTypes =
               TransientPropertyData.createPropertyData(exoAuditNode, Constants.JCR_MIXINTYPES, PropertyType.NAME,
                  true, mixValues);
            // EXO_PERMISSIONS

            List<ValueData> permsValues = new ArrayList<ValueData>();
            for (int i = 0; i < exoAuditNode.getACL().getPermissionEntries().size(); i++)
            {
               AccessControlEntry entry = exoAuditNode.getACL().getPermissionEntries().get(i);
               permsValues.add(new TransientValueData(entry));
            }
            TransientPropertyData exoAuditPerms =
               TransientPropertyData.createPropertyData(exoAuditNode, Constants.EXO_PERMISSIONS,
                  ExtendedPropertyType.PERMISSION, true, permsValues);

            changesLog.add(ItemState.createAddedState(exoAuditNode));
            changesLog.add(ItemState.createAddedState(exoAuditPrType));
            changesLog.add(ItemState.createAddedState(exoAuditUuid));
            changesLog.add(ItemState.createAddedState(exoAuditMixinTypes));
            changesLog.add(ItemState.createAddedState(exoAuditPerms));

            session.getTransientNodesManager().getTransactManager().save(changesLog);
            storage = session.getTransientNodesManager().getItemData(AUDIT_STORAGE_ID);
         }
         if (!storage.isNode())
View Full Code Here

   protected final TransactionableDataManager transactionableManager;

   public SessionDataManager(SessionImpl session, LocalWorkspaceDataManagerStub dataManager) throws RepositoryException
   {
      this.session = session;
      this.changesLog = new SessionChangesLog(session);
      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);

      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.isRenamed())
         {
            // 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

      }

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

      SessionChangesLog changesLog = new SessionChangesLog(session);

      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.