Pick session for specific keys

@param uid        User's id
@param keyGroupId User's key group
@param ownKeyId   Own Pre Key id
@param theirKeyId Their Pre Key id
767846
public Promise<PeerSession> pickSession(final int uid,
                                            final int keyGroupId,
                                            final long ownKeyId,
                                            final long theirKeyId) {

        return pickCachedSession(uid, keyGroupId, ownKeyId, theirKeyId)
                .fallback(new Function<Exception, Promise<PeerSession>>() {
                    @Override
                    public Promise<PeerSession> apply(Exception e) {
                        return Promises.tuple(
                                keyManager.getOwnIdentity(),
                                keyManager.getOwnPreKey(ownKeyId),
                                keyManager.getUserKeyGroups(uid),
                                keyManager.getUserPreKey(uid, keyGroupId, theirKeyId))
                                .map(new FunctionTupled4<KeyManagerActor.OwnIdentity, PrivateKey, UserKeys, PublicKey, PeerSession>() {
                                    @Override
                                    public PeerSession apply(KeyManagerActor.OwnIdentity ownIdentity, PrivateKey ownPreKey, UserKeys userKeys, PublicKey theirPreKey) {

                                        UserKeysGroup keysGroup = ManagedList.of(userKeys.getUserKeysGroups())
                                                .filter(UserKeysGroup.BY_KEY_GROUP(keyGroupId))
                                                .first();

                                        return spawnSession(uid,
                                                ownIdentity.getKeyGroup(),
                                                keyGroupId,
                                                ownIdentity.getIdentityKey(),
                                                keysGroup.getIdentityKey(),
                                                ownPreKey,
                                                theirPreKey);
                                    }
                                });
                    }
                });
    }
1001425
def uid_gid(user, group, fd=None, path=None):
    ''''''
    type_msg = u'{0} must be a string or integer, not: {1}'
    nosuch_msg = u'no such {0}: {1}'
    if fd is not None and path is not None:
        raise ValueError(u'received path and fd arguments, need one or'\
                         u' neither, not both.')

    # -1 is don't change for chown/fchown
    user = -1 if user is None else user
    group = -1 if group is None else group
    try:
        user = int(user)
    except (TypeError, ValueError):
        try:
            user = pwd.getpwnam(user).pw_uid
        except TypeError:
            raise TypeError(type_msg.format(u'user', user.__class__.__name__))
        except KeyError:
            raise FSQEnvError(errno.EINVAL, nosuch_msg.format(u'user', user))
    except TypeError:
        raise TypeError(type_msg.format(u'group', group.__class__.__name__))
    try:
        group = int(group)
    except ValueError:
        try:
            group = grp.getgrnam(group).gr_gid
        except TypeError:
            raise TypeError(type_msg.format(u'group',
                            group.__class__.__name__))
        except KeyError:
            raise FSQEnvError(errno.EINVAL, nosuch_msg.format(u'group',
                              group))
    except TypeError:
        raise TypeError(type_msg.format(u'group', group.__class__.__name__))

    return user, group
293530
private Promise<PrivateKey> fetchPreKey(long keyId) {
        try {
            return Promise.success(ManagedList.of(ownKeys.getPreKeys())
                    .filter(PrivateKey.PRE_KEY_EQUALS_ID(keyId))
                    .first());
        } catch (Exception e) {
            Log.d(TAG, "Unable to find own pre key #" + keyId);
            throw e;
        }
    }
336422
public function set_usergroup($user_id, $group_id)
    {
        if (!$this->is_loggedin) {
            return false;
        }

        $payload  = ['usergroup_id' => $group_id];
        $response = $this->exec_curl('/api/s/' . $this->site . '/upd/user/' . trim($user_id), $payload);

        return $this->process_response_boolean($response);
    }
417365
public static List<CommerceWishList> findByG_U_D(long groupId, long userId,
		boolean defaultWishList) {
		return getPersistence().findByG_U_D(groupId, userId, defaultWishList);
	}
1300462
protected void initKey(String providerId, String providerUserId) {
		if (providerUserId == null) {
			providerUserId = setValues().providerUserId;
		}
		key = new ConnectionKey(providerId, providerUserId);		
	}
720849
public List<OrgActiveRuleDto> selectByProfileUuid(DbSession dbSession, String uuid) {
    return mapper(dbSession).selectByProfileUuid(uuid);
  }
171935
@Override
	public final void setUUID(UUID id) {
		final UUID oldId = getUUID();
		if ((oldId != null && !oldId.equals(id)) || (oldId == null && id != null)) {
			super.setUUID(oldId);
			fireElementChanged();
		}
	}
348948
void setId(String sessionAuthId) {
        synchronized (lock) {
            if (isCreatingSession.get()) {
                this.sessionAuthId = sessionAuthId;
            }
            lock.notifyAll();
        }
    }
1261078
function (id, options) {
    this.id = id;
    this.group = options.group;
    this.triggers = options.triggers || options.keys;

    this.reset();
}
1083802
public static com.liferay.commerce.product.model.CPOptionValue getCPOptionValueByUuidAndGroupId(
		String uuid, long groupId)
		throws com.liferay.portal.kernel.exception.PortalException {
		return getService().getCPOptionValueByUuidAndGroupId(uuid, groupId);
	}
1183422
public void setUserGroup(String userGroup) {

        CmsGroup group = checkGroup(userGroup);
        if (group != null) {
            m_project.setGroupId(group.getId());
        }
    }
1190711
function(name, service) {
  this.name = name;
  this.groups = {};       // group map for uids. key: sid, value: [uid]
  this.records = {};      // member records. key: uid
  this.__channelService__ = service;
  this.state = ST_INITED;
  this.userAmount =0;
}
40958
public void setUserId(String userId) {
        if (userId == null) {
            _properties.remove(AMQP_PROP_USER_ID);
            return;
        }
        
        _properties.put(AMQP_PROP_USER_ID, userId);
    }
545296
public void deleteGroup(String key, IPerson deleter) {

        if (!canDeleteGroup(deleter, key)) {
            throw new RuntimeAuthorizationException(
                    deleter, IPermission.DELETE_GROUP_ACTIVITY, key);
        }

        log.info("Deleting group with key " + key);

        // find the current version of this group entity
        IEntityGroup group = GroupService.findGroup(key);

        // remove this group from the membership list of any current parent
        // groups
        for (IEntityGroup parent : group.getParentGroups()) {
            parent.removeChild(group);
            parent.updateMembers();
        }

        // delete the group
        group.delete();
    }
756579
@Override
	public CPOption fetchCPOptionByUuidAndGroupId(String uuid, long groupId) {
		return cpOptionPersistence.fetchByUUID_G(uuid, groupId);
	}
1335861
public void setGroupId(java.util.Collection<String> groupId) {
        if (groupId == null) {
            this.groupId = null;
            return;
        }

        this.groupId = new com.amazonaws.internal.SdkInternalList<String>(groupId);
    }