本文整理汇总了Java中org.jooq.Result.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java Result.isEmpty方法的具体用法?Java Result.isEmpty怎么用?Java Result.isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jooq.Result
的用法示例。
在下文中一共展示了Result.isEmpty方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLockById
import org.jooq.Result; //导入方法依赖的package包/类
/**
* The returned Lock should not be saved for later use!
*
* @param lockID the locks id
* @return a copy of the Lock with given id
*/
public Lock getLockById(Long lockID)
{
Lock lock = this.locksById.get(lockID);
if (lock != null)
{
return lock;
}
LockModel lockModel = database.getDSL().selectFrom(TABLE_LOCKS).where(TABLE_LOCKS.ID.eq(lockID)).fetchOne();
if (lockModel != null)
{
Result<LockLocationModel> fetch = database.getDSL().selectFrom(TABLE_LOCK_LOCATIONS)
.where(TABLE_LOCK_LOCATIONS.LOCK_ID.eq(lockModel.getValue(TABLE_LOCKS.ID)))
.fetch();
if (fetch.isEmpty())
{
return new Lock(this, lockModel, i18n);
}
return new Lock(this, lockModel, i18n, fetch);
}
return null;
}
示例2: listRolesOfUser
import org.jooq.Result; //导入方法依赖的package包/类
@Override
public List<Role> listRolesOfUser(int userId, String context) throws BazaarException {
List<Role> roles = null;
try {
de.rwth.dbis.acis.bazaar.service.dal.jooq.tables.Role roleTable = ROLE.as("role");
de.rwth.dbis.acis.bazaar.service.dal.jooq.tables.Privilege privilegeTable = PRIVILEGE.as("privilege");
Result<Record> queryResult = jooq.selectFrom(
USER_ROLE_MAP
.join(roleTable).on(USER_ROLE_MAP.ROLE_ID.eq(roleTable.ID))
.leftOuterJoin(ROLE_PRIVILEGE_MAP).on(ROLE_PRIVILEGE_MAP.ROLE_ID.eq(ROLE.ID))
.leftOuterJoin(PRIVILEGE).on(PRIVILEGE.ID.eq(ROLE_PRIVILEGE_MAP.PRIVILEGE_ID))
).where(USER_ROLE_MAP.USER_ID.equal(userId).and(USER_ROLE_MAP.CONTEXT_INFO.eq(context).or(USER_ROLE_MAP.CONTEXT_INFO.isNull()))).fetch();
if (queryResult != null && !queryResult.isEmpty()) {
roles = new ArrayList<>();
convertToRoles(roles, roleTable, privilegeTable, queryResult);
}
} catch (Exception e) {
ExceptionHandler.getInstance().convertAndThrowException(e, ExceptionLocation.REPOSITORY, ErrorCode.UNKNOWN);
}
return roles;
}
示例3: listParentsForRole
import org.jooq.Result; //导入方法依赖的package包/类
@Override
public List<Role> listParentsForRole(int roleId) throws BazaarException {
List<Role> roles = null;
try {
de.rwth.dbis.acis.bazaar.service.dal.jooq.tables.Role roleTable = ROLE.as("role");
de.rwth.dbis.acis.bazaar.service.dal.jooq.tables.Privilege privilegeTable = PRIVILEGE.as("privilege");
Result<Record> queryResult = jooq.selectFrom(
ROLE_ROLE_MAP
.join(roleTable).on(ROLE_ROLE_MAP.PARENT_ID.equal(roleTable.ID))
.leftOuterJoin(ROLE_PRIVILEGE_MAP).on(ROLE_PRIVILEGE_MAP.ROLE_ID.eq(roleTable.ID))
.leftOuterJoin(privilegeTable).on(privilegeTable.ID.eq(ROLE_PRIVILEGE_MAP.PRIVILEGE_ID))
).where(ROLE_ROLE_MAP.CHILD_ID.equal(roleId)).fetch();
if (queryResult != null && !queryResult.isEmpty()) {
roles = new ArrayList<>();
convertToRoles(roles, roleTable, privilegeTable, queryResult);
}
} catch (Exception e) {
ExceptionHandler.getInstance().convertAndThrowException(e, ExceptionLocation.REPOSITORY, ErrorCode.UNKNOWN);
}
return roles;
}
示例4: displayTags
import org.jooq.Result; //导入方法依赖的package包/类
private void displayTags(DiscordBot bot, GuildMessageReceivedEvent event) {
DSLContext database = bot.getDatabase();
JDA shard = event.getJDA();
Guild guild = event.getGuild();
TextChannel channel = event.getChannel();
Message message = event.getMessage();
Result<TaglistRecord> records = database.selectFrom(Tables.TAGLIST)
.where(Tables.TAGLIST.GUILDID.eq(guild.getId()))
.fetch();
if (records.isEmpty()) {
DiscordUtils.successReact(bot, message);
DiscordUtils.sendMessage(channel, "No tags have been added yet!");
return;
}
StringJoiner tagString = new StringJoiner("\n");
for (TaglistRecord record: records) {
tagString.add("\u2022 `" + record.getName() + "`");
}
EmbedBuilder embed = new EmbedBuilder();
embed.setAuthor("Safety Jim", null, shard.getSelfUser().getAvatarUrl());
embed.addField("List of tags", tagString.toString(), false);
embed.setColor(new Color(0x4286F4));
DiscordUtils.successReact(bot, message);
DiscordUtils.sendMessage(channel, embed.build());
}
示例5: findWithPlanetId
import org.jooq.Result; //导入方法依赖的package包/类
@Override
public Optional<Hangar> findWithPlanetId(UUID planetId) {
Preconditions.checkNotNull(planetId, "planetId");
LOGGER.debug("Finding hangar for planet {}", planetId);
Result<Record> result = context().select().from(HANGAR).leftOuterJoin(HANGAR_SHIPS).on(HANGAR_SHIPS.HANGAR_ID.eq(HANGAR.ID)).where(HANGAR.PLANET_ID.eq(planetId)).fetch();
if (result.isEmpty()) {
return Optional.empty();
}
Record firstRecord = result.get(0);
UUID id = firstRecord.getValue(HANGAR.ID);
UUID playerId = firstRecord.getValue(HANGAR.PLAYER_ID);
Map<ShipType, Integer> ships = Maps.newHashMap();
for (Record record : result) {
Integer shipType = record.getValue(HANGAR_SHIPS.TYPE);
Integer amount = record.getValue(HANGAR_SHIPS.AMOUNT);
// Fields can be null because of the left outer join
if (shipType != null && amount != null) {
ships.put(ShipType.fromId(shipType), amount);
}
}
return Optional.of(new Hangar(id, planetId, playerId, new Ships(ships)));
}
示例6: run
import org.jooq.Result; //导入方法依赖的package包/类
@Override
public boolean run(DiscordBot bot, GuildMessageReceivedEvent event, String args) {
Member member = event.getMember();
Message message = event.getMessage();
Guild guild = event.getGuild();
GuildController controller = guild.getController();
List<User> mentions = message.getMentionedUsers();
DSLContext database = bot.getDatabase();
if (!member.hasPermission(Permission.MANAGE_ROLES)) {
DiscordUtils.failMessage(bot, message, "You don't have enough permissions to execute this command! Required permission: Manage Roles");
return false;
}
if (!guild.getSelfMember().hasPermission(Permission.MANAGE_ROLES)) {
DiscordUtils.failMessage(bot, message, "I don't have enough permissions do this action!");
return false;
}
// If no arguments are given or there are no mentions or first word isn't a user mention, display syntax text
if (args.equals("") || mentions.size() == 0) {
return true;
}
Role muteRole = guild.getRolesByName("Muted", false).get(0);
if (muteRole == null) {
DiscordUtils.failMessage(bot, message, "Could not find a role called Muted, please create one yourself or mute a user to set it up automatically.");
return false;
}
for (User unmuteUser: mentions) {
Member unmuteMember = guild.getMember(unmuteUser);
controller.removeSingleRoleFromMember(unmuteMember, muteRole).queue();
Result<MutelistRecord> records = database.selectFrom(Tables.MUTELIST)
.where(Tables.MUTELIST.USERID.eq(unmuteUser.getId()))
.and(Tables.MUTELIST.GUILDID.eq(guild.getId()))
.fetch();
if (records.isEmpty()) {
continue;
}
for (MutelistRecord record: records) {
record.setUnmuted(true);
record.update();
}
}
DiscordUtils.successReact(bot, message);
return false;
}
示例7: onCommand
import org.jooq.Result; //导入方法依赖的package包/类
@Override
public void onCommand(String command, User user, PircBotX network, String prefix, Channel channel, boolean isPrivate, int userPermLevel, String... args) throws Exception {
String BeforeIP = GeneralUtils.getIP(args[1], network, false);
if (BeforeIP == null) {
IRCUtils.sendError(user, network, channel, "Invalid ip/user", prefix);
return;
} else if (BeforeIP.contains(":")) {
IRCUtils.sendError(user, network, channel, "IPv6 is not supported", prefix);
return;
}
String[] IPString = StringUtils.split(BeforeIP, ".");
String IP = "";
for (int i = IPString.length - 1; i >= 0; i--) {
if (IP.isEmpty()) {
IP = IPString[i];
} else {
IP += "." + IPString[i];
}
}
Boolean sent = false;
Resolver resolver = new SimpleResolver();
Result<Record> blacklist = DatabaseUtils.getBlacklists(args[0]);
if (blacklist.isEmpty()) {
IRCUtils.sendError(user, network, channel, "No " + args[0] + " blacklists found in database", prefix);
return;
}
for (org.jooq.Record Blacklist : blacklist) {
Lookup lookup = new Lookup(IP + "." + Blacklist.getValue(BLACKLISTS.URL), Type.ANY);
lookup.setResolver(resolver);
lookup.setCache(null);
org.xbill.DNS.Record[] records = lookup.run();
if (lookup.getResult() == Lookup.SUCCESSFUL) {
String msg = BeforeIP + " found in " + Blacklist.getValue(BLACKLISTS.URL);
sent = true;
for (org.xbill.DNS.Record rec : records) {
if (rec instanceof TXTRecord) {
msg += " - [" + Type.string(rec.getType()) + "] " + StringUtils.join(rec, " ");
}
}
IRCUtils.sendMessage(user, network, channel, BeforeIP + " found in " + Blacklist.getValue(BLACKLISTS.URL), prefix);
}
}
if (!sent) {
IRCUtils.sendMessage(user, network, channel, BeforeIP + " not found in " + args[0] + " blacklists", prefix);
}
}