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

Examples of org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData


         TransientNodeData.createNodeData(nodeData(), new InternalQName(null, nextVersionName()), Constants.NT_VERSION,
            mixins, uuid, acl);
      changesLog.add(ItemState.createAddedState(versionData));

      // jcr:primaryType
      TransientPropertyData propData =
         TransientPropertyData.createPropertyData(versionData, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
            new TransientValueData(Constants.NT_VERSION));
      changesLog.add(ItemState.createAddedState(propData));

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

      // exo:owner
      if (isOwneable)
      {
         TransientPropertyData exoOwner =
            TransientPropertyData.createPropertyData(versionData, Constants.EXO_OWNER, PropertyType.STRING, false,
               new TransientValueData(acl.getOwner()));
         changesLog.add(ItemState.createAddedState(exoOwner));
      }

      // exo:permissions
      if (isPrivilegeable)
      {
         List<ValueData> permsValues = new ArrayList<ValueData>();
         for (AccessControlEntry entry : acl.getPermissionEntries())
         {
            permsValues.add(new TransientValueData(entry));
         }

         TransientPropertyData exoPerms =
            TransientPropertyData.createPropertyData(versionData, Constants.EXO_PERMISSIONS,
               ExtendedPropertyType.PERMISSION, true, permsValues);
         changesLog.add(ItemState.createAddedState(exoPerms));
      }
View Full Code Here


      TransientNodeData versionHistory =
         TransientNodeData.createNodeData(versionStorageData, vhName, Constants.NT_VERSIONHISTORY,
            versionHistoryIdentifier);

      // jcr:primaryType
      TransientPropertyData vhPrimaryType =
         TransientPropertyData.createPropertyData(versionHistory, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
            new TransientValueData(versionHistory.getPrimaryTypeName()));

      // jcr:uuid
      TransientPropertyData vhUuid =
         TransientPropertyData.createPropertyData(versionHistory, Constants.JCR_UUID, PropertyType.STRING, false,
            new TransientValueData(versionHistoryIdentifier));

      // jcr:versionableUuid
      TransientPropertyData vhVersionableUuid =
         TransientPropertyData
         // [PN] 10.04.07 VERSIONABLEUUID isn't referenceable!!!
            .createPropertyData(versionHistory, Constants.JCR_VERSIONABLEUUID, PropertyType.STRING, false,
               new TransientValueData(new Identifier(versionable.getIdentifier())));

      // ------ jcr:versionLabels ------
      NodeData vhVersionLabels =
         TransientNodeData.createNodeData(versionHistory, Constants.JCR_VERSIONLABELS, Constants.NT_VERSIONLABELS);

      // jcr:primaryType
      TransientPropertyData vlPrimaryType =
         TransientPropertyData.createPropertyData(vhVersionLabels, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
            new TransientValueData(vhVersionLabels.getPrimaryTypeName()));

      // ------ jcr:rootVersion ------
      NodeData rootVersionData =
         TransientNodeData.createNodeData(versionHistory, Constants.JCR_ROOTVERSION, Constants.NT_VERSION,
            baseVersionIdentifier);

      // jcr:primaryType
      TransientPropertyData rvPrimaryType =
         TransientPropertyData.createPropertyData(rootVersionData, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
            new TransientValueData(rootVersionData.getPrimaryTypeName()));

      // jcr:uuid
      TransientPropertyData rvUuid =
         TransientPropertyData.createPropertyData(rootVersionData, Constants.JCR_UUID, PropertyType.STRING, false,
            new TransientValueData(baseVersionIdentifier));

      // jcr:mixinTypes
      TransientPropertyData rvMixinTypes =
         TransientPropertyData.createPropertyData(rootVersionData, Constants.JCR_MIXINTYPES, PropertyType.NAME, true,
            new TransientValueData(Constants.MIX_REFERENCEABLE));

      // jcr:created    
      TransientPropertyData rvCreated =
         TransientPropertyData.createPropertyData(rootVersionData, Constants.JCR_CREATED, PropertyType.DATE, false,
            new TransientValueData(Calendar.getInstance()));

      // ----- VERSIONABLE properties -----
      // jcr:versionHistory
      TransientPropertyData vh =
         TransientPropertyData.createPropertyData(versionable, Constants.JCR_VERSIONHISTORY, PropertyType.REFERENCE,
            false, new TransientValueData(new Identifier(versionHistoryIdentifier)));

      // jcr:baseVersion
      TransientPropertyData bv =
         TransientPropertyData.createPropertyData(versionable, Constants.JCR_BASEVERSION, PropertyType.REFERENCE,
            false, new TransientValueData(new Identifier(baseVersionIdentifier)));

      // jcr:predecessors
      TransientPropertyData pd =
         TransientPropertyData.createPropertyData(versionable, Constants.JCR_PREDECESSORS, PropertyType.REFERENCE,
            true, new TransientValueData(new Identifier(baseVersionIdentifier)));

      // update all
      QPath vpath = versionable.getQPath();
