Interface ModelContext

  • All Known Implementing Classes:
    DefaultModelContext, ModelContextProxy

    public interface ModelContext
    Collects all loaded, created or attached model instances managed by model service.
    • 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 hold
        source - the source element - may be null for new models
        conv - 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 remove
        source - its source - may be null for new models
        conv - 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 null
        conv - the converter
      • isAttached

        boolean isAttached​(java.lang.Object model,
                           ModelConverter conv)
        Returns true if the given ItemModel and ModelConverter is attached to this/current. ModelContext.
        Returns:
        false otherwise.
      • 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