Examples of PlainChangesLog


Examples of org.exoplatform.services.jcr.dataflow.PlainChangesLog

         log.warn("Unable save nodetype " + nodeType.getName().getAsString()
            + " in to the storage. Storage not initialized");
         return;
      }

      PlainChangesLog changesLog = new PlainChangesLogImpl();
      definitionAccessProvider.write(changesLog, nodeTypeStorageRoot, nodeType);
      dataManager.save(new TransactionChangesLog(changesLog));
   }
View Full Code Here

Examples of org.exoplatform.services.jcr.dataflow.PlainChangesLog

      return nodeTypeData != null;
   }

   public NodeData initNodetypesRoot(NodeData nsSystem, boolean addACL) throws RepositoryException
   {
      PlainChangesLog changesLog = new PlainChangesLogImpl();
      TransientNodeData jcrNodetypes;

      long start = System.currentTimeMillis();

      if (addACL)
      {
         AccessControlList acl = new AccessControlList();
         InternalQName[] mixins = new InternalQName[]{Constants.EXO_OWNEABLE, Constants.EXO_PRIVILEGEABLE};

         jcrNodetypes =
            TransientNodeData.createNodeData(nsSystem, Constants.JCR_NODETYPES, Constants.NT_UNSTRUCTURED, mixins,
               Constants.NODETYPESROOT_UUID);

         TransientPropertyData primaryType =
            TransientPropertyData.createPropertyData(jcrNodetypes, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
               new TransientValueData(jcrNodetypes.getPrimaryTypeName()));

         changesLog.add(ItemState.createAddedState(jcrNodetypes)).add(ItemState.createAddedState(primaryType));

         // jcr:mixinTypes
         List<ValueData> mixValues = new ArrayList<ValueData>();
         for (InternalQName mixin : mixins)
         {
            mixValues.add(new TransientValueData(mixin));
         }
         TransientPropertyData exoMixinTypes =
            TransientPropertyData.createPropertyData(jcrNodetypes, Constants.JCR_MIXINTYPES, PropertyType.NAME, true,
               mixValues);

         TransientPropertyData exoOwner =
            TransientPropertyData.createPropertyData(jcrNodetypes, Constants.EXO_OWNER, PropertyType.STRING, false,
               new TransientValueData(acl.getOwner()));

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

         changesLog.add(ItemState.createAddedState(exoMixinTypes)).add(ItemState.createAddedState(exoOwner)).add(
            ItemState.createAddedState(exoPerms));
         changesLog.add(new ItemState(jcrNodetypes, ItemState.MIXIN_CHANGED, false, null));
      }
      else
      {
         jcrNodetypes =
            TransientNodeData.createNodeData(nsSystem, Constants.JCR_NODETYPES, Constants.NT_UNSTRUCTURED,
               Constants.NODETYPESROOT_UUID);

         TransientPropertyData primaryType =
            TransientPropertyData.createPropertyData(jcrNodetypes, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
               new TransientValueData(jcrNodetypes.getPrimaryTypeName()));

         changesLog.add(ItemState.createAddedState(jcrNodetypes)).add(ItemState.createAddedState(primaryType));
      }

      if (log.isDebugEnabled())
      {
         log.debug("/jcr:system/jcr:nodetypes is created, creation time: " + (System.currentTimeMillis() - start)
View Full Code Here

Examples of org.exoplatform.services.jcr.dataflow.PlainChangesLog

      if (!validatate())
      {
         return;
      }

      PlainChangesLog changesLog = new PlainChangesLogImpl();
      for (NodeTypeData nodeTypeData : nodeTypes)
      {
         definitionAccessProvider.write(changesLog, nodeTypeStorageRoot, nodeTypeData);
      }
View Full Code Here

Examples of org.exoplatform.services.jcr.dataflow.PlainChangesLog

      NodeData nodeTypeData =
         (NodeData)dataManager.getItemData(nodeTypeStorageRoot, new QPathEntry(nodeType.getName(), 1), ItemType.NODE);
      ItemDataRemoveVisitor removeVisitor = new ItemDataRemoveVisitor(dataManager, nodeTypeStorageRoot.getQPath());
      nodeTypeData.accept(removeVisitor);

      PlainChangesLog changesLog = new PlainChangesLogImpl();
      changesLog.addAll(removeVisitor.getRemovedStates());
      dataManager.save(new TransactionChangesLog(changesLog));
   }
View Full Code Here

Examples of org.exoplatform.services.jcr.dataflow.PlainChangesLog

    * {@inheritDoc}
    */
   public void update(List<NodeTypeData> nodeTypes, UpdateNodeTypeObserver observer) throws RepositoryException
   {

      PlainChangesLog changesLog = new PlainChangesLogImpl();

      for (NodeTypeData nodeTypeData : nodeTypes)
      {

         if (observer != null)
         {
            if (observer.shouldSkip(nodeTypeData, changesLog))
            {
               continue;
            }
            observer.beforeUpdate(nodeTypeData, changesLog);
         }
         if (!validatate())
         {
            continue;
         }
         // remove first
         NodeData removeNodeTypeData =
            (NodeData)dataManager.getItemData(nodeTypeStorageRoot, new QPathEntry(nodeTypeData.getName(), 1),
               ItemType.NODE);
         if (removeNodeTypeData != null)
         {
            ItemDataRemoveVisitor removeVisitor =
               new ItemDataRemoveVisitor(dataManager, nodeTypeStorageRoot.getQPath());
            removeNodeTypeData.accept(removeVisitor);

            changesLog.addAll(removeVisitor.getRemovedStates());
         }
         // add
         definitionAccessProvider.write(changesLog, nodeTypeStorageRoot, nodeTypeData);
         if (observer != null)
         {
            observer.afterUpdate(nodeTypeData, changesLog);
         }
      }
      //made changes if needed
      if (changesLog.getSize() > 0)
      {
         dataManager.save(new TransactionChangesLog(changesLog));
      }
   }
View Full Code Here

Examples of org.exoplatform.services.jcr.dataflow.PlainChangesLog

   {

      // validate all, throw an exception if validation failed
      validate(path);

      PlainChangesLog cLog = changesLog.pushLog(path);

      if (log.isDebugEnabled())
      {
         log.debug(" ----- commit -------- \n" + cLog.dump());
      }

      try
      {
         transactionableManager.save(cLog);
View Full Code Here

Examples of org.exoplatform.services.jcr.dataflow.PlainChangesLog

    */
   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();)
      {
View Full Code Here

Examples of org.exoplatform.services.jcr.dataflow.PlainChangesLog

         if (nData == null)
         {
            return;
         }

         PlainChangesLog changesLog =
            new PlainChangesLogImpl(new ArrayList<ItemState>(), SystemIdentity.SYSTEM, ExtendedEvent.UNLOCK);

         ItemData lockOwner =
            copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKOWNER, 1),
               ItemType.PROPERTY));

         //TODO EXOJCR-412, should be refactored in future.
         //Skip removing, because that lock was removed in other node of cluster. 
         if (lockOwner == null)
         {
            return;
         }

         changesLog.add(ItemState.createDeletedState(lockOwner));

         ItemData lockIsDeep =
            copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKISDEEP, 1),
               ItemType.PROPERTY));

         //TODO EXOJCR-412, should be refactored in future.
         //Skip removing, because that lock was removed in other node of cluster. 
         if (lockIsDeep == null)
         {
            return;
         }

         changesLog.add(ItemState.createDeletedState(lockIsDeep));

         // lock probably removed by other thread
         if (lockOwner == null && lockIsDeep == null)
         {
            return;
View Full Code Here

Examples of org.exoplatform.services.jcr.dataflow.PlainChangesLog

      try
      {
         for (int i = 0; i < list.length; i++)
         {
            PlainChangesLog plainChangesLog =
               new PlainChangesLogImpl(new ArrayList<ItemState>(), SystemIdentity.SYSTEM, ExtendedEvent.UNLOCK);

            NodeData lockedNodeData = (NodeData)dataManager.getItemData(list[i]);
            // No item no problem
            if (lockedNodeData != null)
            {
               PropertyData dataLockIsDeep =
                  (PropertyData)dataManager.getItemData(lockedNodeData, new QPathEntry(Constants.JCR_LOCKISDEEP, 0));

               if (dataLockIsDeep != null)
               {
                  plainChangesLog.add(ItemState.createDeletedState(new TransientPropertyData(QPath.makeChildPath(
                     lockedNodeData.getQPath(), Constants.JCR_LOCKISDEEP), dataLockIsDeep.getIdentifier(), 0,
                     dataLockIsDeep.getType(), dataLockIsDeep.getParentIdentifier(), dataLockIsDeep.isMultiValued())));
               }

               PropertyData dataLockOwner =
                  (PropertyData)dataManager.getItemData(lockedNodeData, new QPathEntry(Constants.JCR_LOCKOWNER, 0));
               if (dataLockOwner != null)
                  plainChangesLog.add(ItemState.createDeletedState(new TransientPropertyData(QPath.makeChildPath(
                     lockedNodeData.getQPath(), Constants.JCR_LOCKOWNER), dataLockOwner.getIdentifier(), 0,
                     dataLockOwner.getType(), dataLockOwner.getParentIdentifier(), dataLockOwner.isMultiValued())));

               if (plainChangesLog.getSize() > 0)
               {
                  transactionChangesLog.addLog(plainChangesLog);
               }
            }
         }
View Full Code Here

Examples of org.exoplatform.services.jcr.dataflow.PlainChangesLog

         if (nData == null)
         {
            return;
         }

         PlainChangesLog changesLog =
            new PlainChangesLogImpl(new ArrayList<ItemState>(), SystemIdentity.SYSTEM, ExtendedEvent.UNLOCK);

         ItemData lockOwner =
            copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKOWNER, 1),
               ItemType.PROPERTY));

         //TODO EXOJCR-412, should be refactored in future.
         //Skip removing, because that lock was removed in other node of cluster. 
         if (lockOwner == null)
         {
            return;
         }

         changesLog.add(ItemState.createDeletedState(lockOwner));

         ItemData lockIsDeep =
            copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKISDEEP, 1),
               ItemType.PROPERTY));

         //TODO EXOJCR-412, should be refactored in future.
         //Skip removing, because that lock was removed in other node of cluster. 
         if (lockIsDeep == null)
         {
            return;
         }

         changesLog.add(ItemState.createDeletedState(lockIsDeep));

         // lock probably removed by other thread
         if (lockOwner == null && lockIsDeep == null)
         {
            return;
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.