Package org.exoplatform.services.jcr.datamodel

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


   public String getVersionableUUID() throws RepositoryException
   {

      checkValid();

      PropertyData versionableUuid =
         (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_VERSIONABLEUUID, 0),
            ItemType.PROPERTY);

      if (versionableUuid != null)
      {
         try
         {
            return new String(versionableUuid.getValues().get(0).getAsByteArray());
         }
         catch (IllegalStateException e)
         {
            LOG.error("jcr:versionableUuid, error of read " + e + ". Version history " + getPath(), e);
         }
View Full Code Here


      }

      // remove this version from successor anf predecessor list
      // and point successor to predecessor directly

      PropertyData successorsData =
         (PropertyData)dataManager.getItemData((NodeData)version.getData(),
            new QPathEntry(Constants.JCR_SUCCESSORS, 0), ItemType.PROPERTY);

      // jcr:predecessors
      PropertyData predecessorsData =
         (PropertyData)dataManager.getItemData((NodeData)version.getData(), new QPathEntry(Constants.JCR_PREDECESSORS,
            0), ItemType.PROPERTY);

      try
      {
         for (ValueData pvalue : predecessorsData.getValues())
         {
            String pidentifier = new String(pvalue.getAsByteArray());
            VersionImpl predecessor = (VersionImpl)dataManager.getItemByIdentifier(pidentifier, false);
            // actually predecessor is V2's successor
            if (predecessor != null)
            {// V2's successor
               if (successorsData != null)
               {// to redirect V2's successor
                  // case of VH graph merge
                  for (ValueData svalue : successorsData.getValues())
                  {
                     predecessor.removeAddSuccessor(version.getInternalIdentifier(),
                        new String(svalue.getAsByteArray()), changes);
                  }
               }
               else
               {
                  // case of VH last version remove
                  predecessor.removeSuccessor(version.getInternalIdentifier(), changes);
               }
            }
            else
            {
               throw new RepositoryException("A predecessor (" + pidentifier + ") of the version " + version.getPath()
                  + " is not found.");
            }
         }
      }
      catch (IOException e)
      {
         throw new RepositoryException("Get predecessor " + version.getPath() + " error " + e, e);
      }

      try
      {
         if (successorsData != null)
         {
            for (ValueData svalue : successorsData.getValues())
            {
               String sidentifier = new String(svalue.getAsByteArray());
               VersionImpl successor = (VersionImpl)dataManager.getItemByIdentifier(sidentifier, false);
               if (successor != null)
               {
                  // case of VH graph merge
                  for (ValueData pvalue : predecessorsData.getValues())
                  {
                     successor.removeAddPredecessor(version.getInternalIdentifier(),
                        new String(pvalue.getAsByteArray()), changes);
                  }
               }
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

      checkValid();

      JCRName jcrLabelName = locationFactory.parseJCRName(labelName);
      InternalQName labelQName = jcrLabelName.getInternalName();

      PropertyData vldata =
         (PropertyData)dataManager.getItemData(getData().getVersionLabelsData(), new QPathEntry(labelQName, 0),
            ItemType.PROPERTY);

      if (vldata != null)
      {
View Full Code Here

      {
         synchronized (childProperties)
         { // [PN] 17.01.07
            for (Iterator<PropertyData> i = childProperties.iterator(); i.hasNext();)
            {
               PropertyData cn = i.next();
               if (cn.getIdentifier().equals(childIdentifier))
               {
                  i.remove();
                  if (childProperties.size() <= 0)
                     propertiesCache.remove(parentIdentifier);
                  return cn;
View Full Code Here

      {
         List<PropertyData> propDatas = getChildPropertiesData(parent);
         List<PropertyImpl> props = new ArrayList<PropertyImpl>(propDatas.size());
         for (int i = 0, length = propDatas.size(); i < length; i++)
         {
            PropertyData data = propDatas.get(i);
            if (accessManager.hasPermission(parent.getACL(), new String[]{PermissionType.READ}, session.getUserState()
               .getIdentity()))
            {
               ItemImpl item = readItem(data, parent, pool, false);
               session.getActionHandler().postRead(item);
View Full Code Here

         if (checkRemoveChildVersionStorages && !data.isNode()
            && Constants.JCR_VERSIONHISTORY.equals(data.getQPath().getName()))
         {
            try
            {
               PropertyData vhPropertyData = (PropertyData)getItemData(data.getIdentifier());
               removeVersionHistory(new String(vhPropertyData.getValues().get(0).getAsByteArray()), null,
                  ancestorToSave);
            }
            catch (IllegalStateException e)
            {
               throw new RepositoryException(e.getLocalizedMessage(), e);
View Full Code Here

         List<ValueData> data = null;
         if (node.getQPath().getName().equals(Constants.JCR_CONTENT))
         {

            // seems nt:file found, try for nt:resource props
            PropertyData pmime =
               (PropertyData)stateProvider.getItemData(node, new QPathEntry(Constants.JCR_MIMETYPE, 0),
                  ItemType.PROPERTY);
            if (pmime != null)
            {
               // ok, have a reader
               // if the prop obtainer from cache it will contains a values,
               // otherwise read prop with values from DM
               PropertyData propData =
                  prop.getValues().size() > 0 ? prop : ((PropertyData)stateProvider.getItemData(node, new QPathEntry(
                     Constants.JCR_DATA, 0), ItemType.PROPERTY));

               // index if have jcr:mimeType sibling for this binary property only
               try
               {
                  DocumentReader dreader =
                     extractor.getDocumentReader(new String(pmime.getValues().get(0).getAsByteArray(),
                        Constants.DEFAULT_ENCODING));

                  data = propData.getValues();

                  if (data == null)
                  {
                     log.warn("null value found at property " + prop.getQPath().getAsString());
                  }

                  // check the jcr:encoding property
                  PropertyData encProp =
                     (PropertyData)stateProvider.getItemData(node, new QPathEntry(Constants.JCR_ENCODING, 0),
                        ItemType.PROPERTY);

                  String encoding = null;
                  if (encProp != null)
                  {
                     // encoding parameter used
                     encoding = new String(encProp.getValues().get(0).getAsByteArray(), Constants.DEFAULT_ENCODING);
                  }

                  if (dreader instanceof AdvancedDocumentReader)
                  {
                     // its a tika document reader that supports getContentAsReader
View Full Code Here

            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

      {
         List<PropertyData> propDatas = getChildPropertiesData(parent);
         List<PropertyImpl> props = new ArrayList<PropertyImpl>(propDatas.size());
         for (int i = 0, length = propDatas.size(); i < length; i++)
         {
            PropertyData data = propDatas.get(i);
            if (accessManager.hasPermission(parent.getACL(), new String[]{PermissionType.READ}, session.getUserState()
               .getIdentity()))
            {
               ItemImpl item = readItem(data, parent, pool, false);
               session.getActionHandler().postRead(item);
View Full Code Here

TOP

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

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.