当前位置: 首页>>代码示例>>Java>>正文


Java Document.getBoolean方法代码示例

本文整理汇总了Java中org.bson.Document.getBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java Document.getBoolean方法的具体用法?Java Document.getBoolean怎么用?Java Document.getBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bson.Document的用法示例。


在下文中一共展示了Document.getBoolean方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isSyncNeeded

import org.bson.Document; //导入方法依赖的package包/类
private boolean isSyncNeeded(Document doc, BsonTimestamp oplogTs) {
    syncFlg = doc.getBoolean(SyncConstants.SYNC_FLAG, false);
    syncTime = doc.get(SyncConstants.SYNC_TIME);
    boolean syncNeeded = false;
    if (syncFlg) {
        syncNeeded = true;
    } else {
        if (!isRestrictedSyncEnabled) {
            if (syncTime != null) {
                if (oplogTs.getTime() - (Long.valueOf(String.valueOf(syncTime)) / 1000) > SYNC_DIFF) {
                    syncNeeded = true;
                }
            } else {
                syncNeeded = true;
            }
        }
    }
    return syncNeeded;
}
 
开发者ID:gagoyal01,项目名称:mongodb-rdbms-sync,代码行数:20,代码来源:MngToOrclSyncWriter.java

示例2: checkUserAdmin

import org.bson.Document; //导入方法依赖的package包/类
protected static ResponseEntity checkUserAdmin(SessionToken token, MongoCollection<Document> users, Document doc) {
    // getString will throw an exception if the key is not present in the document
    String loggedInUser = doc.getString("loggedInUser");
    if(loggedInUser.equals("none")) {
        // No user is logged in
        throw new RuntimeException(); // Move to catch block
    }

    Document userDoc = users.find(Filters.eq("username", loggedInUser)).first();

    if(userDoc == null) { // We can't find the logged in user in the users database, strange
        NectarServerApplication.getLogger().warn("Failed to find logged in user \"" + loggedInUser + "\" for session "
                + token.getUuid() + " while processing user registration"
        );
        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to find current logged in user in DB.");
    } else { // User found, check admin now
        if(!userDoc.getBoolean("admin", false)) {
            NectarServerApplication.getLogger().warn("ATTEMPTED CLIENT REGISTRATION BY NON_ADMIN USER \"" + loggedInUser + "\""
                    + " from session " + token.getUuid()
            );

            NectarServerApplication.getEventLog().addEntry(EventLog.EntryLevel.WARNING, "A non-admin user attempted to register a client from " + token.getUuid());
            throw new RuntimeException(); // Move to catch block
        }
        // User is confirmed logged in and admin, all checks passed.
    }
    return null;
}
 
开发者ID:jython234,项目名称:nectar-server,代码行数:29,代码来源:AuthController.java

示例3: isRSVPEnabled

import org.bson.Document; //导入方法依赖的package包/类
public boolean isRSVPEnabled(String cId)
{
    Document settings = Main.getDBDriver().getScheduleCollection().find(eq("_id",cId)).first();
    if( settings == null )
    {
        return false;
    }
    return settings.getBoolean("rsvp_enabled", false);
}
 
开发者ID:notem,项目名称:Saber-Bot,代码行数:10,代码来源:ScheduleManager.java

示例4: isRSVPConfirmationsEnabled

import org.bson.Document; //导入方法依赖的package包/类
public boolean isRSVPConfirmationsEnabled(String cId)
{
    Document settings = Main.getDBDriver().getScheduleCollection().find(eq("_id",cId)).first();
    if( settings == null )
    {
        return false;
    }
    return settings.getBoolean("rsvp_confirmations", false);
}
 
开发者ID:notem,项目名称:Saber-Bot,代码行数:10,代码来源:ScheduleManager.java

示例5: isRSVPExclusive

import org.bson.Document; //导入方法依赖的package包/类
public boolean isRSVPExclusive(String cId)
{
    Document settings = Main.getDBDriver().getScheduleCollection().find(eq("_id", cId)).first();
    return settings == null || settings.getBoolean("rsvp_exclusivity", true);
}
 
开发者ID:notem,项目名称:Saber-Bot,代码行数:6,代码来源:ScheduleManager.java


注:本文中的org.bson.Document.getBoolean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。