Retrieve the user presences (a map from resource to {@link Presence}) for a given XMPP entity represented by their bare JID.

@param entity the entity
@return the user presences
516072
private synchronized Map<Resourcepart, Presence> getOrCreatePresencesInternal(BareJid entity) {
        Map<Resourcepart, Presence> entityPresences = getPresencesInternal(entity);
        if (entityPresences == null) {
            if (contains(entity)) {
                entityPresences = new ConcurrentHashMap<>();
                presenceMap.put(entity, entityPresences);
            }
            else {
                LruCache<Resourcepart, Presence> nonRosterEntityPresences = new LruCache<>(32);
                nonRosterPresenceMap.put(entity, nonRosterEntityPresences);
                entityPresences = nonRosterEntityPresences;
            }
        }
        return entityPresences;
    }
892220
@Override
    public T create(T entity) {
        EntityManager entityManager = getEntityManager();
        entityManager.persist(entity);
        return entity;
    }
496202
public static Entity getSubEntityByRel(Entity entity, String... rel) {
        if(entity == null) {
            throw new IllegalArgumentException("entity cannot be null.");
        }
        if(ArrayUtils.isEmpty(rel)) {
            throw new IllegalArgumentException("rel cannot be null or empty");
        }
        List<Entity> entities = entity.getEntities();
        if (entities == null)
            return null;
        Entity ent = null;
        for (Entity e : entities) {
            if (ArrayUtils.isNotEmpty(e.getRel()) && ArrayUtils.toString(rel).equals(ArrayUtils.toString(e.getRel()))) {
                ent = e;
                break;
            }
        }
        return ent;
    }
104511
private void setOfflinePresences() {
        Presence packetUnavailable;
        outerloop: for (Jid user : presenceMap.keySet()) {
            Map<Resourcepart, Presence> resources = presenceMap.get(user);
            if (resources != null) {
                for (Resourcepart resource : resources.keySet()) {
                    packetUnavailable = new Presence(Presence.Type.unavailable);
                    EntityBareJid bareUserJid = user.asEntityBareJidIfPossible();
                    if (bareUserJid == null) {
                        LOGGER.warning("Can not transform user JID to bare JID: '" + user + "'");
                        continue;
                    }
                    packetUnavailable.setFrom(JidCreate.fullFrom(bareUserJid, resource));
                    try {
                        presencePacketListener.processStanza(packetUnavailable);
                    }
                    catch (NotConnectedException e) {
                        throw new IllegalStateException(
                                        "presencePacketListener should never throw a NotConnectedException when processStanza is called with a presence of type unavailable",
                                        e);
                    }
                    catch (InterruptedException e) {
                        break outerloop;
                    }
                }
            }
        }
    }
167388
def get_user_presence(self, userid):
        '''  '''
        response, status_code = self.__pod__.Presence.get_v2_user_uid_presence(
            sessionToken=self.__session__,
            uid=userid
        ).result()
        self.logger.debug('%s: %s' % (status_code, response))
        return status_code, response
324518
public function getPersistedRowFor(IEntity $entity)
    {
        $hash = spl_object_hash($entity);

        return isset($this->persistedEntityRows[$hash]) ? $this->persistedEntityRows[$hash] : null;
    }
1175206
function getNetworkedEntity(entity) {
  return new Promise((resolve, reject) => {
    let curEntity = entity;

    while(curEntity && curEntity.components && !curEntity.components.networked) {
      curEntity = curEntity.parentNode;
    }

    if (!curEntity || !curEntity.components || !curEntity.components.networked) {
      return reject("Entity does not have and is not a child of an entity with the [networked] component ");
    }

    if (curEntity.hasLoaded) {
      resolve(curEntity);
    } else {
      curEntity.addEventListener("instantiated", () => {
        resolve(curEntity);
      }, { once: true });
    }
  });
}
338776
@Override
    public Long get(Entity entity) {
        Objects.requireNonNull(entity, "entity cannot be null");
        // return property value
        return entity.get(idFieldName).asLong();
    }
