Returns whole tree dependencies of the given entity meta data.

@param entityTypeNode entity meta data node
@return dependencies of the entity meta data node
421194
private static Set<EntityTypeNode> expandEntityTypeDependencies(EntityTypeNode entityTypeNode) {
    if (LOG.isTraceEnabled()) {
      LOG.trace(
          "expandEntityTypeDependencies(EntityTypeNode entityTypeNode) --- entity: [{}], skip: [{}]",
          entityTypeNode.getEntityType().getId(),
          entityTypeNode.isSkip());
    }

    if (!entityTypeNode.isSkip()) {
      // get referenced entities excluding entities of mappedBy attributes
      EntityType entityType = entityTypeNode.getEntityType();
      Set<EntityTypeNode> refEntityMetaSet =
          stream(entityType.getOwnAllAttributes())
              .filter(attribute -> isProcessableAttribute(attribute, entityType))
              .flatMap(
                  attr -> {
                    EntityTypeNode nodeRef =
                        new EntityTypeNode(attr.getRefEntity(), entityTypeNode.getStack());
                    Set<EntityTypeNode> dependenciesRef = expandEntityTypeDependencies(nodeRef);
                    dependenciesRef.add(nodeRef);
                    return dependenciesRef.stream();
                  })
              .collect(toCollection(HashSet::new));

      EntityType extendsEntityMeta = entityType.getExtends();
      if (extendsEntityMeta != null) {
        EntityTypeNode nodeRef = new EntityTypeNode(extendsEntityMeta, entityTypeNode.getStack());

        // Add extended entity to set
        refEntityMetaSet.add(nodeRef);

        // Add dependencies of extended entity to set
        Set<EntityTypeNode> dependenciesRef = expandEntityTypeDependencies(nodeRef);
        refEntityMetaSet.addAll(dependenciesRef);
      }
      return refEntityMetaSet;
    } else {
      return Sets.newHashSet();
    }
  }
1273400
public List<EntityBeanType<EnterpriseBeansType<T>>> getAllEntity()
   {
      List<EntityBeanType<EnterpriseBeansType<T>>> list = new ArrayList<EntityBeanType<EnterpriseBeansType<T>>>();
      List<Node> nodeList = childNode.get("entity");
      for(Node node: nodeList)
      {
         EntityBeanType<EnterpriseBeansType<T>>  type = new EntityBeanTypeImpl<EnterpriseBeansType<T>>(this, "entity", childNode, node);
         list.add(type);
      }
      return list;
   }
974978
public List<TypedDependency> typedDependencies(boolean includeExtras) {
    List<TypedDependency> deps = includeExtras ? allTypedDependencies
                                                       : typedDependencies;
    correctDependencies(deps);
    return deps;
  }
540294
public List<AstNode> getChildrenForType( AstNode astNode,
                                             String nodeType ) {
        CheckArg.isNotNull(astNode, "astNode");
        CheckArg.isNotNull(nodeType, "nodeType");

        List<AstNode> childrenOfType = new ArrayList<AstNode>();
        for (AstNode child : astNode.getChildren()) {
            if (hasMixinType(child, nodeType)) {
                childrenOfType.add(child);
            }
            List<AstNode> subChildrenOfType = getChildrenForType(child, nodeType);
            childrenOfType.addAll(subChildrenOfType);
        }

        return childrenOfType;
    }
87594
protected MavenArtifactInfo[] parseDependencies(final List<DependencyNode> children) {
        final MavenArtifactInfo[] dependecies = new MavenArtifactInfo[children.size()];
        int i = 0;
        for (final DependencyNode child : children) {
            dependecies[i++] = MavenArtifactInfoImpl.fromDependencyNode(child);
        }
        return dependecies;
    }
1222145
public static Map<String, Object> getKeyPropertyValues(EntityType entityType, Object entity) {
        Map<String, Object> keyPropertyValues = new HashMap<>();
        for (PropertyRef propertyRef : entityType.getKey().getPropertyRefs()) {
            String propertyName = propertyRef.getPath();
            Object propertyValue = getPropertyValue(entityType.getStructuralProperty(propertyName), entity);
            keyPropertyValues.put(propertyName, propertyValue);
        }
        return keyPropertyValues;
    }
