Return the loaded entity for given not initialized entity
492161
public function getLoadedEntity(NodeInterface $entity): NodeInterface
    {
        $class = ClassUtils::getClass($entity);
        if (isset(self::$deferred[$class][$entity->getId()]) && self::$deferred[$class][$entity->getId()] instanceof NodeInterface) {
            return self::$deferred[$class][$entity->getId()];
        }

        //fallback
        return $entity;
    }
846576
private synchronized void initialize() {
        Iterator types = EntityTypesLocator.getEntityTypes().getAllEntityTypes();
        String factoryName = null;

        while (types.hasNext()) {
            Class type = (Class) types.next();
            if (type != Object.class) {
                String factoryKey =
                        "org.apereo.portal.services.EntityNameFinderService.NameFinderFactory.implementation_"
                                + type.getName();
                try {
                    factoryName = PropertiesManager.getProperty(factoryKey);
                } catch (Exception runtime) {
                    String dMsg =
                            "EntityNameFinderService.initialize(): "
                                    + "could not find property for "
                                    + type.getName()
                                    + " factory.";
                    log.debug(dMsg);
                }
                if (factoryName != null) {
                    try {
                        IEntityNameFinderFactory factory =
                                (IEntityNameFinderFactory) Class.forName(factoryName).newInstance();
                        getNameFinders().put(type, factory.newFinder());
                    } catch (Exception e) {
                        String eMsg =
                                "EntityNameFinderService.initialize(): "
                                        + "Could not instantiate finder for "
                                        + type.getName()
                                        + ": ";
                        log.error(eMsg, e);
                    }
                }
            }
        }
        setInitialized(true);
    }
926262
def get_entity(self):
        
        if self._accessor is None:
            if self.__converted_entity is None:
                self.__converted_entity = self._convert_to_entity()
        else:
            # If we have an accessor, we can get the proxied entity by ID.
            # FIXME: This is a hack that is only used for REMOVE operations
            #        with data elements.
            self.__converted_entity = \
                self.get_matching(self.get_id()).get_entity()
        return self.__converted_entity
648937
function onEntityRetrieved( serverResponse ) {
			if( !serverResponse.data[ configuration.entityName ] ) {
				throw new Error( "The response from the server was not in the expected format. It should have a member named '" + configuration.entityName + "'." );
			}

			var rawEntity = serverResponse.data[ configuration.entityName ];

			// Put the raw entity into our raw entity cache.
			// We keep the raw copy to allow caching of the raw data.
			self.__cacheMaintain( self.__entityCacheRaw[ configuration.collectionName || configuration.entityName ],
				rawEntity,
				"update",
				false );

			// Deserialize the object and place it into the cache.
			// We do not need to check here if the object already exists in the cache.
			// While it could be possible that the same entity is retrieved multiple times, __updateCacheWithEntity
			// will not insert duplicates into the cache.
			var deserialized = self.deserializer( rawEntity );
			self.__updateCacheWithEntity( deserialized );
			return deserialized;
		}
1326065
public function load(Entity $entity)
    {
        $class = $this->getRelatedEntity();
        /** @var Entity $relatedEntity */
        $relatedEntity = new $class();
        /** @var Select $sql */
        $sql = call_user_func_array(
            array($relatedEntity, 'find'),
            []
        );
        $pmk = $entity->getPrimaryKey();
        $tableName = $relatedEntity->getTableName();
        $sql->where(
            [
                "{$tableName}.{$this->getForeignKey()} = :id" => [
                    ':id' => $entity->$pmk
                ]
            ]
        );
        $sql->limit($this->getLimit());
        return $sql->all();
    }
823344
def __load_asset_class(self, ac_id: int):
        
        # open database
        db = self.__get_session()
        entity = db.query(dal.AssetClass).filter(dal.AssetClass.id == ac_id).first()
        return entity
