本文整理汇总了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);
}
}
示例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 ) );
}
示例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;
}
示例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);
}
}
示例5: removeTuple
import org.hibernate.ogm.dialect.spi.TupleContext; //导入依赖的package包/类
@Override
public void removeTuple(EntityKey key, TupleContext tupleContext) {
remove( key );
}
示例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 ) );
}
示例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" );
}
示例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);
}
示例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));
}