Package org.exoplatform.services.jcr.datamodel

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


         // skip if no parent - parent is COMPUTE, INITIALIZE
         return;
      }

      PropertyData frozenProperty = null;
      InternalQName qname = property.getQPath().getName();

      List<ValueData> values = copyValues(property);

      boolean mv = property.isMultiValued();

      if (qname.equals(Constants.JCR_PRIMARYTYPE) && level == 1)
      {
         frozenProperty =
            TransientPropertyData.createPropertyData(currentNode(), Constants.JCR_FROZENPRIMARYTYPE, PropertyType.NAME,
               mv, values);
      }
      else if (qname.equals(Constants.JCR_UUID) && level == 1)
      {
         frozenProperty =
            TransientPropertyData.createPropertyData(currentNode(), Constants.JCR_FROZENUUID, PropertyType.STRING, mv,
               values);
      }
      else if (qname.equals(Constants.JCR_MIXINTYPES) && level == 1)
      {
         frozenProperty =
            TransientPropertyData.createPropertyData(currentNode(), Constants.JCR_FROZENMIXINTYPES, PropertyType.NAME,
               mv, values);
      }
      else
      {
         NodeData parent = (NodeData)dataManager.getItemData(property.getParentIdentifier());

         PropertyDefinitionData pdef =
            ntManager.getPropertyDefinitions(qname, parent.getPrimaryTypeName(), parent.getMixinTypeNames())
               .getAnyDefinition();

         int action = pdef.getOnParentVersion();

         if (action == OnParentVersionAction.IGNORE)
         {
            return;
         }
         else if (action == OnParentVersionAction.ABORT)
         {
            throw new VersionException("Property is aborted " + property.getQPath().getAsString());
         }
         else if (action == OnParentVersionAction.COPY || action == OnParentVersionAction.VERSION
            || action == OnParentVersionAction.COMPUTE)
         {
            frozenProperty =
               TransientPropertyData.createPropertyData(currentNode(), qname, property.getType(), mv, values);
         }
         else if (action == OnParentVersionAction.INITIALIZE)
         {
            // 8.2.11.3 INITIALIZE
            // On checkin of N, a new P will be created and placed in version
            // storage as a child of VN. The new P will be initialized just as it
            // would
            // be if created normally in a workspace
            if (pdef.isAutoCreated())
            {
               if (pdef.getDefaultValues() != null && pdef.getDefaultValues().length > 0)
               {
                  // to use default values
                  values.clear();
                  for (String defValue : pdef.getDefaultValues())
                  {
                     ValueData defData;
                     if (PropertyType.UNDEFINED == pdef.getRequiredType())
                     {
                        defData = ((BaseValue)valueFactory.createValue(defValue)).getInternalData();
                     }
                     else
                     {
                        defData =
                           ((BaseValue)valueFactory.createValue(defValue, pdef.getRequiredType())).getInternalData();
                     }
                     // TransientValueData defData = ((BaseValue)
                     // defValue).getInternalData();
                     // values.add(defData.createTransientCopy());
                     values.add(defData);
                  }
               }
               else if (ntManager.isNodeType(Constants.NT_HIERARCHYNODE, parent.getPrimaryTypeName(), parent
                  .getMixinTypeNames())
                  && qname.equals(Constants.JCR_CREATED))
               {
                  // custom logic for nt:hierarchyNode jcr:created
                  values.clear();
                  values.add(new TransientValueData(dataManager.getTransactManager().getStorageDataManager()
                     .getCurrentTime()));
View Full Code Here


         if (log.isDebugEnabled())
            log.debug("Entering node " + node.getQPath().getAsString() + ", HAS NULL PARENT");
         return;
      }

      InternalQName qname = node.getQPath().getName();

      NodeData parent = (NodeData)dataManager.getItemData(node.getParentIdentifier());
      NodeDefinitionData ndef =
         ntManager.getChildNodeDefinition(qname, parent.getPrimaryTypeName(), parent.getMixinTypeNames());
      if (ndef == null)
      {
         throw new ConstraintViolationException("Definition not found for " + qname.getAsString());
      }
      int action = ndef.getOnParentVersion();

      if (log.isDebugEnabled())
         log.debug("Entering node " + node.getQPath().getAsString() + ", "
View Full Code Here

      public int compare(P p1, P p2)
      {
         int r = 0;
         try
         {
            InternalQName qname1 = p1.getQPath().getName();
            InternalQName qname2 = p2.getQPath().getName();
            if (qname1.equals(Constants.JCR_PRIMARYTYPE))
            {
               r = Integer.MIN_VALUE;
            }
            else if (qname2.equals(Constants.JCR_PRIMARYTYPE))
            {
               r = Integer.MAX_VALUE;
            }
            else if (qname1.equals(Constants.JCR_MIXINTYPES))
            {
               r = Integer.MIN_VALUE + 1;
            }
            else if (qname2.equals(Constants.JCR_MIXINTYPES))
            {
               r = Integer.MAX_VALUE - 1;
            }
            else if (qname1.equals(Constants.JCR_UUID))
            {
               r = Integer.MIN_VALUE + 2;
            }
            else if (qname2.equals(Constants.JCR_UUID))
            {
               r = Integer.MAX_VALUE - 2;
            }
            else
            {
               r = qname1.getAsString().compareTo(qname2.getAsString());
            }
         }
         catch (Exception e)
         {
            LOG.error("PropertiesDataOrderComparator error: " + e, e);
View Full Code Here

                           if (parents.size() > 0)
                           {
                              // path to a new node
                              SVNodeData parent = parents.peek();

                              InternalQName name = locationFactory.parseJCRName(svName).getInternalName();

                              int[] chi = parent.addChildNode(name);
                              orderNumber = chi[0];
                              int index = chi[1];
                              currentPath = QPath.makeChildPath(parent.getQPath(), name, index);
View Full Code Here

      public int compare(P p1, P p2)
      {
         int r = 0;
         try
         {
            InternalQName qname1 = p1.getQPath().getName();
            InternalQName qname2 = p2.getQPath().getName();
            if (qname1.equals(Constants.JCR_PRIMARYTYPE))
            {
               r = Integer.MIN_VALUE;
            }
            else if (qname2.equals(Constants.JCR_PRIMARYTYPE))
            {
               r = Integer.MAX_VALUE;
            }
            else if (qname1.equals(Constants.JCR_MIXINTYPES))
            {
               r = Integer.MIN_VALUE + 1;
            }
            else if (qname2.equals(Constants.JCR_MIXINTYPES))
            {
               r = Integer.MAX_VALUE - 1;
            }
            else if (qname1.equals(Constants.JCR_UUID))
            {
               r = Integer.MIN_VALUE + 2;
            }
            else if (qname2.equals(Constants.JCR_UUID))
            {
               r = Integer.MAX_VALUE - 2;
            }
            else
            {
               r = qname1.getAsString().compareTo(qname2.getAsString());
            }
         }
         catch (Exception e)
         {
            LOG.error("PropertiesDataOrderComparator error: " + e, e);
View Full Code Here

      checkValid();

      if (LOG.isDebugEnabled())
         LOG.debug("Node.addMixin " + mixinName + " " + getPath());

      InternalQName name = locationFactory.parseJCRName(mixinName).getInternalName();

      // Does the node already has the mixin
      for (InternalQName mixin : nodeData().getMixinTypeNames())
      {
         if (name.equals(mixin))
         {
            // we already have this mixin type
            LOG.warn("Node already of mixin type " + mixinName + " " + getPath());
            return;
         }
View Full Code Here

         throw new PathNotFoundException("Parent not found for " + itemPath.getAsString(true));
      if (!parentItem.isNode())
         throw new ConstraintViolationException("Parent item is not a node " + parentItem.getPath());

      NodeImpl parent = (NodeImpl)parentItem;
      InternalQName name = itemPath.getName().getInternalName();

      // find node type
      NodeDefinitionData nodeDef =
         session.getWorkspace().getNodeTypesHolder()
            .getChildNodeDefinition(name, nodeData().getPrimaryTypeName(), nodeData().getMixinTypeNames());

      if (nodeDef == null)
         throw new ConstraintViolationException("Can not define node type for " + name.getAsString());
      InternalQName primaryTypeName = nodeDef.getName();

      if (nodeDef.getName().equals(name) || primaryTypeName.equals(Constants.JCR_ANY_NAME))

         primaryTypeName = nodeDef.getDefaultPrimaryType();
      // try to make new node
      return doAddNode(parent, name, primaryTypeName, nodeDef);
View Full Code Here

         throw new PathNotFoundException("Parent not found for " + itemPath.getAsString(true));
      if (!parentItem.isNode())
         throw new ConstraintViolationException("Parent item is not a node " + parentItem.getPath());
      NodeImpl parent = (NodeImpl)parentItem;

      InternalQName name = itemPath.getName().getInternalName();
      InternalQName ptName = locationFactory.parseJCRName(nodeTypeName).getInternalName();

      // try to make new node
      return doAddNode(parent, name, ptName, null);
   }
View Full Code Here

      List<InternalQName> newMixin = new ArrayList<InternalQName>(mixinTypes.length + 1);
      List<ValueData> values = new ArrayList<ValueData>(mixinTypes.length + 1);

      for (int i = 0; i < mixinTypes.length; i++)
      {
         InternalQName cn = mixinTypes[i];
         newMixin.add(cn);
         values.add(new TransientValueData(cn));
      }
      newMixin.add(type.getName());
      values.add(new TransientValueData(type.getName()));
View Full Code Here

         { // root - no parent
            if (nodeDefinition == null)
            {
               NodeType required =
                  nodeTypeManager.getNodeType(locationFactory.createJCRName(Constants.NT_BASE).getAsString());
               InternalQName requiredName = sysLocFactory.parseJCRName(required.getName()).getInternalName();
               NodeDefinitionData ntData =
                  new NodeDefinitionData(null, null, true, true, OnParentVersionAction.ABORT, false,
                     new InternalQName[]{requiredName}, null, true);
               this.nodeDefinition =
                  new NodeDefinitionImpl(ntData, nodeTypesHolder, nodeTypeManager, sysLocFactory,
View Full Code Here

TOP

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

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.