Create entity from Node

@param node node

@return entity
334065
private ResourceXMLParser.Entity createEntity(final INodeEntry node) {
        final ResourceXMLParser.Entity ent = new ResourceXMLParser.Entity();
        ent.setName(node.getNodename());
        ent.setResourceType(NODE_ENTITY_TAG);
        

        if(null!=node.getAttributes()){
            for (final String setName : node.getAttributes().keySet()) {
                String value = node.getAttributes().get(setName);
                ent.setProperty(setName, value);
            }
        }
        if(null!=node.getTags()){
            ent.setProperty("tags", joinStrings(node.getTags(), ", "));
        }



        return ent;
    }
925774
public Object loadEntity(String entityName) throws ODataUnmarshallingException {
        Object entity = null;
        if (entityName != null) {
            try {
                StructuredType entityType = JsonParserUtils.getStructuredType(entityName, entityDataModel);
                if (entityType != null) {
                    entity = entityType.getJavaType().newInstance();
                } else {
                    LOG.warn("Given entity '{}' is not found in entity data model", entityName);
                    throw new ODataUnmarshallingException("Couldn't initiate entity because given entity [" + entityName
                            + "] is not found in entity data model.");
                }
            } catch (InstantiationException | IllegalAccessException e) {
                throw new ODataUnmarshallingException("Cannot instantiate entity", e);
            }
        }
        return entity;
    }
1020235
public function addNode(\Ydle\HubBundle\Entity\Node $node)
    {
        $this->nodes[] = $node;

        return $this;
    }
149732
function createEntity(html, id) {
    let $ = parser.load(html)

    let table = $('tr.past')

    let states = utils.tableParser(table, {
        date: {
            idx: 3,
            mandatory: true
        },
        hours: {
            idx: 5,
            mandatory: true
        },
        state: {
            idx: 7,
            mandatory: true
        },
        area: {
            idx: 9,
            mandatory: false
        }
    }).map(line => {
        let d = line.date + ' ' + line.hours
        return {
            date: moment.tz(d, "DD/MM/YYYY HH:mm", zone).format(),
            state: line.state,
            area: line.area
        }
    })

    return new EntityInfo({
        id: id,
        states: states
    })
}
157428
def _start_from_base_entity(base_entity):
        
        return Node(
            type=base_entity.function,
            bel=base_entity.as_bel(),
            sha512=base_entity.sha512,
            data=json.dumps(base_entity),
        )
166932
private function createProperty(Property $node)
    {
        $ref = new RefProperty();

        $ref->class   = $this->class;
        $ref->name    = (string)$node->props[0]->name;
        $ref->default = $this->getValue($node->props[0]->default);

        if ($node->isPrivate()) {
            $ref->visibility = Visibility::IS_PRIVATE;
        } elseif ($node->isProtected()) {
            $ref->visibility = Visibility::IS_PROTECTED;
        } elseif ($node->isPublic()) {
            $ref->visibility = Visibility::IS_PUBLIC;
        }

        $ref->isStatic   = $node->isStatic();
        $ref->line       = $node->getLine();
        $ref->docComment = $this->createDocComment($node);

        return $ref;
    }