1356760
public List<NamedAttributeNode<NamedEntityGraph<T>>> getAllNamedAttributeNode()
   {
      List<NamedAttributeNode<NamedEntityGraph<T>>> list = new ArrayList<NamedAttributeNode<NamedEntityGraph<T>>>();
      List<Node> nodeList = childNode.get("named-attribute-node");
      for(Node node: nodeList)
      {
         NamedAttributeNode<NamedEntityGraph<T>>  type = new NamedAttributeNodeImpl<NamedEntityGraph<T>>(this, "named-attribute-node", childNode, node);
         list.add(type);
      }
      return list;
   }
953460
public Set<InternalQName> getSupertypes(InternalQName name, Map<InternalQName, NodeTypeData> volatileNodeTypes)
      throws RepositoryException
   {

      return hierarchy.getSupertypes(name, volatileNodeTypes);
   }
1052886
public NodeDefinitionData getChildNodeDefinition(final InternalQName nodeName, final InternalQName... nodeTypeNames)
      throws RepositoryException
   {
      return this.nodeTypeRepository.getDefaultChildNodeDefinition(nodeName, nodeTypeNames);
   }
639894
public List<TypedDependency> typedDependenciesCollapsed(boolean includeExtras) {
    List<TypedDependency> tdl = typedDependencies(includeExtras);
    collapseDependencies(tdl, false);
    return tdl;
  }
42564
static <E> List<E> toEntities(Class<E> entityClass, List<Entity> nativeEntities) {
    if (nativeEntities == null || nativeEntities.isEmpty()) {
      return new ArrayList<>();
    }
    List<E> entities = new ArrayList<>(nativeEntities.size());
    for (Entity nativeEntity : nativeEntities) {
      E entity = Unmarshaller.unmarshal(nativeEntity, entityClass);
      entities.add(entity);
    }
    return entities;
  }
112675
public List<NodeTypeDefinition> readAllNodeTypes() {
        CachedNode nodeTypes = nodeTypesNode();
        List<NodeTypeDefinition> defns = new ArrayList<NodeTypeDefinition>();
        for (ChildReference ref : nodeTypes.getChildReferences(system)) {
            CachedNode nodeType = system.getNode(ref);
            defns.add(readNodeTypeDefinition(nodeType));
        }
        return defns;
    }
101878
@Override
    public Set<EntityType<?>> getEntities()
    {
        Set<EntityType<?>> entities = null;
        if (entityTypes != null)
        {
            entities = new HashSet<EntityType<?>>(entityTypes.values());
        }
        return entities;
    }
30104
public NodeTypeIterator getMixinNodeTypes() throws RepositoryException
   {
      List<NodeTypeData> allNodeTypes = typesManager.getAllNodeTypes();

      Collections.sort(allNodeTypes, new NodeTypeDataComparator());

      EntityCollection ec = new EntityCollection();
      for (NodeTypeData nodeTypeData : allNodeTypes)
      {
         if (nodeTypeData.isMixin())
         {
            ec.add(new NodeTypeImpl(nodeTypeData, typesManager, this, locationFactory, valueFactory, dataManager));
         }
      }
      return ec;
   }
487288
public Map<String, Object> createNodeProperties(Object entity, EntityMetadata m)
    {
        Map<String, Object> props = new HashMap<String, Object>();

        MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                m.getPersistenceUnit());

        EntityType entityType = metaModel.entity(m.getEntityClazz());

        // Iterate over entity attributes
        Set<Attribute> attributes = entityType.getSingularAttributes();
        for (Attribute attribute : attributes)
        {
            Field field = (Field) attribute.getJavaMember();

            // Set Node level properties
            if (!attribute.isCollection() && !attribute.isAssociation())
            {

                String columnName = ((AbstractAttribute) attribute).getJPAColumnName();
                Object value = PropertyAccessorHelper.getObject(entity, field);
                if (value != null)
                {
                    props.put(columnName, toNeo4JProperty(value));
                }
            }
        }
        return props;
    }
1120618
EntityImpl buildEntity(VertexElement vertex, EntityType type) {
        return getOrBuildConcept(vertex, (v) -> EntityImpl.create(v, type));
    }
