當前位置: 首頁>>代碼示例>>Java>>正文


Java TupleContext類代碼示例

本文整理匯總了Java中org.hibernate.ogm.dialect.spi.TupleContext的典型用法代碼示例。如果您正苦於以下問題:Java TupleContext類的具體用法?Java TupleContext怎麽用?Java TupleContext使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TupleContext類屬於org.hibernate.ogm.dialect.spi包,在下文中一共展示了TupleContext類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fetchObject

import org.hibernate.ogm.dialect.spi.TupleContext; //導入依賴的package包/類
private ObjectNode fetchObject(EntityKey key, TupleContext tupleContext) {
    LightblueEntityMetadataId entityId = LightblueEntityMetadataId.extractEntityInfo(key.getMetadata());
    DataFindRequest request = new DataFindRequest(entityId.entityName, entityId.entityVersion);
    request.where(new ValueQuery("_id", ExpressionOperation.EQUALS, key.getColumnValues()[0].toString()));
    List<Projection> projections = new ArrayList<Projection>(Arrays.asList(projectionsFromColumns(tupleContext.getSelectableColumns())));
    projections.add(new FieldProjection("_id", true, true));
    request.select(projections);
    try {
        LightblueResponse response = provider.getLightblueClient().data(request);
        if (response.hasError()) {
            throw new RuntimeException("Error returned in response: " + response.getText());
        }
        return (ObjectNode) response.getJson().get("processed").get(0);
    } catch (LightblueException e) {
        throw new RuntimeException("Unable to communicate with lightblue.", e);
    }
}
 
開發者ID:kahowell,項目名稱:lightblue-hibernate-ogm,代碼行數:18,代碼來源:LightblueDialect.java

示例2: insertOrUpdateTuple

import org.hibernate.ogm.dialect.spi.TupleContext; //導入依賴的package包/類
@Override
public void insertOrUpdateTuple(EntityKey key, TuplePointer tuplePointer, TupleContext tupleContext) throws TupleAlreadyExistsException {
	IgniteCache<Object, BinaryObject> entityCache = provider.getEntityCache( key.getMetadata() );
	Tuple tuple = tuplePointer.getTuple();

	Object keyObject = null;
	BinaryObjectBuilder builder = null;
	IgniteTupleSnapshot tupleSnapshot = (IgniteTupleSnapshot) tuple.getSnapshot();
	keyObject = tupleSnapshot.getCacheKey();
	if ( tuple.getSnapshotType() == SnapshotType.UPDATE ) {
		builder = provider.createBinaryObjectBuilder( tupleSnapshot.getCacheValue() );
	}
	else {
		builder = provider.createBinaryObjectBuilder( provider.getEntityTypeName( key.getMetadata().getTable() ) );
	}
	for ( String columnName : tuple.getColumnNames() ) {
		Object value = tuple.get( columnName );
		if ( value != null ) {
			builder.setField( StringHelper.realColumnName( columnName ), value );
		}
		else {
			builder.removeField( StringHelper.realColumnName( columnName ) );
		}
	}
	BinaryObject valueObject = builder.build();
	entityCache.put( keyObject, valueObject );
	tuplePointer.setTuple( new Tuple( new IgniteTupleSnapshot( keyObject, valueObject, key.getMetadata() ), SnapshotType.UPDATE ) );
}
 
開發者ID:hibernate,項目名稱:hibernate-ogm-ignite,代碼行數:29,代碼來源:IgniteDialect.java

示例3: getTuple

import org.hibernate.ogm.dialect.spi.TupleContext; //導入依賴的package包/類
@Override
public Tuple getTuple(EntityKey key, TupleContext tupleContext) {
    ObjectNode object = fetchObject(key, tupleContext);
    if (object != null) {
        return new Tuple(new LightblueTupleSnapshot(object, key.getMetadata(), OperationType.UPDATE));
    }
    if (isInQueue(key, tupleContext)) {
        return createTuple(key, tupleContext);
    }
    return null;
}
 
開發者ID:kahowell,項目名稱:lightblue-hibernate-ogm,代碼行數:12,代碼來源:LightblueDialect.java

示例4: removeTuple

import org.hibernate.ogm.dialect.spi.TupleContext; //導入依賴的package包/類
@Override
public void removeTuple(EntityKey key, TupleContext tupleContext) {
    LightblueEntityMetadataId entityId = LightblueEntityMetadataId.extractEntityInfo(key.getMetadata());
    DataDeleteRequest request = new DataDeleteRequest(entityId.entityName, entityId.entityVersion);
    request.where(new ValueQuery("_id", ExpressionOperation.EQUALS, key.getColumnValues()[0].toString()));
    try {
        LightblueResponse data = provider.getLightblueClient().data(request);
        System.out.println(data.getJson());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
開發者ID:kahowell,項目名稱:lightblue-hibernate-ogm,代碼行數:13,代碼來源:LightblueDialect.java

示例5: removeTuple

import org.hibernate.ogm.dialect.spi.TupleContext; //導入依賴的package包/類
@Override
public void removeTuple(EntityKey key, TupleContext tupleContext) {
	remove( key );
}
 
開發者ID:hibernate,項目名稱:hibernate-ogm-redis,代碼行數:5,代碼來源:AbstractRedisDialect.java

示例6: removeTuple

import org.hibernate.ogm.dialect.spi.TupleContext; //導入依賴的package包/類
@Override
public void removeTuple(EntityKey key, TupleContext tupleContext) {
	IgniteCache<Object, BinaryObject> entityCache = provider.getEntityCache( key.getMetadata() );
	entityCache.remove( provider.createKeyObject( key ) );
}
 
開發者ID:hibernate,項目名稱:hibernate-ogm-ignite,代碼行數:6,代碼來源:IgniteDialect.java

示例7: executeBackendUpdateQuery

import org.hibernate.ogm.dialect.spi.TupleContext; //導入依賴的package包/類
@Override
public int executeBackendUpdateQuery(BackendQuery<IgniteQueryDescriptor> query, QueryParameters queryParameters, TupleContext tupleContext) {
	throw new UnsupportedOperationException( "executeBackendUpdateQuery() is not implemented" );
}
 
開發者ID:hibernate,項目名稱:hibernate-ogm-ignite,代碼行數:5,代碼來源:IgniteDialect.java

示例8: isInQueue

import org.hibernate.ogm.dialect.spi.TupleContext; //導入依賴的package包/類
private boolean isInQueue(EntityKey key, TupleContext tupleContext) {
    return tupleContext.getOperationsQueue() != null && tupleContext.getOperationsQueue().contains(key);
}
 
開發者ID:kahowell,項目名稱:lightblue-hibernate-ogm,代碼行數:4,代碼來源:LightblueDialect.java

示例9: createTuple

import org.hibernate.ogm.dialect.spi.TupleContext; //導入依賴的package包/類
@Override
public Tuple createTuple(EntityKey key, TupleContext tupleContext) {
    return new Tuple(new LightblueTupleSnapshot(mapper.createObjectNode(), key.getMetadata(), OperationType.INSERT));
}
 
開發者ID:kahowell,項目名稱:lightblue-hibernate-ogm,代碼行數:5,代碼來源:LightblueDialect.java


注:本文中的org.hibernate.ogm.dialect.spi.TupleContext類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。