View Full Code Here

         rootNode =
            new TransientNodeData(Constants.ROOT_PATH, Constants.ROOT_UUID, -1, rootNodeType, mixins, 0, null, acl);
         changesLog.add(new ItemState(rootNode, ItemState.ADDED, false, null));

         TransientPropertyData primaryType =
            new TransientPropertyData(QPath.makeChildPath(rootNode.getQPath(), Constants.JCR_PRIMARYTYPE), IdGenerator
               .generate(), -1, PropertyType.NAME, rootNode.getIdentifier(), false,
               new TransientValueData(rootNodeType));

         changesLog.add(new ItemState(primaryType, ItemState.ADDED, false, null)); //

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

         TransientPropertyData exoOwner =
            TransientPropertyData.createPropertyData(rootNode, 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(rootNode, Constants.EXO_PERMISSIONS,
               ExtendedPropertyType.PERMISSION, true, permsValues);

         changesLog.add(ItemState.createAddedState(exoMixinTypes)).add(ItemState.createAddedState(exoOwner)).add(
            ItemState.createAddedState(exoPerms));
         changesLog.add(new ItemState(rootNode, ItemState.MIXIN_CHANGED, false, null));
      }
      else
      {
         rootNode =
            new TransientNodeData(Constants.ROOT_PATH, Constants.ROOT_UUID, -1, rootNodeType, new InternalQName[0], 0,
               null, new AccessControlList());
         changesLog.add(new ItemState(rootNode, ItemState.ADDED, false, null));

         TransientPropertyData primaryType =
            new TransientPropertyData(QPath.makeChildPath(rootNode.getQPath(), Constants.JCR_PRIMARYTYPE), IdGenerator
               .generate(), -1, PropertyType.NAME, rootNode.getIdentifier(), false,
               new TransientValueData(rootNodeType));
         changesLog.add(new ItemState(primaryType, ItemState.ADDED, false, null)); //
      }
