Package org.exoplatform.services.jcr.core.nodetype

Examples of org.exoplatform.services.jcr.core.nodetype.NodeTypeData


    * @see #unregisterNodeTypes(Collection)
    */
   public void unregisterNodeType(InternalQName nodeTypeName) throws RepositoryException
   {

      NodeTypeData nodeType = hierarchy.getNodeType(nodeTypeName);
      if (nodeType == null)
         throw new NoSuchNodeTypeException(nodeTypeName.getAsString());
      // check build in
      if (buildInNodeTypesNames.contains(nodeTypeName))
         throw new RepositoryException(nodeTypeName.toString() + ": can't unregister built-in node type.");
View Full Code Here


         InternalQName primaryItemName = null;
         if (ntvalue.getPrimaryItemName() != null)
            primaryItemName = locationFactory.parseJCRName(ntvalue.getPrimaryItemName()).getInternalName();

         NodeTypeData nodeTypeData =
                  new NodeTypeData(ntName, primaryItemName, ntvalue.isMixin(), ntvalue.isOrderableChild(), supertypes,
                           props, nodes);

         validateNodeType(nodeTypeData);
         nodeTypeDataList.put(nodeTypeData.getName(), nodeTypeData);
      }
      checkCyclicDependencies(nodeTypeDataList);
      return nodeTypeDataList;
   }
