Asserts the primary node type of the node

@param node
the node whose primary node type should be checked
@param nodeType
the nodetype that is asserted to be the node type of the node
@throws RepositoryException
544256
public static void assertPrimaryNodeType(final Node node, final String nodeType) throws RepositoryException {
        final NodeType primaryNodeType = node.getPrimaryNodeType();
        assertEquals(nodeType, primaryNodeType.getName());
    }
964844
void processSpecialNodeTypes(NodeWithType<?, Type> node, String name) {
        Type type = node.getType();
        if (node instanceof MethodDeclaration && ("newBufferAndOffset".equals(name) || "nextArrayOffset".equals(name))) {
            node.setType(PrimitiveType.intType());
        } else if (PrimitiveType.longType().equals(type)) {
            switch(name) {
            case "offset":
            case "offsetInNew":
            case "offsetInOld":
            case "lookAheadElementOffset":
                node.setType(PrimitiveType.intType());
            }
        } else if (isRefType(type, "LinkedQueueNode")) {
            node.setType(simpleParametricType("LinkedQueueAtomicNode", "E"));
        } else if (isRefArray(type, "E")) {
            node.setType(atomicRefArrayType((ArrayType) type));
        }
    }
794376
public function isOfType(NodeInterface $node, string $nodeType): bool
    {
        return $node->getNodeType()->isOfType($nodeType);
    }
334921
public static void registerAndAddMixinType(Session session, Node node, String mixin) throws RepositoryException {
        registerMixinType(session, mixin);
        if (!Arrays.asList(node.getMixinNodeTypes()).contains(mixin)) {
            node.addMixin(mixin);
        }
    }
859163
void createStructure() throws RepositoryException
   {
      Session session = getStorageSession();
      try
      {
         Node storage = session.getRootNode().addNode(storagePath.substring(1), STORAGE_NODETYPE);

         storage.addNode(STORAGE_JOS_USERS, STORAGE_JOS_USERS_NODETYPE);
         storage.addNode(STORAGE_JOS_GROUPS, STORAGE_JOS_GROUPS_NODETYPE);
         Node storageTypesNode = storage.addNode(STORAGE_JOS_MEMBERSHIP_TYPES, STORAGE_JOS_MEMBERSHIP_TYPES_NODETYPE);
         Node anyNode = storageTypesNode.addNode(JOS_MEMBERSHIP_TYPE_ANY);
         anyNode.setProperty(MembershipTypeHandlerImpl.MembershipTypeProperties.JOS_DESCRIPTION, JOS_DESCRIPTION_TYPE_ANY);

         session.save(); // storage done configure
      }
      finally
      {
         session.logout();
      }
   }
518899
@SuppressWarnings( "unchecked" )
    public void importType( ObjectType cmisType,
                            NodeTypeManager typeManager,
                            NamespaceRegistry registry ) throws RepositoryException {
        // TODO: get namespace information and register
        // registry.registerNamespace(cmisType.getLocalNamespace(), cmisType.getLocalNamespace());

        // create node type template
        NodeTypeTemplate type = typeManager.createNodeTypeTemplate();

        // convert CMIS type's attributes to node type template we have just created
        type.setName(cmisType.getId());
        type.setAbstract(false);
        type.setMixin(false);
        type.setOrderableChildNodes(true);
        type.setQueryable(true);
        if (!cmisType.isBaseType()) {
            type.setDeclaredSuperTypeNames(superTypes(cmisType));
        }

        Map<String, PropertyDefinition<?>> props = cmisType.getPropertyDefinitions();
        Set<String> names = props.keySet();
        // properties
        for (String name : names) {
            PropertyDefinition<?> pd = props.get(name);
            PropertyDefinitionTemplate pt = typeManager.createPropertyDefinitionTemplate();
            pt.setRequiredType(properties.getJcrType(pd.getPropertyType()));
            pt.setAutoCreated(false);
            pt.setAvailableQueryOperators(new String[] {});
            pt.setName(name);
            pt.setMandatory(pd.isRequired());
            type.getPropertyDefinitionTemplates().add(pt);
        }

        // register type
        NodeTypeDefinition[] nodeDefs = new NodeTypeDefinition[] {type};
        typeManager.registerNodeTypes(nodeDefs, true);
    }
450721
public static boolean hasMixin(final Node node) {
        try {
            return node.isNodeType(FEDORA_WEBAC_ACL);
        } catch (final RepositoryException e) {
            throw new RepositoryRuntimeException(e);
        }
    }
381313
public void addNode(final INodeEntry node) {
        //convert to entity
        final ResourceXMLParser.Entity entity = createEntity(node);
        addEntity(entity);
    }