246781
Document createDocument(Entity entity) {
    int maxIndexingDepth = entity.getEntityType().getIndexingDepth();
    XContentBuilder contentBuilder;
    try {
      contentBuilder = XContentFactory.contentBuilder(JSON);
      XContentGenerator generator = contentBuilder.generator();
      generator.writeStartObject();
      createRec(entity, generator, 0, maxIndexingDepth);
      generator.writeEndObject();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    String documentId = toElasticsearchId(entity.getIdValue());
    return Document.create(documentId, contentBuilder);
  }
1205972
Document createDocument(NodeDataIndexing node) throws RepositoryException
   {
      Document aDoc = null;
      if (volatileIndex != null)
      {
         aDoc = volatileIndex.getAggregateIndexes(node.getIdentifier());
      }
      if (aDoc == null)
      {
         aDoc = handler.createDocument(node, nsMappings, version, true, volatileIndex);
      }
      return aDoc;
   }
221433
private Object getEntityWithAssociationFromNode(EntityMetadata m, Node node)
    {
        Map<String, Object> relationMap = new HashMap<String, Object>();

        /**
         * Map containing Node ID as key and Entity object as value. Helps cache
         * entity objects found earlier for faster lookup and prevents repeated
         * processing
         */
        Map<Long, Object> nodeIdToEntityMap = new HashMap<Long, Object>();

        Object entity = mapper.getEntityFromNode(node, m);

        nodeIdToEntityMap.put(node.getId(), entity);
        populateRelations(m, entity, relationMap, node, nodeIdToEntityMap);

        nodeIdToEntityMap.clear();

        if (!relationMap.isEmpty() && entity != null)
        {
            return new EnhanceEntity(entity, PropertyAccessorHelper.getId(entity, m), relationMap);
        }
        else
        {
            return entity;
        }

    }
1046831
public function createFromEntity ($entity)
    {
        // Persist it
        $this->em->persist($entity);
        $this->em->flush();

        // Convert it to model and cache it
        $Model                  = $this->_convertEntityToModel($entity);
        $this->cache[$entity->getId()] = $Model;

        return $Model;
    }
459822
public EntityResult<SqlResultSetMapping<T>> getOrCreateEntityResult()
   {
      List<Node> nodeList = childNode.get("entity-result");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new EntityResultImpl<SqlResultSetMapping<T>>(this, "entity-result", childNode, nodeList.get(0));
      }
      return createEntityResult();
   }
971737
public static function create($data = [], Entity $entity = null)
    {
        $record = new static($data, $entity);

        $record->save();

        return $record;
    }
1080373
private function _createEntity($entity, $path, array $links = null)
    {
        $method = Resources::HTTP_POST;
        $headers = [];
        $postParams = [];
        $queryParams = [];
        $statusCode = Resources::STATUS_CREATED;
        $body = $this->wrapAtomEntry($entity, $links);

        $response = $this->sendHttp(
            $method,
            $headers,
            $queryParams,
            $postParams,
            $path,
            $statusCode,
            $body
        );

        $entry = new Entry();
        $entry->parseXml($response->getBody());

        return $this->getPropertiesFromAtomEntry($entry);
    }
448645
public static org.jdom2.Element convert(org.w3c.dom.Element node)
	{
		if (node == null)
			return null; // Convert null->null

		DOMBuilder builder = new DOMBuilder();

		return builder.build(node);
	}
164343
public function create($nodeEntityClass)
    {
        $reflectionClass = new \ReflectionClass($nodeEntityClass);
        /** @var Node $annotation */
        $annotation = $this->reader->getClassAnnotation($reflectionClass, Node::class);

        if (null !== $annotation) {
            return new NodeAnnotationMetadata($annotation->label, $annotation->repository);
        }

        throw new MappingException(sprintf('The class "%s" is missing the "%s" annotation', $nodeEntityClass, Node::class));
    }
1241166
public function loadNode($node)
    {
        //If the node isn't already loaded
        if(!isset($this->nodeProxyCache[$node->getId()]))
        {
            //Get the nodes class name (from label)
            $labels = $this->client->getLabels($node);
            $class = $labels[0]->getName();

            //Create a proxy entity
            $entity = $this->proxyFactory->fromNode($node, $this->metaRepository, $class);

            $this->nodeProxyCache[$node->getId()] = $entity;
            $this->everymanNodeCache[$this->getHash($entity)] = $node;
        }

        return $this->nodeProxyCache[$node->getId()];
    }
464970
def add_node_from_data(self, node: BaseEntity) -> BaseEntity:
        """"""
        assert isinstance(node, BaseEntity)

        if node in self:
            return node

        self.add_node(node)

        if VARIANTS in node:
            self.add_has_variant(node.get_parent(), node)

        elif MEMBERS in node:
            for member in node[MEMBERS]:
                self.add_has_component(node, member)

        elif PRODUCTS in node and REACTANTS in node:
            for reactant_tokens in node[REACTANTS]:
                self.add_has_reactant(node, reactant_tokens)
            for product_tokens in node[PRODUCTS]:
                self.add_has_product(node, product_tokens)

        return node