Create NodeData from TempNodeData content.

@param tempData
@param parentPath
@param parentACL
@return
@throws RepositoryException
@throws SQLException
@throws IOException
167143
protected PersistedNodeData loadNodeFromTemporaryNodeData(TempNodeData tempData, QPath parentPath,
      AccessControlList parentACL) throws RepositoryException, SQLException, IOException
   {
      return loadNodeRecord(parentPath, tempData.cname, tempData.cid, tempData.cpid, tempData.cindex,
         tempData.cversion, tempData.cnordernumb, tempData.properties, parentACL);
   }
925767
private void createParents(String path, List<ACL> acl)
    throws InterruptedException, KeeperException

  {
    path = PathUtils.getParentPath(adjustPath(path));
    path = PathUtils.removeTrailingSlash(path);

    List<String> paths = new ArrayList<String>();

    while(!path.equals("") && getZk().exists(path, false) == null)
    {
      paths.add(path);

      path = PathUtils.getParentPath(path);
      path = PathUtils.removeTrailingSlash(path);
    }

    Collections.reverse(paths);

    for(String p : paths)
    {
      try
      {
        getZk().create(p,
                       null,
                       acl,
                       CreateMode.PERSISTENT);
      }
      catch(KeeperException.NodeExistsException e)
      {
        // ok we continue...
        if(log.isDebugEnabled())
          log.debug("parent already exists " + p);
      }
    }
  }
1092584
@Override
    public ICodeBaseLocator createNestedArchiveCodeBaseLocator(ICodeBase parentCodeBase, String path) {
        return new NestedZipFileCodeBaseLocator(parentCodeBase, path);
    }
674961
protected void visitChildNodes(NodeData node) throws RepositoryException
   {
      if (isInterrupted())
         return;
      for (NodeData data : dataManager.getChildNodesData(node))
      {
         if (isInterrupted())
            return;
         data.accept(this);
      }
   }
708545
public Node createProxyNode(Object sourceNodeId, Object targetNodeId, GraphDatabaseService graphDb,
            EntityMetadata sourceEntityMetadata, EntityMetadata targetEntityMetadata)
    {

        String sourceNodeIdColumnName = ((AbstractAttribute) sourceEntityMetadata.getIdAttribute()).getJPAColumnName();
        String targetNodeIdColumnName = ((AbstractAttribute) targetEntityMetadata.getIdAttribute()).getJPAColumnName();

        Node node = graphDb.createNode();
        node.setProperty(PROXY_NODE_TYPE_KEY, PROXY_NODE_VALUE);
        node.setProperty(sourceNodeIdColumnName, sourceNodeId);
        node.setProperty(targetNodeIdColumnName, targetNodeId);
        return node;
    }
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();
      }
   }
1270741
private NodeImpl doAddNode(NodeImpl parentNode, InternalQName name, InternalQName primaryTypeName,
      NodeDefinitionData nodeDef) throws ItemExistsException, RepositoryException, ConstraintViolationException,
      VersionException, LockException
   {
      validateChildNode(parentNode, name, primaryTypeName, nodeDef);

      // Initialize data
      InternalQName[] mixinTypeNames = new InternalQName[0];
      String identifier = IdGenerator.generate();

      int orderNum = parentNode.getNextChildOrderNum();
      int index = parentNode.getNextChildIndex(name, primaryTypeName, parentNode.nodeData(), nodeDef);

      QPath path = QPath.makeChildPath(parentNode.getInternalPath(), name, index);

      AccessControlList acl = parentNode.getACL();

      // create new nodedata, [PN] fix of use index as persisted version
      NodeData nodeData =
         new TransientNodeData(path, identifier, -1, primaryTypeName, mixinTypeNames, orderNum, parentNode
            .getInternalIdentifier(), acl);

      // Create new Node
      ItemState state = ItemState.createAddedState(nodeData, false);
      NodeImpl node = (NodeImpl)dataManager.update(state, true);

      NodeTypeDataManager ntmanager = session.getWorkspace().getNodeTypesHolder();
      ItemAutocreator itemAutocreator = new ItemAutocreator(ntmanager, valueFactory, dataManager, true);

      PlainChangesLog changes =
         itemAutocreator.makeAutoCreatedItems(node.nodeData(), primaryTypeName, dataManager, session.getUserID());
      for (ItemState autoCreatedState : changes.getAllStates())
      {
         dataManager.updateItemState(autoCreatedState);
      }

      session.getActionHandler().postAddNode(node);

      return node;
   }
