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


Java MongoOperations.save方法代码示例

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


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

示例1: prepare

import org.springframework.data.mongodb.core.MongoOperations; //导入方法依赖的package包/类
@Override
public void prepare(Description description) {
	super.prepare(description);

	Veiculo veiculo = VeiculoResourceCondition.OBJECT.get();

	MongoOperations mongoOperation = (MongoOperations) ApplicationContextProvider.getApplicationContext().getBean("mongoTemplate");

	Logradouro logradouro = new Logradouro();
	logradouro.setId("1");
	logradouro.setLogradouro("Rua das Acacias");
	logradouro.setCep("88030000");
	logradouro.setTp_logradouro("Rua");

	Infracao infracao1 = createInfracao("1", veiculo, logradouro);
	Infracao infracao2 = createInfracao("2", veiculo, logradouro);
	
	mongoOperation.save(infracao1);
	mongoOperation.save(infracao2);
}
 
开发者ID:UNGPublic,项目名称:sampleng-backend,代码行数:21,代码来源:InfracaoResourceCondition.java

示例2: testUpsertStb

import org.springframework.data.mongodb.core.MongoOperations; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testUpsertStb() {
    MongoHouseService service = new MongoHouseService();
    MongoOperations operations = EasyMock.createMock(MongoOperations.class);
    EasyMock.expect(operations.collectionExists((Class) EasyMock.anyObject())).andReturn(false);
    EasyMock.expect(operations.createCollection((Class) EasyMock.anyObject())).andReturn(null);

    operations.save((PersistableDevice) EasyMock.anyObject(), (String) EasyMock.anyObject());
    EasyMock.expectLastCall();
    EasyMock.expect(operations.findById((Object) EasyMock.anyObject(), (Class) EasyMock.anyObject(),
                (String) EasyMock.anyObject())).andReturn(null);
    EasyMock.replay(operations);
    ReflectionTestUtils.setField(service, "template", operations);

    ParkService mockParkService  = EasyMock.createMock(ParkService.class);
    EasyMock.expect(mockParkService.getModelById((String) EasyMock.anyObject())).andReturn(null);
    EasyMock.replay(mockParkService);
    ReflectionTestUtils.setField(service, "parkService", mockParkService);

    DawgDevice[] stb = new DawgDevice[1];
    stb[0] = new PersistableDevice();

    try {
        service.upsertStb(stb);
    } catch (Exception e) {
        Assert.fail(e.getMessage(),e);
    }
}
 
开发者ID:Comcast,项目名称:dawg,代码行数:30,代码来源:MongoHouseServiceTest.java

示例3: insertarEmpresasEnBD

import org.springframework.data.mongodb.core.MongoOperations; //导入方法依赖的package包/类
public static void insertarEmpresasEnBD(ArrayList<Empresa> empresas, MongoOperations mongoOperation) {

		for (Empresa e : empresas)
			if (e.getTweets() != null)
				mongoOperation.save(e);
	}
 
开发者ID:acardoco,项目名称:crauler_ISI,代码行数:7,代码来源:MongoFunctions.java

示例4: addScheduleToDB

import org.springframework.data.mongodb.core.MongoOperations; //导入方法依赖的package包/类
@SuppressWarnings("resource")
	private boolean addScheduleToDB(String queryName, String subscriptionID,
			String dest, String cronExpression, String eventType,
			String GE_eventTime, String LT_eventTime, String GE_recordTime,
			String LT_recordTime, String EQ_action, String EQ_bizStep,
			String EQ_disposition, String EQ_readPoint, String WD_readPoint,
			String EQ_bizLocation, String WD_bizLocation,
			String EQ_transformationID, String MATCH_epc,
			String MATCH_parentID, String MATCH_inputEPC,
			String MATCH_outputEPC, String MATCH_anyEPC, String MATCH_epcClass,
			String MATCH_inputEPCClass, String MATCH_outputEPCClass,
			String MATCH_anyEPCClass, String EQ_quantity, String GT_quantity,
			String GE_quantity, String LT_quantity, String LE_quantity,
			String orderBy, String orderDirection, String eventCountLimit,
			String maxEventCount, Map<String, String> paramMap) {
/*
		SubscriptionType st = new SubscriptionType(queryName, subscriptionID,
				dest, cronExpression, eventType, GE_eventTime, LT_eventTime,
				GE_recordTime, LT_recordTime, EQ_action, EQ_bizStep,
				EQ_disposition, EQ_readPoint, WD_readPoint, EQ_bizLocation,
				WD_bizLocation, EQ_transformationID, MATCH_epc, MATCH_parentID,
				MATCH_inputEPC, MATCH_outputEPC, MATCH_anyEPC, MATCH_epcClass,
				MATCH_inputEPCClass, MATCH_outputEPCClass, MATCH_anyEPCClass,
				EQ_quantity, GT_quantity, GE_quantity, LT_quantity,
				LE_quantity, orderBy, orderDirection, eventCountLimit,
				maxEventCount, paramMap);
				*/
		ApplicationContext ctx = new GenericXmlApplicationContext(
				"classpath:MongoConfig.xml");
		MongoOperations mongoOperation = (MongoOperations) ctx
				.getBean("mongoTemplate");

		List<SubscriptionType> existenceTest = mongoOperation.find(new Query(
				Criteria.where("subscriptionID").is(subscriptionID)),
				SubscriptionType.class);
		if (existenceTest.size() != 0)
			return false;
		if (existenceTest.size() == 0)
			mongoOperation.save(null);

		Configuration.logger.log(Level.INFO, "Subscription ID: "
				+ subscriptionID + " is added to DB. ");
		((AbstractApplicationContext) ctx).close();
		return true;
	}
 
开发者ID:JaewookByun,项目名称:epcis,代码行数:46,代码来源:MysqlQueryServiceSpring.java

示例5: insertarEnBD

import org.springframework.data.mongodb.core.MongoOperations; //导入方法依赖的package包/类
/**
 * Insertar en BD.
 *
 * @param ofertasInfoEmpleo
 *            the ofertas info empleo
 * @param mongoOperation
 *            the mongo operation
 */
public static void insertarEnBD(ArrayList<Oferta> ofertasInfoEmpleo, MongoOperations mongoOperation) {

	for (Oferta oferta : ofertasInfoEmpleo)
		mongoOperation.save(oferta);
}
 
开发者ID:acardoco,项目名称:crauler_ISI,代码行数:14,代码来源:MongoFunctions.java


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