Package org.exoplatform.services.jcr.datamodel

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


      checkValid();

      if (!this.isNodeType(Constants.MIX_VERSIONABLE))
         throw new UnsupportedRepositoryOperationException("Node is not versionable " + getPath());

      PropertyData bvProp =
         (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_BASEVERSION, 1),
            ItemType.PROPERTY);
      try
      {
         return (Version)dataManager.getItemByIdentifier(ValueDataConvertor.readString(bvProp.getValues().get(0)),
            true, false);
      }
      catch (IOException e)
      {
         throw new RepositoryException("jcr:baseVersion property error " + e, e);
View Full Code Here


            {
               // full iterator
               List<PropertyImpl> props = new ArrayList<PropertyImpl>();
               for (int i = 0, length = childs.size(); i < length; i++)
               {
                  PropertyData child = childs.get(i);
                  PropertyImpl item = (PropertyImpl)dataManager.readItem(child, nodeData(), true, false);
                  session.getActionHandler().postRead(item);
                  props.add(item);

               }
View Full Code Here

            {
               // full iterator
               List<PropertyImpl> props = new ArrayList<PropertyImpl>();
               for (int i = 0, length = childs.size(); i < length; i++)
               {
                  PropertyData child = childs.get(i);
                  if (filter.accept(child))
                  {
                     PropertyImpl item = (PropertyImpl)dataManager.readItem(child, nodeData(), true, false);
                     session.getActionHandler().postRead(item);
                     props.add(item);
View Full Code Here

      Lock newLock = session.getLockManager().addLock(this, isDeep, isSessionScoped, -1);

      PlainChangesLog changesLog =
         new PlainChangesLogImpl(new ArrayList<ItemState>(), session.getId(), ExtendedEvent.LOCK);

      PropertyData propData =
         TransientPropertyData.createPropertyData(nodeData(), Constants.JCR_LOCKOWNER, PropertyType.STRING, false,
            new TransientValueData(session.getUserID()));
      changesLog.add(ItemState.createAddedState(propData));

      propData =
View Full Code Here

      Lock newLock = session.getLockManager().addLock(this, isDeep, false, timeOut);

      PlainChangesLog changesLog =
         new PlainChangesLogImpl(new ArrayList<ItemState>(), session.getId(), ExtendedEvent.LOCK);

      PropertyData propData =
         TransientPropertyData.createPropertyData(nodeData(), Constants.JCR_LOCKOWNER, PropertyType.STRING, false,
            new TransientValueData(session.getUserID()));
      changesLog.add(ItemState.createAddedState(propData));

      propData =
View Full Code Here

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

      session.getActionHandler().preRemoveMixin(this, name);

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

      // create new property data with new values
      TransientPropertyData prop =
         new TransientPropertyData(propData.getQPath(), propData.getIdentifier(), propData.getPersistedVersion(),
            propData.getType(), propData.getParentIdentifier(), propData.isMultiValued(), values);

      NodeTypeDataManager ntmanager = session.getWorkspace().getNodeTypesHolder();

      // remove mix:versionable stuff
      if (ntmanager.isNodeType(Constants.MIX_VERSIONABLE, removedName))
View Full Code Here

      if (!this.isNodeType(Constants.MIX_VERSIONABLE))
      {
         throw new UnsupportedRepositoryOperationException("Node is not mix:versionable " + getPath());
      }

      PropertyData vhProp =
         (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_VERSIONHISTORY, 1),
            ItemType.PROPERTY);
      if (vhProp == null)
         throw new UnsupportedRepositoryOperationException("Node does not have jcr:versionHistory " + getPath());

      try
      {
         return (VersionHistoryImpl)dataManager.getItemByIdentifier(new String(vhProp.getValues().get(0)
            .getAsByteArray()), pool, false);
      }
      catch (IOException e)
      {
         throw new RepositoryException("Error of version history ID read " + e, e);
View Full Code Here

   // ////////////////// Item implementation ////////////////////

   protected PropertyData updatePropertyData(InternalQName name, List<ValueData> values) throws RepositoryException
   {

      PropertyData existed =
         (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(name, 0), ItemType.PROPERTY);

      if (existed == null)
      {
         throw new RepositoryException("Property data is not found " + name.getAsString() + " for node "
            + nodeData().getQPath().getAsString());
      }

      if (!existed.isMultiValued())
      {
         throw new ValueFormatException("An existed property is single-valued " + name.getAsString());
      }

      TransientPropertyData tdata =
         new TransientPropertyData(QPath.makeChildPath(getInternalPath(), name), existed.getIdentifier(),
            existed.getPersistedVersion(), existed.getType(), existed.getParentIdentifier(), existed.isMultiValued(),
            values);

      return tdata;
   }
View Full Code Here

   }

   protected PropertyData updatePropertyData(InternalQName name, ValueData value) throws RepositoryException
   {

      PropertyData existed =
         (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(name, 0), ItemType.PROPERTY);

      if (existed == null)
         throw new RepositoryException("Property data is not found " + name.getAsString() + " for node "
            + nodeData().getQPath().getAsString());

      TransientPropertyData tdata =
         new TransientPropertyData(QPath.makeChildPath(getInternalPath(), name), existed.getIdentifier(),
            existed.getPersistedVersion(), existed.getType(), existed.getParentIdentifier(), existed.isMultiValued(),
            value);
      return tdata;

   }
View Full Code Here

   }

   private void removeMergeFailed(Version version, PlainChangesLog changesLog) throws RepositoryException
   {

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

      if (mergeFailed == null)
         return;

      List<ValueData> mf = new ArrayList<ValueData>();
      for (ValueData mfvd : mergeFailed.getValues())
      {
         try
         {
            byte[] mfb = mfvd.getAsByteArray();
            if (!version.getUUID().equals(new String(mfb)))
            {
               mf.add(new TransientValueData(mfb));
            }
         }
         catch (IOException e)
         {
            throw new RepositoryException("Remove jcr:mergeFailed error " + e, e);
         }
      }

      if (mf.size() > 0)
      {
         PropertyData mergeFailedRef =
            TransientPropertyData.createPropertyData(nodeData(), Constants.JCR_MERGEFAILED, PropertyType.REFERENCE,
               true, mf);
         changesLog.add(ItemState.createUpdatedState(mergeFailedRef));
      }
      else
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.