588717
private function storeNode(NodePath $nodePath, array $data, array $node) : array
    {
        $nodePath = $nodePath->popFirst($nodeName);
        $nodeName = $this->encodeNodeName($nodeName);
        if ($nodePath->isEmpty()) {
            $data[$nodeName] = $node;
        } else {
            if (isset($data[$nodeName])) {
                $data[$nodeName] = $this->storeNode($nodePath, $data[$nodeName], $node);
            } else {
                throw new JsonParserException("Node path " . $nodePath->__toString() . " does not exist.");
            }
        }
        return $data;
    }
1071443
protected JsTreeNodeData populateTreeNodeData(FileObject file, boolean noChild, String relativePath) throws FileSystemException {
		JsTreeNodeData node = new JsTreeNodeData();

		String baseName = file.getName().getBaseName();
		FileContent content = file.getContent();
		FileType type = file.getType();
		
		node.setData(baseName);

		Map<String, Object> attr = new HashMap<String, Object>();
		node.setAttr(attr);
		attr.put("id", relativePath);
		attr.put("rel", type.getName());
		attr.put("fileType", type.getName());
		if (content != null){
			long fileLastModifiedTime = file.getContent().getLastModifiedTime();
			attr.put("fileLastModifiedTime", fileLastModifiedTime);
			attr.put("fileLastModifiedTimeForDisplay", DateFormat.getDateTimeInstance().format(new Date(fileLastModifiedTime)));
			if (file.getType() != FileType.FOLDER){
				attr.put("fileSize", content.getSize());
				attr.put("fileSizeForDisplay", FileUtils.byteCountToDisplaySize(content.getSize()));
			}
		}

		// these fields should not appear in JSON for leaf nodes
		if (!noChild){
			node.setState(JsTreeNodeData.STATE_CLOSED);
		}
		return node;
	}
425892
@Override
    protected AstNode parseCreateViewStatement( DdlTokenStream tokens,
                                                AstNode parentNode ) throws ParsingException {
        assert tokens != null;
        assert parentNode != null;

        markStartOfStatement(tokens);
        // CREATE [OR REPLACE]
        // [[NO] FORCE] VIEW [schema.] view
        // [ ( { alias [ inline_constraint... ]
        // | out_of_line_constraint
        // }
        // [, { alias [ inline_constraint...]
        // | out_of_line_constraint
        // }
        // ]
        // )
        // | object_view_clause
        // | XMLType_view_clause
        // ]
        // AS subquery [ subquery_restriction_clause ] ;

        // NOTE: the query expression along with the CHECK OPTION clause require no SQL statement terminator.
        // So the CHECK OPTION clause will NOT

        String stmtType = "CREATE";
        tokens.consume("CREATE");
        if (tokens.canConsume("OR", "REPLACE")) {
            stmtType = stmtType + SPACE + "OR REPLACE";
        } else if (tokens.canConsume("NO", "FORCE")) {
            stmtType = stmtType + SPACE + "NO FORCE";
        } else if (tokens.canConsume("FORCE")) {
            stmtType = stmtType + SPACE + "FORCE";
        }

        tokens.consume("VIEW");
        stmtType = stmtType + SPACE + "VIEW";

        String name = parseName(tokens);

        AstNode createViewNode = nodeFactory().node(name, parentNode, TYPE_CREATE_VIEW_STATEMENT);

        // CONSUME COLUMNS
        parseColumnNameList(tokens, createViewNode, TYPE_COLUMN_REFERENCE);

        // (object_view_clause)
        //
        // OF [ schema. ] type_name
        // { WITH OBJECT IDENTIFIER
        // { DEFAULT | ( attribute [, attribute ]... ) }
        // | UNDER [ schema. ] superview
        // }
        // ( { out_of_line_constraint
        // | attribute { inline_constraint }...
        // } [, { out_of_line_constraint
        // | attribute { inline_constraint }...
        // }
        // ]...
        // )

        // (XMLType_view_clause)
        //
        // OF XMLTYPE [ XMLSchema_spec ]
        // WITH OBJECT IDENTIFIER
        // { DEFAULT | ( expr [, expr ]...) }

        // Basically, if next token matches "OF", then parse until token matches "AS"

        if (tokens.matches("OF")) {
            do {
                tokens.consume();
            } while (!tokens.matches("AS"));
        }

        tokens.consume("AS");

        String queryExpression = parseUntilTerminator(tokens);

        createViewNode.setProperty(CREATE_VIEW_QUERY_EXPRESSION, queryExpression);

        markEndOfStatement(tokens, createViewNode);

        return createViewNode;
    }
