本文整理汇总了Java中com.cloud.user.User.setState方法的典型用法代码示例。如果您正苦于以下问题:Java User.setState方法的具体用法?Java User.setState怎么用?Java User.setState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.cloud.user.User
的用法示例。
在下文中一共展示了User.setState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findUserAccountByApiKey
import com.cloud.user.User; //导入方法依赖的package包/类
@Override
public Pair<User, Account> findUserAccountByApiKey(final String apiKey) {
final TransactionLegacy txn = TransactionLegacy.currentTxn();
PreparedStatement pstmt = null;
Pair<User, Account> userAcctPair = null;
try {
final String sql = FIND_USER_ACCOUNT_BY_API_KEY;
pstmt = txn.prepareAutoCloseStatement(sql);
pstmt.setString(1, apiKey);
final ResultSet rs = pstmt.executeQuery();
// TODO: make sure we don't have more than 1 result? ApiKey had better be unique
if (rs.next()) {
final User u = new UserVO(rs.getLong(1));
u.setUsername(rs.getString(2));
u.setAccountId(rs.getLong(3));
u.setSecretKey(DBEncryptionUtil.decrypt(rs.getString(4)));
u.setState(State.valueOf(rs.getString(5)));
final AccountVO a = new AccountVO(rs.getLong(6));
a.setAccountName(rs.getString(7));
a.setType(rs.getShort(8));
a.setDomainId(rs.getLong(9));
a.setState(State.valueOf(rs.getString(10)));
userAcctPair = new Pair<>(u, a);
}
} catch (final Exception e) {
s_logger.warn("Exception finding user/acct by api key: " + apiKey, e);
}
return userAcctPair;
}