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


Java Document.getDate方法代码示例

本文整理汇总了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;
}
 
开发者ID:notem,项目名称:Saber-Bot,代码行数:18,代码来源:ScheduleManager.java

示例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;
        }

    }
 
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:FeatureDatabaseMgmtManager.java

示例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);

}
 
开发者ID:YagelNasManit,项目名称:environment.monitor,代码行数:10,代码来源:DocumentMapper.java

示例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;
}
 
开发者ID:gagoyal01,项目名称:mongodb-rdbms-sync,代码行数:30,代码来源:SyncMapAndEventDecoder.java

示例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;
}
 
开发者ID:gagoyal01,项目名称:mongodb-rdbms-sync,代码行数:28,代码来源:SyncMapAndEventGridFsDecoder.java

示例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;
}
 
开发者ID:gagoyal01,项目名称:mongodb-rdbms-sync,代码行数:42,代码来源:SyncMapAndEventDecoder.java


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