62149
public static <T> NamedParameterNode<T> createNamedParameterNode(final Node parent,
                                                                   final Class<? extends Name<T>> clazz,
                                                                   final Type argClass)
      throws ClassHierarchyException {

    Class<?> argRawClass = ReflectionUtilities.getRawClass(argClass);

    final boolean isSet = argRawClass.equals(Set.class);
    final boolean isList = argRawClass.equals(List.class);

    final Type argClazz;

    if (isSet || isList) {
      argClazz = ReflectionUtilities.getInterfaceTarget(Collection.class, argClass);
    } else {
      argClazz = argClass;
    }

    final String simpleName = ReflectionUtilities.getSimpleName(clazz);
    final String fullName = ReflectionUtilities.getFullName(clazz);
    final String fullArgName = ReflectionUtilities.getFullName(argClazz);
    final String simpleArgName = ReflectionUtilities.getSimpleName(argClazz);


    final NamedParameter namedParameter = clazz.getAnnotation(NamedParameter.class);

    if (namedParameter == null) {
      throw new IllegalStateException("Got name without named parameter post-validation!");
    }
    final boolean hasStringDefault, hasClassDefault, hasStringSetDefault, hasClassSetDefault;

    int defaultCount = 0;
    if (namedParameter.default_value().equals(NamedParameter.REEF_UNINITIALIZED_VALUE)) {
      hasStringDefault = false;
    } else {
      hasStringDefault = true;
      defaultCount++;
    }
    if (namedParameter.default_class() != Void.class) {
      hasClassDefault = true;
      defaultCount++;
    } else {
      hasClassDefault = false;
    }
    if (namedParameter.default_values() != null && namedParameter.default_values().length > 0) {
      hasStringSetDefault = true;
      defaultCount++;
    } else {
      hasStringSetDefault = false;
    }
    if (namedParameter.default_classes() != null && namedParameter.default_classes().length > 0) {
      hasClassSetDefault = true;
      defaultCount++;
    } else {
      hasClassSetDefault = false;
    }
    if (defaultCount > 1) {
      throw new ClassHierarchyException("Named parameter " + fullName +
          " defines more than one of default_value, default_class, default_values and default_classes");
    }

    final String[] defaultInstanceAsStrings;

    if (defaultCount == 0) {
      defaultInstanceAsStrings = new String[]{};
    } else if (hasClassDefault) {
      final Class<?> defaultClass = namedParameter.default_class();
      assertIsSubclassOf(clazz, defaultClass, argClazz);
      defaultInstanceAsStrings = new String[]{ReflectionUtilities.getFullName(defaultClass)};
    } else if (hasStringDefault) {
      // Don't know if the string is a class or literal here, so don't bother validating.
      defaultInstanceAsStrings = new String[]{namedParameter.default_value()};
    } else if (hasClassSetDefault) {
      final Class<?>[] clzs = namedParameter.default_classes();
      defaultInstanceAsStrings = new String[clzs.length];
      for (int i = 0; i < clzs.length; i++) {
        assertIsSubclassOf(clazz, clzs[i], argClazz);
        defaultInstanceAsStrings[i] = ReflectionUtilities.getFullName(clzs[i]);
      }
    } else if (hasStringSetDefault) {
      defaultInstanceAsStrings = namedParameter.default_values();
    } else {
      throw new IllegalStateException("The named parameter " + namedParameter.short_name() + " has a default value,"
              + " but the value cannot be retrieved. The defaultCount is " + defaultCount
              + ", but hasClassDefault, hasStringDefault, hasClassSetDefault, hasStringSetDefault"
              + " conditions are all false");
    }

    final String documentation = namedParameter.doc();

    final String shortName = namedParameter.short_name().isEmpty()
        ? null : namedParameter.short_name();

    return new NamedParameterNodeImpl<>(parent, simpleName, fullName,
        fullArgName, simpleArgName, isSet, isList, documentation, shortName, defaultInstanceAsStrings);
  }
543955
private ItemData initACL(NodeData parent, NodeData node) throws RepositoryException
   {
      return initACL(parent, node, null);
   }
1295747
protected ItemData getCachedCleanItemData(NodeData parentData, QPathEntry name, ItemType itemType)
      throws RepositoryException
   {
      ItemData data = getCachedItemData(parentData, name, itemType);

      if (data != null && !data.isNode() && !(data instanceof NullItemData) && forceLoad((PropertyData)data))
      {
         cache.remove(data.getIdentifier(), data);
         data = null;
      }
      return data;
   }
808889
def _create_node(self, name, parent, children, data):
        """"""
        self._db[name] = {"parent": parent, "children": children, "data": data}
1332023
private function composeSnapData(&$result, $tree, $parentId = null)
    {
        foreach ($tree as $custId => $children) {
            if (is_null($parentId)) {
                /* this is root node */
                $result[$custId] = [
                    Snap::A_CUSTOMER_REF => $custId,
                    Snap::A_PARENT_REF => $custId,
                    Snap::A_DEPTH => Cfg::INIT_DEPTH,
                    Snap::A_PATH => Cfg::DTPS
                ];
            } else {
                $parentData = $result[$parentId];
                $result[$custId] = [
                    Snap::A_CUSTOMER_REF => $custId,
                    Snap::A_PARENT_REF => $parentId,
                    Snap::A_DEPTH => $parentData[Snap::A_DEPTH] + 1,
                    Snap::A_PATH => $parentData[Snap::A_PATH] . $parentId . Cfg::DTPS
                ];
            }
            if (sizeof($children) > 0) {
                $this->composeSnapData($result, $children, $custId);
            }
        }
    }