288516
@Override
    public IUserInstance getUserInstance(HttpServletRequest request) throws PortalException {
        try {
            request = this.portalRequestUtils.getOriginalPortalRequest(request);
        } catch (IllegalArgumentException iae) {
            // ignore, just means that this isn't a wrapped request
        }

        // Use request attributes first for the fastest possible retrieval
        IUserInstance userInstance = (IUserInstance) request.getAttribute(KEY);
        if (userInstance != null) {
            return userInstance;
        }

        final IPerson person;
        try {
            // Retrieve the person object that is associated with the request
            person = this.personManager.getPerson(request);
        } catch (Exception e) {
            logger.error("Exception while retrieving IPerson!", e);
            throw new PortalSecurityException("Could not retrieve IPerson", e);
        }

        if (person == null) {
            throw new PortalSecurityException(
                    "PersonManager returned null person for this request.  With no user, there's no UserInstance.  Is PersonManager misconfigured?  RDBMS access misconfigured?");
        }

        final HttpSession session = request.getSession();
        if (session == null) {
            throw new IllegalStateException(
                    "HttpServletRequest.getSession() returned a null session for request: "
                            + request);
        }

        // Return the UserInstance object if it's in the session
        UserInstanceHolder userInstanceHolder = getUserInstanceHolder(session);
        if (userInstanceHolder != null) {
            userInstance = userInstanceHolder.getUserInstance();

            if (userInstance != null) {
                return userInstance;
            }
        }

        // Create either a UserInstance or a GuestUserInstance
        final LocaleManager localeManager = this.getLocaleManager(request, person);
        final String userAgent = this.getUserAgent(request);
        final IUserProfile userProfile =
                this.getUserProfile(request, person, localeManager, userAgent);

        // Create the user layout manager and user instance object
        IUserLayoutManager userLayoutManager =
                userLayoutManagerFactory.getUserLayoutManager(person, userProfile);

        final UserPreferencesManager userPreferencesManager =
                new UserPreferencesManager(person, userProfile, userLayoutManager);
        userInstance = new UserInstance(person, userPreferencesManager, localeManager);

        // Ensure the newly created UserInstance is cached in the session
        if (userInstanceHolder == null) {
            userInstanceHolder = new UserInstanceHolder();
        }
        userInstanceHolder.setUserInstance(userInstance);
        session.setAttribute(KEY, userInstanceHolder);
        request.setAttribute(KEY, userInstance);

        // Return the new UserInstance
        return userInstance;
    }
258340
public static function createFromEntity(Entity\Users $entity)
    {
        $user = new self();
        $user->id = $entity->getId();
        $user->userName = $entity->getUserName();
        $user->password = $entity->getPassword();
        $user->email = $entity->getEmail();
        $user->displayName = $entity->getDisplayname();
        $user->lastSeen = $entity->getLastSeen();
        $user->lastIp = $entity->getLastIp();
        $user->stack = $entity->getStack();
        $user->enabled = $entity->getEnabled();
        $user->roles = $entity->getRoles();

        return $user;
    }
327606
protected static Optional<URIBuilder.BasicNameValuePair> getEntityIdAsParameter(final Service service) {
        val builder = new URIBuilder(service.getId());
        return builder.getQueryParams()
            .stream()
            .filter(p -> p.getName().equals(SamlProtocolConstants.PARAMETER_ENTITY_ID))
            .findFirst();
    }
533406
public ApiResponse createEntity(Entity entity) {
        assertValidApplicationId();
        if (isEmpty(entity.getType())) {
            throw new IllegalArgumentException("Missing entity type");
        }
        ApiResponse response = apiRequest(HttpMethod.POST, null, entity,
                organizationId, applicationId, entity.getType());
        return response;
    }
1130324
public static function getServices(xAC\Entity $entity = null)
    {
        if ($entity) {
            return $entity->getServices();
        }
        
        if (count(self::$services) == 0) {
            self::initServices();
        }
        
        unset(self::$services['_timestamp']);
        
        return self::$services;
    }
149047
public Response createUser(UserEntity userEntity) {
		return restClient.post("users", userEntity, new HashMap<String, String>());
	}
916361
public ADDRESST registerParticipant(ADDRESST address, EventListener entity) {
		synchronized (mutex()) {
			addListener(address, entity);
			this.participants.put(entity.getID(), address);
		}
		return address;
	}
722410
public String getIDENTITY(EntityColumn column) {
        return MessageFormat.format(mapperHelper.getConfig().getIDENTITY(), column.getColumn(), column.getProperty(), column.getTable().getName());
    }
722798
public static synchronized MultiUserChatManager getInstanceFor(XMPPConnection connection) {
        MultiUserChatManager multiUserChatManager = INSTANCES.get(connection);
        if (multiUserChatManager == null) {
            multiUserChatManager = new MultiUserChatManager(connection);
            INSTANCES.put(connection, multiUserChatManager);
        }
        return multiUserChatManager;
    }