public abstract class InMemoryDocumentSessionOperations
extends java.lang.Object
implements java.lang.AutoCloseable
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
dbName |
protected java.util.Set<java.lang.Object> |
deletedEntities |
protected java.util.Map<java.lang.Object,DocumentMetadata> |
entitiesAndMetadata |
protected java.util.Map<java.lang.String,java.lang.Object> |
entitiesByKey |
EntityToJson |
entityToJson |
protected boolean |
generateDocumentKeysOnStore |
protected java.util.Map<java.lang.String,JsonDocument> |
includedDocumentsByKey |
protected java.util.Set<java.lang.String> |
knownMissingIds |
protected static ILog |
log |
protected java.util.Map<ILazyOperation,Action1<java.lang.Object>> |
onEvaluateLazy |
protected java.util.List<ILazyOperation> |
pendingLazyOperations |
protected DocumentSessionListeners |
theListeners |
Modifier | Constructor and Description |
---|---|
protected |
InMemoryDocumentSessionOperations(java.lang.String dbName,
DocumentStoreBase documentStore,
DocumentSessionListeners listeners,
java.util.UUID id)
Initializes a new instance of the
InMemoryDocumentSessionOperations class. |
Modifier and Type | Method and Description |
---|---|
protected void |
assertNoNonUniqueInstance(java.lang.Object entity,
java.lang.String id) |
boolean |
checkIfIdAlreadyIncluded(java.lang.String[] ids,
Tuple<java.lang.String,java.lang.Class<?>>[] includes) |
void |
clear()
Clears this instance.
|
void |
close()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
java.lang.Object |
convertToEntity(java.lang.Class<?> entityType,
java.lang.String id,
RavenJObject documentFound,
RavenJObject metadata)
Converts the json document to an entity.
|
java.lang.String |
createDynamicIndexName(java.lang.Class clazz) |
protected ICommandData |
createPutEntityCommand(java.lang.Object entity,
DocumentMetadata documentMetadata)
Creates the put entity command.
|
void |
defer(ICommandData... commands)
Defer commands to be executed on saveChanges()
|
<T> void |
delete(java.lang.Class<T> clazz,
java.lang.Number id)
Marks the specified entity for deletion.
|
<T> void |
delete(java.lang.Class<T> clazz,
java.util.UUID id)
Marks the specified entity for deletion.
|
void |
delete(java.lang.String id)
Marks the specified entity for deletion.
|
<T> void |
delete(T entity)
Marks the specified entity for deletion.
|
static void |
ensureNotReadVetoed(RavenJObject metadata) |
protected boolean |
entityChanged(java.lang.Object entity,
DocumentMetadata documentMetadata) |
protected boolean |
entityChanged(java.lang.Object entity,
DocumentMetadata documentMetadata,
java.util.Map<java.lang.String,java.util.List<DocumentsChanges>> changes)
Determines if the entity have changed.
|
<T> void |
evict(T entity)
Evicts the specified entity from the session.
|
void |
explicitlyVersion(java.lang.Object entity)
Version this entity when it is saved.
|
protected abstract java.lang.String |
generateKey(java.lang.Object entity) |
DocumentConvention |
getConventions()
Gets the conventions used by this session
This instance is shared among all sessions, changes to the
DocumentConvention should be done
via the IDocumentStore instance, not on a single session. |
java.lang.String |
getDatabaseName() |
java.lang.String |
getDocumentId(java.lang.Object instance)
Gets the document id.
|
IDocumentStore |
getDocumentStore() |
EntityToJson |
getEntityToJson() |
<T> Etag |
getEtagFor(T instance)
Gets the ETag for the specified entity.
|
java.util.Map<java.lang.String,java.lang.Object> |
getExternalState() |
GenerateEntityIdOnTheClient |
getGenerateEntityIdOnTheClient() |
java.util.UUID |
getId() |
protected abstract JsonDocument |
getJsonDocument(java.lang.String documentKey)
Get the json document by key from the store
|
DocumentSessionListeners |
getListeners() |
int |
getMaxNumberOfRequestsPerSession()
Gets the max number of requests per session.
|
<T> RavenJObject |
getMetadataFor(T instance)
Gets the metadata for the specified entity.
|
java.lang.Long |
getNonAuthoritativeInformationTimeout()
Gets the timeout to wait for authoritative information if encountered non authoritative document.
|
int |
getNumberOfEntitiesInUnitOfWork()
Gets the number of entities held in memory to manage Unit of Work
|
int |
getNumberOfRequests() |
java.lang.String |
getStoreIdentifier()
Gets the store identifier for this session.
|
boolean |
hasChanged(java.lang.Object entity)
Determines whether the specified entity has changed.
|
boolean |
hasChanges()
Gets a value indicating whether any of the entities tracked by the session has changes.
|
int |
hashCode() |
void |
incrementRequestCount() |
boolean |
isAllowNonAuthoritativeInformation()
Gets a value indicating whether non authoritative information is allowed.
|
boolean |
isDeleted(java.lang.String id)
Returns whatever a document with the specified id is deleted
or known to be missing
|
boolean |
isLoaded(java.lang.String id)
Returns whatever a document with the specified id is loaded in the
current session
|
boolean |
isUseOptimisticConcurrency()
Gets a value indicating whether the session should use optimistic concurrency.
|
protected void |
logBatch(SaveChangesData data) |
void |
markReadOnly(java.lang.Object entity)
Mark the entity as read only, change tracking won't apply
to such an entity.
|
protected SaveChangesData |
prepareForSaveChanges()
Prepares for save changes.
|
<T> void |
refreshInternal(T entity,
JsonDocument jsonDocument,
DocumentMetadata value) |
void |
registerMissing(java.lang.String id) |
void |
registerMissingIncludes(java.util.Collection<RavenJObject> results,
java.util.Collection<java.lang.String> includes) |
protected void |
rememberEntityForDocumentKeyGeneration(java.lang.Object entity) |
void |
setAllowNonAuthoritativeInformation(boolean allowNonAuthoritativeInformation)
Sets a value indicating whether non authoritative information is allowed.
|
protected void |
setDatabaseName(java.lang.String databaseName) |
void |
setMaxNumberOfRequestsPerSession(int maxNumberOfRequestsPerSession)
Sets the max number of requests per session.
|
void |
setNonAuthoritativeInformationTimeout(java.lang.Long nonAuthoritativeInformationTimeout)
Sets the timeout to wait for authoritative information if encountered non authoritative document.
|
void |
setUseOptimisticConcurrency(boolean useOptimisticConcurrency)
Sets a value indicating whether the session should use optimistic concurrency.
|
void |
store(java.lang.Object entity)
Stores the specified entity in the session.
|
void |
store(java.lang.Object entity,
Etag etag)
Stores the specified entity in the session.
|
void |
store(java.lang.Object entity,
Etag etag,
java.lang.String id)
Stores the specified entity in the session, explicitly specifying its Id.
|
void |
store(java.lang.Object entity,
java.lang.String id)
Stores the specified entity in the session, explicitly specifying its Id.
|
protected void |
storeEntityInUnitOfWork(java.lang.String id,
java.lang.Object entity,
Etag etag,
RavenJObject metadata,
boolean forceConcurrencyCheck) |
java.lang.Object |
trackEntity(java.lang.Class<?> entityType,
JsonDocument documentFound)
Tracks the entity inside the unit of work
|
java.lang.Object |
trackEntity(java.lang.Class<?> entityType,
java.lang.String key,
RavenJObject document,
RavenJObject metadata,
boolean noTracking)
Tracks the entity.
|
void |
trackIncludedDocument(JsonDocument include) |
protected void |
updateBatchResults(java.util.List<BatchResult> batchResults,
SaveChangesData saveChangesData)
Updates the batch results.
|
java.util.Map<java.lang.String,java.util.List<DocumentsChanges>> |
whatChanged() |
protected final java.util.List<ILazyOperation> pendingLazyOperations
protected final java.util.Map<ILazyOperation,Action1<java.lang.Object>> onEvaluateLazy
protected boolean generateDocumentKeysOnStore
protected static final ILog log
protected final java.util.Set<java.lang.Object> deletedEntities
protected final java.util.Set<java.lang.String> knownMissingIds
protected final java.util.Map<java.lang.Object,DocumentMetadata> entitiesAndMetadata
protected final java.util.Map<java.lang.String,JsonDocument> includedDocumentsByKey
protected final java.util.Map<java.lang.String,java.lang.Object> entitiesByKey
protected final java.lang.String dbName
protected final DocumentSessionListeners theListeners
public EntityToJson entityToJson
protected InMemoryDocumentSessionOperations(java.lang.String dbName, DocumentStoreBase documentStore, DocumentSessionListeners listeners, java.util.UUID id)
InMemoryDocumentSessionOperations
class.dbName
- documentStore
- listeners
- id
- public DocumentSessionListeners getListeners()
public int getNumberOfEntitiesInUnitOfWork()
public int getNumberOfRequests()
public IDocumentStore getDocumentStore()
public java.util.Map<java.lang.String,java.lang.Object> getExternalState()
public java.util.UUID getId()
protected void setDatabaseName(java.lang.String databaseName)
public java.lang.String getDatabaseName()
public java.lang.Long getNonAuthoritativeInformationTimeout()
public void setNonAuthoritativeInformationTimeout(java.lang.Long nonAuthoritativeInformationTimeout)
nonAuthoritativeInformationTimeout
- public java.lang.String getStoreIdentifier()
public DocumentConvention getConventions()
DocumentConvention
should be done
via the IDocumentStore
instance, not on a single session.public int getMaxNumberOfRequestsPerSession()
public void setMaxNumberOfRequestsPerSession(int maxNumberOfRequestsPerSession)
maxNumberOfRequestsPerSession
- public boolean isUseOptimisticConcurrency()
ConcurrencyException
public void setUseOptimisticConcurrency(boolean useOptimisticConcurrency)
ConcurrencyException
public <T> Etag getEtagFor(T instance)
instance
- public <T> RavenJObject getMetadataFor(T instance)
instance
- protected abstract JsonDocument getJsonDocument(java.lang.String documentKey)
documentKey
- public boolean isLoaded(java.lang.String id)
id
- public boolean isDeleted(java.lang.String id)
id
- public java.lang.String getDocumentId(java.lang.Object instance)
instance
- public boolean hasChanges()
public boolean hasChanged(java.lang.Object entity)
entity
- public void incrementRequestCount()
public java.lang.Object trackEntity(java.lang.Class<?> entityType, JsonDocument documentFound)
entityType
- documentFound
- public java.lang.Object trackEntity(java.lang.Class<?> entityType, java.lang.String key, RavenJObject document, RavenJObject metadata, boolean noTracking)
entityType
- key
- document
- metadata
- noTracking
- public java.lang.Object convertToEntity(java.lang.Class<?> entityType, java.lang.String id, RavenJObject documentFound, RavenJObject metadata)
entityType
- id
- documentFound
- metadata
- public boolean isAllowNonAuthoritativeInformation()
public void setAllowNonAuthoritativeInformation(boolean allowNonAuthoritativeInformation)
public <T> void delete(T entity)
public <T> void delete(java.lang.Class<T> clazz, java.lang.Number id)
public <T> void delete(java.lang.Class<T> clazz, java.util.UUID id)
public void delete(java.lang.String id)
public static void ensureNotReadVetoed(RavenJObject metadata)
public void store(java.lang.Object entity)
entity
- public void store(java.lang.Object entity, Etag etag)
entity
- etag
- public void store(java.lang.Object entity, java.lang.String id)
entity
- id
- public void store(java.lang.Object entity, Etag etag, java.lang.String id)
entity
- etag
- id
- protected abstract java.lang.String generateKey(java.lang.Object entity)
protected void rememberEntityForDocumentKeyGeneration(java.lang.Object entity)
protected void storeEntityInUnitOfWork(java.lang.String id, java.lang.Object entity, Etag etag, RavenJObject metadata, boolean forceConcurrencyCheck)
protected void assertNoNonUniqueInstance(java.lang.Object entity, java.lang.String id)
protected ICommandData createPutEntityCommand(java.lang.Object entity, DocumentMetadata documentMetadata)
entity
- documentMetadata
- protected void updateBatchResults(java.util.List<BatchResult> batchResults, SaveChangesData saveChangesData)
batchResults
- saveChangesData
- protected SaveChangesData prepareForSaveChanges()
public java.util.Map<java.lang.String,java.util.List<DocumentsChanges>> whatChanged()
public void markReadOnly(java.lang.Object entity)
entity
- protected boolean entityChanged(java.lang.Object entity, DocumentMetadata documentMetadata)
protected boolean entityChanged(java.lang.Object entity, DocumentMetadata documentMetadata, java.util.Map<java.lang.String,java.util.List<DocumentsChanges>> changes)
entity
- documentMetadata
- public <T> void evict(T entity)
public void clear()
public EntityToJson getEntityToJson()
public GenerateEntityIdOnTheClient getGenerateEntityIdOnTheClient()
public void defer(ICommandData... commands)
public void explicitlyVersion(java.lang.Object entity)
public void close()
close
in interface java.lang.AutoCloseable
protected void logBatch(SaveChangesData data)
public void registerMissing(java.lang.String id)
public void registerMissingIncludes(java.util.Collection<RavenJObject> results, java.util.Collection<java.lang.String> includes)
public int hashCode()
hashCode
in class java.lang.Object
public void trackIncludedDocument(JsonDocument include)
public java.lang.String createDynamicIndexName(java.lang.Class clazz)
public boolean checkIfIdAlreadyIncluded(java.lang.String[] ids, Tuple<java.lang.String,java.lang.Class<?>>[] includes)
public <T> void refreshInternal(T entity, JsonDocument jsonDocument, DocumentMetadata value)
Copyright © 2014. All Rights Reserved.