Interface ModelContext
-
- All Known Implementing Classes:
DefaultModelContext,ModelContextProxy
public interface ModelContextCollects all loaded, created or attached model instances managed by model service.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidafterDirectPersist(ModelWrapper wr)Clear context after save with generic DAOvoidafterDirectPersist(java.util.Collection<ModelWrapper> wrappers)Clear context after save with generic DAOvoidafterPersist(java.util.Collection<ModelWrapper> models)voidattach(java.lang.Object model, java.lang.Object source, ModelConverter conv)Attaches a new model to the context.voidclear()Removes all attached models.default voidclearLoading(PersistenceObject source)voiddetach(java.lang.Object model, java.lang.Object source, ModelConverter conv)Removes a model from context.java.lang.ObjectgetAttached(java.lang.Object source, ModelConverter conv)Returns a attached model for a given source element and converter.java.util.Set<java.lang.Object>getModified()Returns all attached model instances which are currently modified.java.util.Set<java.lang.Object>getNew()Returns all attached model instances which are currently new.booleanisAttached(java.lang.Object model, ModelConverter conv)default booleanisLoading(PersistenceObject source)default voidmarkLoading(PersistenceObject source)
-
-
-
Field Detail
-
loading
static final java.lang.ThreadLocal<java.util.Vector<PK>> loading
-
-
Method Detail
-
afterPersist
void afterPersist(java.util.Collection<ModelWrapper> models)
-
attach
void attach(java.lang.Object model, java.lang.Object source, ModelConverter conv)Attaches a new model to the context.- Parameters:
model- the model to holdsource- the source element - may be null for new modelsconv- the converter used- Throws:
java.lang.IllegalStateException- if there is a existing model mapped to the same source and converter
-
detach
void detach(java.lang.Object model, java.lang.Object source, ModelConverter conv)Removes a model from context.- Parameters:
model- the model to removesource- its source - may be null for new modelsconv- the converter which manages the model
-
getAttached
java.lang.Object getAttached(java.lang.Object source, ModelConverter conv)Returns a attached model for a given source element and converter.- Parameters:
source- the source element - must not be nullconv- the converter
-
isAttached
boolean isAttached(java.lang.Object model, ModelConverter conv)- Returns:
falseotherwise.
-
clear
void clear()
Removes all attached models.
-
getNew
java.util.Set<java.lang.Object> getNew()
Returns all attached model instances which are currently new.
-
getModified
java.util.Set<java.lang.Object> getModified()
Returns all attached model instances which are currently modified.
-
afterDirectPersist
void afterDirectPersist(java.util.Collection<ModelWrapper> wrappers)
Clear context after save with generic DAO
-
afterDirectPersist
void afterDirectPersist(ModelWrapper wr)
Clear context after save with generic DAO
-
isLoading
default boolean isLoading(PersistenceObject source)
-
markLoading
default void markLoading(PersistenceObject source)
-
clearLoading
default void clearLoading(PersistenceObject source)
-
-