本文整理汇总了Java中org.bson.Document.getDate方法的典型用法代码示例。如果您正苦于以下问题:Java Document.getDate方法的具体用法?Java Document.getDate怎么用?Java Document.getDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bson.Document
的用法示例。
在下文中一共展示了Document.getDate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSyncTime
import org.bson.Document; //导入方法依赖的package包/类
public Date getSyncTime(String cId)
{
Document settings = Main.getDBDriver().getScheduleCollection().find(eq("_id",cId)).first();
if( settings == null )
{
return Date.from(ZonedDateTime.of(LocalDate.now().plusDays(1),
LocalTime.MIDNIGHT, ZoneId.systemDefault()).toInstant());
}
Date syncTime = settings.getDate("sync_time");
if(syncTime == null)
{
return Date.from(ZonedDateTime.of(LocalDate.now().plusDays(1),
LocalTime.MIDNIGHT, ZoneId.systemDefault()).toInstant());
}
return syncTime;
}
示例2: getFeatreFromRowInternal
import org.bson.Document; //导入方法依赖的package包/类
public Object getFeatreFromRowInternal(Document row, String feature, String type) {
if (type.startsWith(athenaFeatureField.varintType)) {
return row.getInteger(feature);
} else if (type.startsWith(athenaFeatureField.bigintType)) {
Long l = row.getLong(feature);
return l;
} else if (type.startsWith(athenaFeatureField.doubleType)) {
Double d = row.getDouble(feature);
return d;
} else if (type.startsWith(athenaFeatureField.timestampType)) {
return row.getDate(feature);
} else {
log.warn("[getFeatreFromRowInternal] Not supported type :{}", type);
return null;
}
}
示例3: resourceStatusFromDocument
import org.bson.Document; //导入方法依赖的package包/类
public static ResourceStatus resourceStatusFromDocument(Document document) {
Document resourceDoc = (Document) document.get("resource");
Resource resource = resourceFromStatusRef(resourceDoc);
Status status = Status.fromSerialNumber(document.getInteger("statusOrdinal"));
Date updated = document.getDate("updated");
return new ResourceStatusImpl(resource, status, updated);
}
示例4: decodeOracleToMngSyncEvent
import org.bson.Document; //导入方法依赖的package包/类
private OracleToMongoSyncEvent decodeOracleToMngSyncEvent(Document document) {
OracleToMongoSyncEvent event = new OracleToMongoSyncEvent();
event.setCollectionName(document.getString(SyncAttrs.COLLECTION_NAME));
event.setSaveNulls(document.getBoolean(SyncAttrs.SAVE_NULLS, false));
List<Document> keyAttributeDocList = (List<Document>) document.get(SyncAttrs.KEY_ATTRIBUTES);
if(keyAttributeDocList!=null){
List<MongoAttribute> keyAttrList = new ArrayList<MongoAttribute>(keyAttributeDocList.size());
for(Document keyAttrDoc : keyAttributeDocList){
keyAttrList.add(decodeMongoAttribute(keyAttrDoc));
}
event.setKeyAttributes(keyAttrList);
}
event.setPollBased(document.getBoolean(SyncAttrs.POLL_BASED, false));
if(event.isPollBased()){
O2MSyncPollInfo pollInfo = new O2MSyncPollInfo();
Document pollInfoDoc = (Document) document.get(SyncAttrs.POLL_INFO);
pollInfo.setInterval(pollInfoDoc.getInteger(SyncAttrs.INTERVAL,1));
Date lastReadTime = pollInfoDoc.getDate(SyncAttrs.LAST_READ_TIME);
if(lastReadTime!=null){
pollInfo.setLastReadTime(lastReadTime);
}else{
pollInfo.setLastReadTime(new Date());
}
pollInfo.setPollingColumn(decodeColumn((Document) pollInfoDoc.get(SyncAttrs.POLLING_COLUMN)));
pollInfo.setTimeUnit(pollInfoDoc.getString(SyncAttrs.TIME_UNIT));
event.setPollInfo(pollInfo);
}
return event;
}
示例5: decodeSyncMap
import org.bson.Document; //导入方法依赖的package包/类
public OracleToMongoGridFsMap decodeSyncMap(Document document) {
OracleToMongoGridFsMap map = null;
String mapTypeStr = document.getString(SyncAttrs.MAP_TYPE);
map = decodeOracleToMongoGridFsMap(document);
Object _id = document.get(SyncAttrs.ID);
if (_id instanceof String) {// Coming from UI
map.setMapId(new ObjectId((String) _id));
} else if (_id instanceof ObjectId) { // Coming from Db
map.setMapId((ObjectId) _id);
}
map.setMapName(document.getString(SyncAttrs.MAP_NAME));
map.setMapType(MapType.valueOf(mapTypeStr));
map.setCreatedBy(document.getString(SyncAttrs.CREATED_BY));
if (document.getDate(SyncAttrs.CREATED_ON) != null) {
map.setCreatedOn(document.getDate(SyncAttrs.CREATED_ON));
} else {
map.setCreatedOn(new Date());// Map creation
}
map.setApprovedBy(document.getString(SyncAttrs.APPROVED_BY));
map.setApprovedOn(document.getDate(SyncAttrs.APPROVED_ON));
map.setComments(document.getString(SyncAttrs.COMMENTS));
map.setSourceDbName(document.getString(SyncAttrs.SOURCE_DB_NAME));
map.setSourceUserName(document.getString(SyncAttrs.SOURCE_USER_NAME));
map.setTargetDbName(document.getString(SyncAttrs.TARGET_DB_NAME));
map.setTargetUserName(document.getString(SyncAttrs.TARGET_USER_NAME));
return map;
}
示例6: decodeSyncMap
import org.bson.Document; //导入方法依赖的package包/类
public SyncMap decodeSyncMap(Document document) {
SyncMap map = null;
String mapTypeStr = document.getString(SyncAttrs.MAP_TYPE);
MapType mapTypeEnum = MapType.valueOf(mapTypeStr);
switch (mapTypeEnum) {
case OrclToMongo:
map = decodeOracleToMongoMap(document);
break;
case MongoToOrcl:
map = decodeMongoToOracleMap(document);
break;
case OrclToMongoGridFs:
map = decodeOracleToMongoGridFsMap(document);
break;
default:
return null;
}
Object _id = document.get(SyncAttrs.ID);
if (_id instanceof String) {// Coming from UI
map.setMapId(new ObjectId((String) _id));
} else if (_id instanceof ObjectId) { // Coming from Db
map.setMapId((ObjectId) _id);
}
map.setMapName(document.getString(SyncAttrs.MAP_NAME));
map.setMapType(MapType.valueOf(mapTypeStr));
map.setCreatedBy(document.getString(SyncAttrs.CREATED_BY));
if (document.getDate(SyncAttrs.CREATED_ON) != null) {
map.setCreatedOn(document.getDate(SyncAttrs.CREATED_ON));
} else {
map.setCreatedOn(new Date());// Map creation
}
map.setApprovedBy(document.getString(SyncAttrs.APPROVED_BY));
map.setApprovedOn(document.getDate(SyncAttrs.APPROVED_ON));
map.setComments(document.getString(SyncAttrs.COMMENTS));
map.setSourceDbName(document.getString(SyncAttrs.SOURCE_DB_NAME));
map.setSourceUserName(document.getString(SyncAttrs.SOURCE_USER_NAME));
map.setTargetDbName(document.getString(SyncAttrs.TARGET_DB_NAME));
map.setTargetUserName(document.getString(SyncAttrs.TARGET_USER_NAME));
return map;
}