1047470
private Node getNode(Object entity, ObjectGraph graph, NodeState initialNodeState)
    {
        if (entity == null)
        {
            return null;
        }
        EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(pd.getKunderaMetadata(),
                entity.getClass());

        // entity metadata could be null.
        if (entityMetadata == null)
        {
            throw new IllegalArgumentException(
                    "Entity object is invalid, operation failed. Please check previous log message for details");
        }

        Object id = PropertyAccessorHelper.getId(entity, entityMetadata);
        // Generate and set Id if @GeneratedValue present.
        if (((Field) entityMetadata.getIdAttribute().getJavaMember()).isAnnotationPresent(GeneratedValue.class))
        {
            if (!isIdSet(id))
            {
                id = idGenerator.generateAndSetId(entity, entityMetadata, pd, pd.getKunderaMetadata());
            }
        }

        if (!validator.isValidEntityObject(entity, entityMetadata))
        {
            throw new IllegalArgumentException(
                    "Entity object is invalid, operation failed. Please check previous log message for details");
        }

        // id = PropertyAccessorHelper.getId(entity, entityMetadata);

        String nodeId = ObjectGraphUtils.getNodeId(id, entity.getClass());
        Node node = graph.getNode(nodeId);

        // If this node is already there in graph (may happen for bidirectional
        // relationship, do nothing and return null)
        if (node != null)
        {
            if (node.isGraphCompleted())
            {
                return node;
            }
            return null;
        }

        // Construct this Node first, if one not already there in Persistence
        // Cache
        Node nodeInPersistenceCache = persistenceCache.getMainCache().getNodeFromCache(nodeId, pd);

        // Make a deep copy of entity data

        if (nodeInPersistenceCache == null)
        {
            node = new Node(nodeId, entity, initialNodeState, persistenceCache, id, pd);
        }
        else
        {
            node = nodeInPersistenceCache;
            node.setPersistenceCache(persistenceCache);

            // Determine whether this node is dirty based on comparison between
            // Node data and entity data
            // If dirty, set the entity data into node and mark it as dirty
            if (!DeepEquals.deepEquals(node.getData(), entity))
            {
                node.setDirty(true);
            }
            else if (node.isProcessed())
            {
                node.setDirty(false);
            }

            node.setData(entity);

            // If node is NOT in managed state, its data needs to be
            // replaced with the one provided in entity object
        }

        // Put this node into object graph
        graph.addNode(nodeId, node);

        // Iterate over relations and construct children nodes
        for (Relation relation : entityMetadata.getRelations())
        {
            if (relation != null)
            {
                // Child Object set in this entity
                Object childObject = PropertyAccessorHelper.getObject(entity, relation.getProperty());

                if (childObject != null && !ProxyHelper.isProxy(childObject))
                {
                    EntityMetadata metadata = KunderaMetadataManager.getEntityMetadata(pd.getKunderaMetadata(),
                            PropertyAccessorHelper.getGenericClass(relation.getProperty()));

                    if (metadata != null && relation.isJoinedByPrimaryKey())
                    {
                        PropertyAccessorHelper.setId(childObject, metadata,
                                PropertyAccessorHelper.getId(entity, entityMetadata));
                    }
                    // This child object could be either an entity(1-1 or M-1)
                    // or a
                    // collection/ Map of entities(1-M or M-M)
                    if (Collection.class.isAssignableFrom(childObject.getClass()))
                    {
                        // For each entity in the collection, construct a child
                        // node and add to graph
                        Collection childrenObjects = (Collection) childObject;

                        if (childrenObjects != null && !ProxyHelper.isProxyCollection(childrenObjects))

                            for (Object childObj : childrenObjects)
                            {
                                if (childObj != null)
                                {
                                    addChildNodesToGraph(graph, node, relation, childObj,
                                            metadata != null ? getChildNodeState(metadata, childObj) : initialNodeState);
                                }
                            }
                    }
                    else if (Map.class.isAssignableFrom(childObject.getClass()))
                    {
                        Map childrenObjects = (Map) childObject;
                        if (childrenObjects != null && !ProxyHelper.isProxyCollection(childrenObjects))
                        {
                            for (Map.Entry entry : (Set<Map.Entry>) childrenObjects.entrySet())
                            {
                                addChildNodesToGraph(graph, node, relation, entry,
                                        metadata != null ? getChildNodeState(metadata, entry) : initialNodeState);
                            }
                        }
                    }
                    else
                    {
                        // Construct child node and add to graph
                        addChildNodesToGraph(graph, node, relation, childObject,
                                metadata != null ? getChildNodeState(metadata, childObject) : initialNodeState);
                    }
                }
            }
        }

        // Means compelte graph is build.
        node.setGraphCompleted(true);
        return node;
    }