Interface EntityEditModel.Insert

Enclosing interface:
EntityEditModel

public static interface EntityEditModel.Insert
Represents a task for inserting entities, split up for use with a background thread.
   Insert insert = editModel.createInsert();

   insert.notifyBeforeInsert();

   // Can safely be called in a background thread
   Collection<Entity> insertedEntities = insert.insert();

   insert.notifyAfterInsert(insertedEntities);
 
insert() may be called on a background thread while EntityEditModel.validate(), notifyBeforeInsert() and notifyAfterInsert(Collection) must be called on the UI thread.
  • Method Summary

    Modifier and Type
    Method
    Description
    Collection<is.codion.framework.domain.entity.Entity>
    May be called in a background thread.
    void
    notifyAfterInsert(Collection<is.codion.framework.domain.entity.Entity> insertedEntities)
    Notifies listeners that an insert has been performed.
    void
    Notifies listeners that an insert is about to be performed.
  • Method Details

    • notifyBeforeInsert

      void notifyBeforeInsert()
      Notifies listeners that an insert is about to be performed. Must be called on the UI thread if this model has a panel based on it.
    • insert

      Collection<is.codion.framework.domain.entity.Entity> insert() throws is.codion.common.db.exception.DatabaseException
      May be called in a background thread.
      Returns:
      the inserted entities
      Throws:
      is.codion.common.db.exception.DatabaseException - in case of a database exception
    • notifyAfterInsert

      void notifyAfterInsert(Collection<is.codion.framework.domain.entity.Entity> insertedEntities)
      Notifies listeners that an insert has been performed. Must be called on the UI thread if this model has a panel based on it.
      Parameters:
      insertedEntities - the entities returned by insert()