933570
def _load_from_cache_if_available(self, key):
    
    if key in self._cache:
      entity = self._cache[key]  # May be None, meaning "doesn't exist".
      if entity is None or entity._key == key:
        # If entity's key didn't change later, it is ok.
        # See issue 13.  http://goo.gl/jxjOP
        raise tasklets.Return(entity)
607379
def load_entities():
    """"""
    path = os.path.join(TOPDIR, 'entities.json')
    entities = json.load(open(path))
    names = [i['name'] for i in entities]

    try:
        assert len(set(names)) == len(entities)
    except AssertionError:
        raise Exception('Entities with same name: %s' % [i for i in names if
                                                         names.count(i) > 1])

    entities = dict((k['name'], c.Entity(name=k['name'],
                                         dimensions=k['dimensions'],
                                         uri=k['URI'])) for k in entities)

    dimensions_ent = defaultdict(list)
    for ent in entities:
        if not entities[ent].dimensions:
            continue
        perms = get_dimension_permutations(entities, entities[ent].dimensions)
        for perm in perms:
            key = get_key_from_dimensions(perm)
            dimensions_ent[key].append(entities[ent])

    return entities, dimensions_ent
990031
public ActiveEntity load() {
		try {
			final Entity result = db.get(this);
			if(MapUtil.isNotEmpty(result)) {
				this.putAll(result);
			}
		} catch (SQLException e) {
			throw new DbRuntimeException(e);
		}
		return this;
	}
801241
def fetch(self):
        
        params = values.of({})

        payload = self._version.fetch(
            'GET',
            self._uri,
            params=params,
        )

        return EntityInstance(
            self._version,
            payload,
            service_sid=self._solution['service_sid'],
            identity=self._solution['identity'],
        )
351959
def get_by_entityid(self, entityid):
		
		data = self.list(entityid=entityid)
		if len(data) == 0:
			return None

		eid = int( next(iter(data)) )
		entity = self.get(eid)

		self.debug(0x01,entity)
		return entity
378126
@SuppressWarnings("unchecked")
    private T getAttached(T object) {
        if (entityManager.contains(object)) {
            return object;
        } else {
            return findOne((I) entityManager.getEntityManagerFactory()
                    .getPersistenceUnitUtil().getIdentifier(object));
        }
    }
1208609
@Override
    public final V getEntity(final NamedParameterQueryData query) {
        V entity; // Entity acquired from the query

        checkNotNull(query, "Received a null pointer as the query");

        // Tries to acquire the entity
        try {
            entity = getTemplate().queryForObject(query.getQuery(),
                    query.getParameters(),
                    BeanPropertyRowMapper.newInstance(getType()));
        } catch (final EmptyResultDataAccessException exception) {
            entity = null;
        }

        return entity;
    }
