當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。