Package com._1c.g5.v8.derived.context
Interface IContextCollectingSession
-
public interface IContextCollectingSession
Context collecting session is used as a convenience wrapper around the context management facility during operations of context collection. The session tracks down used contexts and performs transparent blocking/unblocking of target contexts.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addRemovedObjectId(long bmObjectId)
Adds removed object id to the session.void
commit()
Commits the session, unlocking context objects being locked during the context collecting session.List<IObjectDerivedDataContext>
getAttachedAsyncContexts()
Gets asynchronous DD contexts attached to this session (thus targets for change tracking)IObjectDerivedDataContext
getObjectContext(IBmObject bmObject, String segmentId)
Gets the object context of the provided object.List<IObjectDerivedDataContext>
getRemovedContexts()
Gets contexts for objects which were removed and registered in this session.BmLongHashSet
getRemovedObjectIds()
Gets the set of object identifiers being removed during this session.Object
getServiceId()
Gets the identifier of the service that initiated the context collecting session.<T extends IObjectDerivedDataContext>
TgetTypedObjectContext(long bmObjectId, org.eclipse.emf.ecore.EClass objectEClass, String segmentId, Class<T> contextType)
Convenience method that checks the type of the internal context and casts it to the given type.<T extends IObjectDerivedDataContext>
TgetTypedObjectContext(IBmObject bmObject, String segmentId, Class<T> contextType)
Convenience method that checks the type of the internal context and casts it to the given type.boolean
isEmpty()
Checks if the session has no collected contexts.IObjectDerivedDataContext
registerObjectRemoval(long bmObjectId, org.eclipse.emf.ecore.EClass objectEClass, String segmentId)
Registers object removal in the session.
-
-
-
Method Detail
-
addRemovedObjectId
void addRemovedObjectId(long bmObjectId)
Adds removed object id to the session. The set of removed object ids is used later to clear the DD roadmap.- Parameters:
bmObjectId
- The identifier of the removed object.
-
commit
void commit()
Commits the session, unlocking context objects being locked during the context collecting session.
-
getAttachedAsyncContexts
List<IObjectDerivedDataContext> getAttachedAsyncContexts()
Gets asynchronous DD contexts attached to this session (thus targets for change tracking)- Returns:
- The list of contexts attached to this session.
-
getObjectContext
IObjectDerivedDataContext getObjectContext(IBmObject bmObject, String segmentId)
Gets the object context of the provided object. Effectively locks the provided context from changes via other context collecting sessions.- Parameters:
bmObject
- The object to get the context for.segmentId
- The DD segment identifier.- Returns:
- The corresponding context for the object.
-
getRemovedContexts
List<IObjectDerivedDataContext> getRemovedContexts()
Gets contexts for objects which were removed and registered in this session.- Returns:
- The list of removed object contexts.
-
getRemovedObjectIds
BmLongHashSet getRemovedObjectIds()
Gets the set of object identifiers being removed during this session.- Returns:
- The set of ids.
-
getServiceId
Object getServiceId()
Gets the identifier of the service that initiated the context collecting session. This identifier is used to implement complex scearios, like selective computation of DD based on events raised as a result of another DD modification.- Returns:
- The identifier of the service to check the equality against. Can be
null
,
-
getTypedObjectContext
<T extends IObjectDerivedDataContext> T getTypedObjectContext(IBmObject bmObject, String segmentId, Class<T> contextType)
Convenience method that checks the type of the internal context and casts it to the given type. ThrowsIllegalArgumentException
in case of type mismatch.- Parameters:
bmObject
- The object to get the context for.segmentId
- The DD segment identifier.contextType
- The target type of the context.- Returns:
- The corresponding context for the object.
-
getTypedObjectContext
<T extends IObjectDerivedDataContext> T getTypedObjectContext(long bmObjectId, org.eclipse.emf.ecore.EClass objectEClass, String segmentId, Class<T> contextType)
Convenience method that checks the type of the internal context and casts it to the given type. ThrowsIllegalArgumentException
in case of type mismatch.- Parameters:
bmObjectId
- The identifier of the object to get the context for.objectEClass
- TheEClass
of the object to get the context for. Cannot benull
segmentId
- The DD segment identifier.contextType
- The target type of the context.- Returns:
- The corresponding context for the object.
-
isEmpty
boolean isEmpty()
Checks if the session has no collected contexts.- Returns:
- True if the session has no collected contexts; false otherwise.
-
registerObjectRemoval
IObjectDerivedDataContext registerObjectRemoval(long bmObjectId, org.eclipse.emf.ecore.EClass objectEClass, String segmentId)
Registers object removal in the session.- Parameters:
bmObjectId
- The identifier of the object to get the context for.objectEClass
- TheEClass
of the object to get the context for. Cannot benull
segmentId
- The DD segment identifier.- Returns:
- The context for the removed object.
-
-