210255
private List<NodeData> childNodesData() throws RepositoryException, AccessDeniedException
   {
      List<NodeData> storedNodes = new ArrayList<NodeData>(dataManager.getChildNodesData(nodeData()));
      Collections.sort(storedNodes, new NodeDataOrderComparator());
      return storedNodes;
   }
1129510
@Override
    protected AstNode parseCustomStatement( DdlTokenStream tokens,
                                            AstNode parentNode ) throws ParsingException {
        assert tokens != null;
        assert parentNode != null;

        if (tokens.matches(STMT_RENAME_DATABASE)) {
            markStartOfStatement(tokens);

            // RENAME DATABASE db_name TO new_db_name;
            tokens.consume(STMT_RENAME_DATABASE);
            String oldName = parseName(tokens);
            tokens.consume("TO");
            AstNode node = nodeFactory().node(oldName, parentNode, TYPE_RENAME_DATABASE_STATEMENT);
            String newName = parseName(tokens);
            node.setProperty(NEW_NAME, newName);

            markEndOfStatement(tokens, node);
            return node;
        } else if (tokens.matches(STMT_RENAME_SCHEMA)) {
            markStartOfStatement(tokens);

            // RENAME SCHEMA schema_name TO new_schema_name;
            tokens.consume(STMT_RENAME_SCHEMA);
            String oldName = parseName(tokens);
            tokens.consume("TO");
            AstNode node = nodeFactory().node(oldName, parentNode, TYPE_RENAME_SCHEMA_STATEMENT);
            String newName = parseName(tokens);
            node.setProperty(NEW_NAME, newName);

            markEndOfStatement(tokens, node);
            return node;
        } else if (tokens.matches(STMT_RENAME_TABLE)) {
            markStartOfStatement(tokens);

            // RENAME TABLE old_table TO tmp_table,
            // new_table TO old_table,
            // tmp_table TO new_table;
            tokens.consume(STMT_RENAME_TABLE);

            String oldName = parseName(tokens);
            tokens.consume("TO");
            String newName = parseName(tokens);

            AstNode node = nodeFactory().node(oldName, parentNode, TYPE_RENAME_TABLE_STATEMENT);
            node.setProperty(NEW_NAME, newName);

            // IF NOT MULTIPLE RENAMES, FINISH AND RETURN
            if (!tokens.matches(COMMA)) {
                markEndOfStatement(tokens, node);
                return node;
            }

            // Assume multiple renames

            // Create list of nodes so we can re-set the expression of each to reflect ONE rename.
            List<AstNode> nodes = new ArrayList<AstNode>();
            nodes.add(node);

            while (tokens.matches(COMMA)) {
                tokens.consume(COMMA);
                oldName = parseName(tokens);
                tokens.consume("TO");
                newName = parseName(tokens);
                node = nodeFactory().node(oldName, parentNode, TYPE_RENAME_TABLE_STATEMENT);
                node.setProperty(NEW_NAME, newName);
                nodes.add(node);
            }

            markEndOfStatement(tokens, nodes.get(0));

            String originalExpression = (String)nodes.get(0).getProperty(DDL_EXPRESSION);
            Object startLineNumber = nodes.get(0).getProperty(DDL_START_LINE_NUMBER);
            Object startColumnNumber = nodes.get(0).getProperty(DDL_START_COLUMN_NUMBER);
            Object startCharIndex = nodes.get(0).getProperty(DDL_START_CHAR_INDEX);

            for (AstNode nextNode : nodes) {
                oldName = nextNode.getName();
                newName = (String)nextNode.getProperty(NEW_NAME);
                String express = "RENAME TABLE" + SPACE + oldName + SPACE + "TO" + SPACE + newName + SEMICOLON;
                nextNode.setProperty(DDL_EXPRESSION, express);
                nextNode.setProperty(DDL_ORIGINAL_EXPRESSION, originalExpression);
                nextNode.setProperty(DDL_START_LINE_NUMBER, startLineNumber);
                nextNode.setProperty(DDL_START_COLUMN_NUMBER, startColumnNumber);
                nextNode.setProperty(DDL_START_CHAR_INDEX, startCharIndex);
            }

            return nodes.get(0);
        }

        return super.parseCustomStatement(tokens, parentNode);
    }