905354
private void checkProperties(NodePropertiesInfo currentNodePropertiesInfo) throws RepositoryException
   {
      if (currentNodePropertiesInfo.getNode().getQPath().isDescendantOf(Constants.JCR_VERSION_STORAGE_PATH)
         && currentNodePropertiesInfo.getNode().getPrimaryTypeName().equals(Constants.NT_FROZENNODE))
      {
         InternalQName fptName = null;
         List<InternalQName> fmtNames = new ArrayList<InternalQName>();

         // get frozenPrimaryType and frozenMixinTypes
         try
         {
            for (ImportPropertyData propertyData : currentNodePropertiesInfo.getProperties())
            {
               if (propertyData.getQName().equals(Constants.JCR_FROZENPRIMARYTYPE))
               {
                  fptName = InternalQName.parse(ValueDataUtil.getString(propertyData.getValues().get(0)));
               }
               else if (propertyData.getQName().equals(Constants.JCR_FROZENMIXINTYPES))
               {
                  for (ValueData valueData : propertyData.getValues())
                  {
                     fmtNames.add(InternalQName.parse(ValueDataUtil.getString(valueData)));
                  }
               }
            }
         }
         catch (IllegalStateException e)
         {
            throw new RepositoryException(e.getMessage(), e);
         }
         catch (IllegalNameException e)
         {
            throw new RepositoryException(e.getMessage(), e);
         }

         InternalQName nodePrimaryTypeName = currentNodePropertiesInfo.getNode().getPrimaryTypeName();
         InternalQName[] nodeMixinTypeName = currentNodePropertiesInfo.getNode().getMixinTypeNames();

         for (ImportPropertyData propertyData : currentNodePropertiesInfo.getProperties())
         {
            PropertyDefinitionDatas defs =
               nodeTypeDataManager.getPropertyDefinitions(propertyData.getQName(), nodePrimaryTypeName,
                  nodeMixinTypeName);

            if (defs == null || (defs != null && defs.getAnyDefinition().isResidualSet()))
            {
               PropertyDefinitionDatas vhdefs =
                  nodeTypeDataManager.getPropertyDefinitions(propertyData.getQName(), fptName,
                     fmtNames.toArray(new InternalQName[fmtNames.size()]));

               if (vhdefs != null)
               {
                  boolean isMultivalue = (vhdefs.getDefinition(true) != null ? true : false);
                  propertyData.setMultivalue(isMultivalue);
               }
            }
         }
      }
   }
1300704
@Override
   protected void entering(NodeData node, int level) throws RepositoryException
   {
      try
      {
         writer.writeStartElement(Constants.NS_SV_PREFIX, Constants.SV_NODE, getSvNamespaceUri());
         if (level == 0)
         {
            startPrefixMapping();
         }

         writer.writeAttribute(Constants.NS_SV_PREFIX, getSvNamespaceUri(), Constants.SV_NAME, getExportName(node,
            false));
      }
      catch (XMLStreamException e)
      {
         throw new RepositoryException(e);
      }

   }
185378
public static void assertNodeNotExistById(final Session session, final String itemId) throws RepositoryException {
        try {
            session.getNodeByIdentifier(itemId);
            fail("ItemNotFoundException expected");
        } catch (final ItemNotFoundException e) { // NOSONAR
            // this was expected
        }
    }
1045685
public static boolean hasMixin(final Node node) {
        try {
            return node.isNodeType(FEDORA_TOMBSTONE);
        } catch (final RepositoryException e) {
            throw new RepositoryRuntimeException(e);
        }
    }
709946
public NodeType registerNodeType(NodeTypeValue nodeTypeValue, int alreadyExistsBehaviour) throws RepositoryException
   {
      List<NodeTypeValue> list = new ArrayList<NodeTypeValue>();
      list.add(nodeTypeValue);
      NodeTypeIterator it = registerNodeTypes(list, alreadyExistsBehaviour);
      return it.nextNodeType();
   }
1139914
public void setType( AstNode node,
                         String type ) {
        CheckArg.isNotNull(node, "node");
        CheckArg.isNotNull(type, "parent");
        node.setProperty(JCR_MIXIN_TYPES, type);
    }
1146090
public void setNodeType(int nodeType) {
        if (nodeType != Token.VAR
            && nodeType != Token.CONST
            && nodeType != Token.LET)
            throw new IllegalArgumentException("invalid node type");
        setType(nodeType);
    }
191662
public void visit(ASTNode[] nodes, SourceUnit source) {
        if (!(nodes[0] instanceof AnnotationNode) || !(nodes[1] instanceof AnnotatedNode)) {
            throw new RuntimeException("Internal error: wrong types: $node.class / $parent.class");
        }
        AnnotationNode node = (AnnotationNode) nodes[0];

        if (nodes[1] instanceof ClassNode) {
            addListenerToClass(source, (ClassNode) nodes[1]);
        } else {
            if ((((FieldNode)nodes[1]).getModifiers() & Opcodes.ACC_FINAL) != 0) {
                source.getErrorCollector().addErrorAndContinue(new SyntaxErrorMessage(
                        new SyntaxException("@groovy.beans.Vetoable cannot annotate a final property.",
                                node.getLineNumber(), node.getColumnNumber(), node.getLastLineNumber(), node.getLastColumnNumber()),
                        source));
            }

            addListenerToProperty(source, node, (AnnotatedNode) nodes[1]);
        }
    }
119493
public static void checkContentResourceType(NodeType contentNodeType) throws NoSuchNodeTypeException
   {
      if (!contentNodeType.isNodeType(WebDavConst.NodeTypes.NT_RESOURCE))
      {
         throw new NoSuchNodeTypeException("Content-Node type " + contentNodeType.getName()
            + " must extend nt:resource.");
      }
   }