View Full Code Here

            TransientNodeData.createNodeData(root, Constants.JCR_SYSTEM, Constants.NT_UNSTRUCTURED, mixins,
               Constants.SYSTEM_UUID);

         AccessControlList acl = jcrSystem.getACL();

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

         changesLog.add(ItemState.createAddedState(jcrSystem)).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(jcrSystem, Constants.JCR_MIXINTYPES, PropertyType.NAME, true,
               mixValues);

         TransientPropertyData exoOwner =
            TransientPropertyData.createPropertyData(jcrSystem, 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(jcrSystem, Constants.EXO_PERMISSIONS,
               ExtendedPropertyType.PERMISSION, true, permsValues);

         changesLog.add(ItemState.createAddedState(exoMixinTypes)).add(ItemState.createAddedState(exoOwner)).add(
            ItemState.createAddedState(exoPerms));
         changesLog.add(new ItemState(jcrSystem, ItemState.MIXIN_CHANGED, false, null));
      }
      else
      {
         jcrSystem =
            TransientNodeData.createNodeData(root, Constants.JCR_SYSTEM, Constants.NT_UNSTRUCTURED,
               Constants.SYSTEM_UUID);

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

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

      // init version storage
      AccessControlList acl = new AccessControlList();
      acl.removePermissions(SystemIdentity.ANY);
      acl.addPermissions(SystemIdentity.ANY, new String[]{PermissionType.READ});

      for (AccessControlEntry entry : jcrSystem.getACL().getPermissionEntries())
      {
         String identity = entry.getIdentity();
         String permission = entry.getPermission();

         if (!identity.equals(SystemIdentity.ANY) || !permission.equals(PermissionType.READ))
         {
            acl.addPermissions(identity, new String[]{permission});
         }
      }

      TransientNodeData versionStorageNodeData =
         TransientNodeData.createNodeData(jcrSystem, Constants.JCR_VERSIONSTORAGE, Constants.EXO_VERSIONSTORAGE,
            Constants.VERSIONSTORAGE_UUID, acl);

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

      TransientPropertyData exoMixinTypes =
         TransientPropertyData.createPropertyData(versionStorageNodeData, Constants.JCR_MIXINTYPES, PropertyType.NAME,
            true, new TransientValueData(Constants.EXO_PRIVILEGEABLE));

      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(versionStorageNodeData, Constants.EXO_PERMISSIONS,
            ExtendedPropertyType.PERMISSION, true, permsValues);

      changesLog.add(ItemState.createAddedState(versionStorageNodeData));
      changesLog.add(ItemState.createAddedState(vsPrimaryType));
View Full Code Here

      try
      {
         String propertyId = exctractId(resultSet, DBConstants.COLUMN_ID);
         QPath path = QPath.parse(resultSet.getString(DBConstants.COLUMN_NAME));

         PropertyData data = new TransientPropertyData(path, propertyId, 0, 0, null, false, new ArrayList<ValueData>());

         conn.delete(data);
      }
      catch (UnsupportedOperationException e)
      {
View Full Code Here

      try
      {
         String propertyId = exctractId(resultSet, DBConstants.COLUMN_VPROPERTY_ID);
         QPath path = QPath.parse("[]");

         PropertyData data = new TransientPropertyData(path, propertyId, 0, 0, null, false, new ArrayList<ValueData>());

         conn.delete(data);
      }
      catch (IllegalPathException e)
      {
View Full Code Here

         {
            String propertyId = exctractId(resultSet, DBConstants.COLUMN_ID);
            QPath path = new QPath(new QPathEntry[]{extractName(resultSet)});

            PropertyData data =
               new TransientPropertyData(path, propertyId, 0, 0, null, false, new ArrayList<ValueData>());

            conn.delete(data);
         }
         else
         {
View Full Code Here

      {
         return null;
      }

      // make a copy, value may be null for deleting items
      TransientPropertyData newData =
         new TransientPropertyData(prop.getQPath(), prop.getIdentifier(), prop.getPersistedVersion(), prop.getType(),
            prop.getParentIdentifier(), prop.isMultiValued(), prop.getValues());

      return newData;
   }
View Full Code Here

      // update primary type

      final PropertyData item =
         (PropertyData)this.dataManager.getItemData(nodeData, new QPathEntry(Constants.JCR_PRIMARYTYPE, 1));

      final TransientPropertyData primaryTypeData =
         new TransientPropertyData(item.getQPath(), item.getIdentifier(), item.getPersistedVersion(), item.getType(),
            item.getParentIdentifier(), item.isMultiValued(), new TransientValueData(nodeTypeName));

      changesLog.add(ItemState.createUpdatedState(primaryTypeData, true));

      final List<NodeData> affectedNodes = new ArrayList<NodeData>();
View Full Code Here

      ItemState state;

      if (prop != null)
      {// there was mixin prop
         prop =
            new TransientPropertyData(prop.getQPath(), prop.getIdentifier(), prop.getPersistedVersion(),
               prop.getType(), prop.getParentIdentifier(), prop.isMultiValued(), values);

         state = ItemState.createUpdatedState(prop);
      }
      else
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData

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.