View Full Code Here

      Set<InternalQName> unresolvedDependecies = new HashSet<InternalQName>();
      Set<InternalQName> resolvedDependecies = new HashSet<InternalQName>();
      for (Entry<InternalQName, NodeTypeData> entry : nodeTypeDataList.entrySet())
      {
         // / add itself
         NodeTypeData nodeTypeData = entry.getValue();
         resolvedDependecies.add(nodeTypeData.getName());
         // remove from unresolved
         unresolvedDependecies.remove(nodeTypeData.getName());
         // check suppers
         for (int i = 0; i < nodeTypeData.getDeclaredSupertypeNames().length; i++)
         {
            InternalQName superName = nodeTypeData.getDeclaredSupertypeNames()[i];
            if (hierarchy.getNodeType(superName) == null && !resolvedDependecies.contains(superName))
            {
               unresolvedDependecies.add(superName);
            }
         }
         // check node definition
         for (int i = 0; i < nodeTypeData.getDeclaredChildNodeDefinitions().length; i++)
         {
            NodeDefinitionData childnodeDefinitionData = nodeTypeData.getDeclaredChildNodeDefinitions()[i];
            for (int j = 0; j < childnodeDefinitionData.getRequiredPrimaryTypes().length; j++)
            {
               InternalQName requiredPrimaryTypeName = childnodeDefinitionData.getRequiredPrimaryTypes()[j];
               if (hierarchy.getNodeType(requiredPrimaryTypeName) == null
                        && !resolvedDependecies.contains(requiredPrimaryTypeName))
View Full Code Here

         defs.add(cnd);
      }

      for (InternalQName suname : nodeType.getDeclaredSupertypeNames())
      {
         NodeTypeData superNodeType = volatileNodeTypes.get(suname);
         if (superNodeType == null)
            superNodeType = hierarchy.getNodeType(suname);
         NodeDefinitionData[] superDefinitionData = getAllChildNodeDefinitions(superNodeType, volatileNodeTypes);
         for (int i = 0; i < superDefinitionData.length; i++)
         {
View Full Code Here

      for (PropertyDefinitionData pd : recipientDefinition.getDeclaredPropertyDefinitions())
         defs.add(pd);

      for (InternalQName suname : recipientDefinition.getDeclaredSupertypeNames())
      {
         NodeTypeData superNodeType = volatileNodeTypes.get(suname);
         if (superNodeType == null)
            superNodeType = hierarchy.getNodeType(suname);
         PropertyDefinitionData[] superDefinitionData = getAllPropertyDefinitions(superNodeType, volatileNodeTypes);
         for (int i = 0; i < superDefinitionData.length; i++)
         {
View Full Code Here

      String mixinTypesField = locationFactory.createJCRName(Constants.JCR_MIXINTYPES).getAsString();
      String primaryTypeField = locationFactory.createJCRName(Constants.JCR_PRIMARYTYPE).getAsString();

      // ExtendedNodeTypeManager ntMgr =
      // session.getWorkspace().getNodeTypeManager();
      NodeTypeData base = findNodeType(nodeType);

      if (base.isMixin())
      {
         // search for nodes where jcr:mixinTypes is set to this mixin
         Term t =
                  new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(mixinTypesField, locationFactory
                           .createJCRName(nodeType).getAsString()));
         terms.add(t);
      }
      else
      {
         // search for nodes where jcr:primaryType is set to this type
         Term t =
                  new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(primaryTypeField, locationFactory
                           .createJCRName(nodeType).getAsString()));
         terms.add(t);
      }

      // now search for all node types that are derived from base
      Set<InternalQName> allTypes = getSubtypes(nodeType);
      for (InternalQName descendantNt : allTypes)
      {

         String ntName = locationFactory.createJCRName(descendantNt).getAsString();
         NodeTypeData nt = findNodeType(descendantNt);
         Term t;
         if (nt.isMixin())
         {
            // search on jcr:mixinTypes
            t = new Term(FieldNames.PROPERTIES, FieldNames.createNamedValue(mixinTypesField, ntName));
         }
         else
View Full Code Here

         throw new RepositoryException("NodeType implementation class " + nodeType.getClass().getName()
                  + " is not supported in this method");
      }
      PlainChangesLog changesLog = new PlainChangesLogImpl();

      NodeTypeData registeredNodeType = findNodeType(qname);
      if (registeredNodeType != null)
      {
         switch (alreadyExistsBehaviour)
         {
            case ExtendedNodeTypeManager.FAIL_IF_EXISTS :
View Full Code Here

      NodeTypeDataManager ntManager = userSession.getWorkspace().getNodeTypesHolder();
      LocationFactory locationFactory = userSession.getLocationFactory();
      for (int i = 0; i < criteria.getNodeTypeName().length; i++)
      {
         InternalQName name = locationFactory.parseJCRName(criteria.getNodeTypeName()[i]).getInternalName();
         NodeTypeData criteriaNT = ntManager.findNodeType(name);
         InternalQName[] testQNames;
         if (criteriaNT.isMixin())
         {
            testQNames = node.getMixinTypeNames();
         }
         else
         {
            testQNames = new InternalQName[1];
            testQNames[0] = node.getPrimaryTypeName();
         }
         if (ntManager.isNodeType(criteriaNT.getName(), testQNames))
            return true;
      }
      return false;
   }
View Full Code Here

   // JSR-170 stuff ================================

   public NodeType findNodeType(InternalQName nodeTypeName) throws NoSuchNodeTypeException, RepositoryException
   {

      NodeTypeData ntdata = typesManager.findNodeType(nodeTypeName);
      if (ntdata != null)
         return new NodeTypeImpl(ntdata, typesManager, this, locationFactory, valueFactory);

      throw new NoSuchNodeTypeException("Nodetype not found " + nodeTypeName.getAsString());
   }
View Full Code Here

   /**
    * {@inheritDoc}
    */
   public NodeType getNodeType(final String nodeTypeName) throws NoSuchNodeTypeException, RepositoryException
   {
      NodeTypeData ntdata = typesManager.findNodeType(locationFactory.parseJCRName(nodeTypeName).getInternalName());
      if (ntdata != null)
         return new NodeTypeImpl(ntdata, typesManager, this, locationFactory, valueFactory);

      throw new NoSuchNodeTypeException("Nodetype not found " + nodeTypeName);
   }
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.core.nodetype.NodeTypeData

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.