Package org.exoplatform.services.jcr.datamodel

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


    *
    * @see org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager#getItemData(java.lang.String)
    */
   protected ItemData getPersistedItemData(String identifier) throws RepositoryException
   {
      ItemData data = super.getItemData(identifier);
      if (data != null && cache.isEnabled())
      {
         cache.put(data);
      }
      return data;
View Full Code Here


   /**
    * {@inheritDoc}
    */
   public ItemData getItemData(NodeData parent, QPathEntry name, ItemType itemType) throws RepositoryException
   {
      final ItemData item = persistentManager.getItemData(parent, name, itemType);
      return item != null && item.isNode() ? initACL(parent, (NodeData)item) : item;
   }
View Full Code Here

   /**
    * {@inheritDoc}
    */
   public ItemData getItemData(String identifier) throws RepositoryException
   {
      final ItemData item = persistentManager.getItemData(identifier);
      return item != null && item.isNode() ? initACL(null, (NodeData)item) : item;
   }
View Full Code Here

   {
      if (enabled && parentId != null && name != null)
      {
         try
         {
            ItemData itemData = null;
            if (itemType == ItemType.NODE || itemType == ItemType.UNKNOWN)
            {
               itemData = getItem(parentId, name, ItemType.NODE);
            }
View Full Code Here

      {
         final CacheId k = new CacheId(identifier);
         final CacheValue v = cache.get(k);
         if (v != null)
         {
            final ItemData c = v.getItem();

            if (v.getExpiredTime() > System.currentTimeMillis())
            {
               // check if wasn't removed
               if (LOG.isDebugEnabled())
                  LOG.debug(name + ", getItem() " + identifier + " --> "
                     + (c != null ? c.getQPath().getAsString() + " parent:" + c.getParentIdentifier() : "[null]"));

               hits++;
               return c;
            }

            // remove expired
            writeLock.lock();
            try
            {
               cache.remove(k);

               // remove by parentId + path
               cache.remove(new CacheQPath(c.getParentIdentifier(), c.getQPath(), ItemType.getItemType(c)));

               // remove cached child lists
               if (c.isNode())
               {
                  nodesCache.remove(c.getIdentifier());
                  propertiesCache.remove(c.getIdentifier());
               }
            }
            finally
            {
               writeLock.unlock();
View Full Code Here

      {
         final CacheQPath k = new CacheQPath(parentUuid, qname, itemType);
         final CacheValue v = cache.get(k);
         if (v != null)
         {
            final ItemData c = v.getItem();

            if (v.getExpiredTime() > System.currentTimeMillis())
            {
               if (LOG.isDebugEnabled())
                  LOG.debug(name + ", getItem() " + (c != null ? c.getQPath().getAsString() : "[null]") + " --> "
                     + (c != null ? c.getIdentifier() + " parent:" + c.getParentIdentifier() : "[null]"));

               hits++;
               return c;
            }

            // remove expired
            writeLock.lock();
            try
            {
               cache.remove(k);

               // remove by Id
               cache.remove(new CacheId(c.getIdentifier()));

               // remove cached child lists
               if (c.isNode())
               {
                  nodesCache.remove(c.getIdentifier());
                  propertiesCache.remove(c.getIdentifier());
               }
            }
            finally
            {
               writeLock.unlock();
View Full Code Here

      ItemState prevState = null;
      for (Iterator<ItemState> iter = changesLog.getAllStates().iterator(); iter.hasNext();)
      {
         ItemState state = iter.next();
         ItemData item = state.getData();
         if (LOG.isDebugEnabled())
            LOG.debug(name + ", onSaveItems() " + ItemState.nameFromValue(state.getState()) + " "
               + item.getQPath().getAsString() + " " + item.getIdentifier() + " parent:" + item.getParentIdentifier());

         try
         {
            if (state.isAdded())
            {
               put(item);
            }
            else if (state.isDeleted())
            {
               remove(item);
            }
            else if (state.isRenamed())
            {
               // MOVE operation (DESTENATION changes, same as ADDED), states for whole subtree!
               // RENAME goes before DELETE
               put(item);
            }
            else if (state.isUpdated())
            {
               // UPDATE occurs on reordered (no subtree!) and merged nodes (for each
               // merged-updated)
               if (item.isNode())
               {
                  if (prevState != null)
                  {
                     // play only for reorder, UPDATE goes after DELETE of same path
                     // item
                     // we have to unload node and its parent child nodes to be loaded
                     // back from the persistence
                     if (prevState.isDeleted()
                        && prevState.getData().getParentIdentifier().equals(item.getParentIdentifier()))
                        removeSiblings((NodeData)item);
                  }
               }
               else if (item.getQPath().getName().equals(Constants.EXO_PERMISSIONS))
               {
                  // TODO EXOJCR-12 place to put workaround for JCR cache exo:permissions updated
                  // get parent Node

                  // check if parent is mix:privilegeable
                  ItemData parent = get(item.getParentIdentifier());
                  // delete parent
                  remove(parent);

                  writeLock.lock();
                  try
                  {
                     // delete parent containing child nodes list
                     nodesCache.remove(parent.getParentIdentifier());

                     // traverse itemCache
                     Iterator<CacheValue> cacheIterator = cache.values().iterator();
                     while (cacheIterator.hasNext())
                     {
                        ItemData cachedItem = cacheIterator.next().getItem();
                        if (cachedItem.isNode())
                        {
                           if (cachedItem.getQPath().isDescendantOf(parent.getQPath()))
                           {
                              cacheIterator.remove();
                           }
                        }
                     }
View Full Code Here

         NodeTypeDataManager ntManager = session.getWorkspace().getNodeTypesHolder();
         NodeData node = (NodeData)data;
         if (ntManager.isNodeType(Constants.MIX_VERSIONABLE, node.getPrimaryTypeName(), node.getMixinTypeNames()))
         {

            ItemData vhpd =
               dataManager.getItemData(node, new QPathEntry(Constants.JCR_VERSIONHISTORY, 1), ItemType.PROPERTY);
            if (vhpd != null && !vhpd.isNode())
            {
               try
               {
                  String vhID = new String(((PropertyData)vhpd).getValues().get(0).getAsByteArray());
                  dataManager.removeVersionHistory(vhID, null, data.getQPath());
View Full Code Here

      {
         log.warn(" Storage not initialized");
         return null;
      }
      //Searching nodeType root
      ItemData nodeType = dataManager.getItemData(nodeTypeStorageRoot, new QPathEntry(nodeTypeName, 1), ItemType.NODE);
      if (nodeType == null)
         throw new NoSuchNodeTypeException("Node type definition " + nodeTypeName.getAsString() + "not found");
      if (!nodeType.isNode())
         throw new RepositoryException("Unexpected property found " + nodeType.getQPath().getAsString()
            + ". Should be node.");

      NodeData nodeTypeRoot = (NodeData)nodeType;

      if (!Constants.NT_NODETYPE.equals(nodeTypeRoot.getPrimaryTypeName()))
View Full Code Here

         {
            // remove with subnodes
            final CacheValue v = eldest.getValue();
            if (v != null)
            {
               final ItemData item = v.getItem();
               if (item.isNode())
               {
                  // removing childs of the node
                  nodesCache.remove(item.getIdentifier());
                  propertiesCache.remove(item.getIdentifier());
               }
            }

            return true;
         }
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.datamodel.ItemData

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.