451777
private void loadFromResultSet(
		final Tuple resultset,
		final int i,
		final Object object,
		final String instanceEntityName,
		final org.hibernate.engine.spi.EntityKey key,
		final String rowIdAlias,
		final LockMode lockMode,
		final Loadable rootPersister,
		final SharedSessionContractImplementor session)
	throws HibernateException {

		final Serializable id = key.getIdentifier();

		// Get the persister for the _subclass_
		final OgmEntityPersister persister = (OgmEntityPersister) getFactory().getMetamodel().entityPersister( instanceEntityName );

		if ( log.isTraceEnabled() ) {
			log.trace(
					"Initializing object from ResultSet: " +
					MessageHelper.infoString( persister, id, getFactory() )
				);
		}

		//FIXME figure out what that means and what value should be set
		//boolean eagerPropertyFetch = isEagerPropertyFetchEnabled(i);
		boolean fetchAllPropertiesRequested = true;

		// add temp entry so that the next step is circular-reference
		// safe - only needed because some types don't take proper
		// advantage of two-phase-load (esp. components)
		TwoPhaseLoad.addUninitializedEntity(
				key,
				object,
				persister,
				lockMode,
				session
		);

		//TODO what to do with that in OGM
//		//This is not very nice (and quite slow):
//		final String[][] cols = persister == rootPersister ?
//				getEntityAliases()[i].getSuffixedPropertyAliases() :
//				getEntityAliases()[i].getSuffixedPropertyAliases(persister);

		final Object[] values = persister.hydrate(
				resultset,
				id,
				object,
				rootPersister,
				//cols,
				fetchAllPropertiesRequested,
				session
			);

		if ( persister.hasRowId() ) {
			throw new HibernateException( "Hibernate OGM does not support row id" );
		}
		final Object rowId = null;

		final AssociationType[] ownerAssociationTypes = getOwnerAssociationTypes();
		if ( ownerAssociationTypes != null && ownerAssociationTypes[i] != null ) {
			String ukName = ownerAssociationTypes[i].getRHSUniqueKeyPropertyName();
			if ( ukName != null ) {
				final int index = ( (UniqueKeyLoadable) persister ).getPropertyIndex( ukName );
				final Type type = persister.getPropertyTypes()[index];

				// polymorphism not really handled completely correctly,
				// perhaps...well, actually its ok, assuming that the
				// entity name used in the lookup is the same as the
				// the one used here, which it will be

				EntityUniqueKey euk = new EntityUniqueKey(
						rootPersister.getEntityName(), //polymorphism comment above
						ukName,
						type.semiResolve( values[index], session, object ),
						type,
						persister.getEntityMode(),
						session.getFactory()
					);
				session.getPersistenceContext().addEntity( euk, object );
			}
		}

		TwoPhaseLoad.postHydrate(
				persister,
				id,
				values,
				rowId,
				object,
				lockMode,
				session
			);

		OgmEntityEntryState.getStateFor( session, object ).getTuplePointer().setTuple( resultset );
	}
1364493
@GetMapping
  public String init(
      @RequestParam(value = "entity", required = false) String selectedEntityName,
      @RequestParam(value = "entityId", required = false) String selectedEntityId,
      Model model) {
    StringBuilder message = new StringBuilder("");

    final boolean currentUserIsSu = SecurityUtils.currentUserIsSu();

    Map<String, EntityType> entitiesMeta =
        dataService
            .getMeta()
            .getEntityTypes()
            .filter(entityType -> !entityType.isAbstract())
            .filter(entityType -> currentUserIsSu || !EntityTypeUtils.isSystemEntity(entityType))
            .sorted(Comparator.comparing(EntityType::getLabel))
            .collect(toLinkedMap(EntityType::getId, Function.identity()));

    model.addAttribute("entitiesMeta", entitiesMeta);
    if (selectedEntityId != null && selectedEntityName == null) {
      EntityType entityType = dataService.getMeta().getEntityType(selectedEntityId).orElse(null);
      if (entityType == null) {
        message.append("Entity does not exist or you do not have permission on this entity");
      } else {
        selectedEntityName = entityType.getId();
      }

      if (selectedEntityName != null) {
        checkExistsAndPermission(selectedEntityName, message);
      }
    }
    if (StringUtils.isNotEmpty(message.toString())) {
      model.addAttribute("warningMessage", message.toString());
    }
    model.addAttribute("selectedEntityName", selectedEntityName);
    boolean navigatorAvailable = menuReaderService.findMenuItemPath(NAVIGATOR) != null;
    model.addAttribute(
        "showNavigatorLink", dataExplorerSettings.isShowNavigatorLink() && navigatorAvailable);

    model.addAttribute("hasTrackingId", null != appSettings.getGoogleAnalyticsTrackingId());
    model.addAttribute(
        "hasMolgenisTrackingId", null != appSettings.getGoogleAnalyticsTrackingIdMolgenis());

    return "view-dataexplorer";
  }
1371196
public Object loadById(Class entity, Serializable id) throws Exception  {
		return getHibernateTemplate().load(entity, id);
	}
479877
def get_entity(package, entity):
    
    init_py = open(os.path.join(package, '__init__.py')).read()
    find = "__%s__ = ['\"]([^'\"]+)['\"]" % entity
    return re.search(find, init_py).group(1)