Package org.hibernate.ogm.datastore.couchdb.dialect.model.impl

Examples of org.hibernate.ogm.datastore.couchdb.dialect.model.impl.CouchDBTupleSnapshot


  @JsonIgnore
  public List<Tuple> getTuples() {
    List<Tuple> tuples = new ArrayList<Tuple>( rows.size() );
    if ( rows.size() > 0 ) {
      for ( Row row : rows ) {
        tuples.add( new Tuple( new CouchDBTupleSnapshot( row.getValue().getProperties() ) ) );
      }
    }
    return tuples;
  }
View Full Code Here


  @Override
  public Tuple getTuple(EntityKey key, TupleContext tupleContext) {
    EntityDocument entity = getDataStore().getEntity( Identifier.createEntityId( key ) );
    if ( entity != null ) {
      return new Tuple( new CouchDBTupleSnapshot( entity.getProperties() ) );
    }

    return null;
  }
View Full Code Here

    return null;
  }

  @Override
  public Tuple createTuple(EntityKey key, TupleContext tupleContext) {
    return new Tuple( new CouchDBTupleSnapshot( key ) );
  }
View Full Code Here

    return new Tuple( new CouchDBTupleSnapshot( key ) );
  }

  @Override
  public void insertOrUpdateTuple(EntityKey key, Tuple tuple, TupleContext tupleContext) {
    CouchDBTupleSnapshot snapshot = (CouchDBTupleSnapshot) tuple.getSnapshot();

    String revision = (String) snapshot.get( Document.REVISION_FIELD_NAME );

    // load the latest revision for updates without the revision being present; a warning about
    // this mapping will have been issued at factory start-up
    if ( revision == null && !snapshot.isCreatedOnInsert() ) {
      revision = getDataStore().getCurrentRevision( Identifier.createEntityId( key ), false );
    }

    // this will raise an optimistic locking exception if the revision is either null or not the current one
    getDataStore().saveDocument( new EntityDocument( key, revision, tuple ) );
View Full Code Here

  @Override
  public Tuple getTuple(EntityKey key, TupleContext tupleContext) {
    EntityDocument entity = getDataStore().getEntity( Identifier.createEntityId( key ) );
    if ( entity != null ) {
      return new Tuple( new CouchDBTupleSnapshot( entity.getProperties() ) );
    }

    return null;
  }
View Full Code Here

    return null;
  }

  @Override
  public Tuple createTuple(EntityKey key) {
    return new Tuple( new CouchDBTupleSnapshot( key ) );
  }
View Full Code Here

    return new Tuple( new CouchDBTupleSnapshot( key ) );
  }

  @Override
  public void updateTuple(Tuple tuple, EntityKey key) {
    CouchDBTupleSnapshot snapshot = (CouchDBTupleSnapshot) tuple.getSnapshot();

    String revision = (String) snapshot.get( Document.REVISION_FIELD_NAME );

    // load the latest revision for updates without the revision being present; a warning about
    // this mapping will have been issued at factory start-up
    if ( revision == null && !snapshot.isCreatedOnInsert() ) {
      revision = getDataStore().getCurrentRevision( Identifier.createEntityId( key ), false );
    }

    // this will raise an optimistic locking exception if the revision is either null or not the current one
    getDataStore().saveDocument( new EntityDocument( key, revision, tuple ) );
View Full Code Here

  @JsonIgnore
  public List<Tuple> getTuples() {
    List<Tuple> tuples = new ArrayList<Tuple>( rows.size() );
    if ( rows.size() > 0 ) {
      for ( Row row : rows ) {
        tuples.add( new Tuple( new CouchDBTupleSnapshot( row.getValue().getProperties() ) ) );
      }
    }
    return tuples;
  }
View Full Code Here

  @Override
  public Tuple getTuple(EntityKey key, TupleContext tupleContext) {
    EntityDocument entity = getDataStore().getEntity( Identifier.createEntityId( key ) );
    if ( entity != null ) {
      return new Tuple( new CouchDBTupleSnapshot( entity.getProperties() ) );
    }

    return null;
  }
View Full Code Here

    return null;
  }

  @Override
  public Tuple createTuple(EntityKey key, TupleContext tupleContext) {
    return new Tuple( new CouchDBTupleSnapshot( key ) );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.datastore.couchdb.dialect.model.impl.CouchDBTupleSnapshot

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.