Class EditorConfigDAOImpl

java.lang.Object
org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<EditorConfigEntity, Long>
org.exoplatform.onlyoffice.jpa.dao.EditorConfigDAOImpl
All Implemented Interfaces:
org.exoplatform.commons.api.persistence.GenericDAO<EditorConfigEntity, Long>, EditorConfigDAO

public class EditorConfigDAOImpl extends org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<EditorConfigEntity, Long> implements EditorConfigDAO
  • Field Summary

    Fields inherited from class org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl

    modelClass
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Closes, at the given time, the active configs built for a conversion that no editor ever opened: not open, no closed time (a closing config has one), and an empty explorer URL, which only a conversion config and its copies have.
     
    getClosedConfigBefore(long expirationTime, int limit)
     
     
     
    int
    lockConfigUnlessClosedWith(long id, String closedError)
    Takes a config row's write lock until the transaction ends, by an update that changes nothing, unless its stored error is the given one: a save that writes the row back after it does not interleave with another write of the row, whatever the database's locking of reads.
    int
    reopenConfig(long id, long openedTime, String closedError)
    Opens a config at the given time, unless its stored error is the given one: a single conditional update, so a close written meanwhile by another transaction is never overwritten.

    Methods inherited from class org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl

    count, create, createAll, delete, deleteAll, deleteAll, find, findAll, getEntityManager, getHibernateDialect, isMSSQLDialect, isOrcaleDialect, update, updateAll

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.exoplatform.commons.api.persistence.GenericDAO

    count, create, createAll, delete, deleteAll, deleteAll, find, findAll, update, updateAll
  • Constructor Details

    • EditorConfigDAOImpl

      public EditorConfigDAOImpl()
  • Method Details

    • getConfigByKey

      public List<EditorConfigEntity> getConfigByKey(String key)
      Specified by:
      getConfigByKey in interface EditorConfigDAO
    • getConfigByDocId

      public List<EditorConfigEntity> getConfigByDocId(String docId)
      Specified by:
      getConfigByDocId in interface EditorConfigDAO
    • getActiveConfigByDocId

      public List<EditorConfigEntity> getActiveConfigByDocId(String docId)
      Specified by:
      getActiveConfigByDocId in interface EditorConfigDAO
    • getClosedConfigBefore

      public List<EditorConfigEntity> getClosedConfigBefore(long expirationTime, int limit)
      Specified by:
      getClosedConfigBefore in interface EditorConfigDAO
    • closeUnopenedConversionConfigs

      public int closeUnopenedConversionConfigs(long closedTime)
      Description copied from interface: EditorConfigDAO
      Closes, at the given time, the active configs built for a conversion that no editor ever opened: not open, no closed time (a closing config has one), and an empty explorer URL, which only a conversion config and its copies have.
      Specified by:
      closeUnopenedConversionConfigs in interface EditorConfigDAO
      Parameters:
      closedTime - the closed time to set
      Returns:
      the number of closed configs
    • reopenConfig

      public int reopenConfig(long id, long openedTime, String closedError)
      Description copied from interface: EditorConfigDAO
      Opens a config at the given time, unless its stored error is the given one: a single conditional update, so a close written meanwhile by another transaction is never overwritten.
      Specified by:
      reopenConfig in interface EditorConfigDAO
      Parameters:
      id - the config's database id
      openedTime - the opened time to set
      closedError - the error that keeps the config closed
      Returns:
      the number of opened configs, 0 or 1
    • lockConfigUnlessClosedWith

      public int lockConfigUnlessClosedWith(long id, String closedError)
      Description copied from interface: EditorConfigDAO
      Takes a config row's write lock until the transaction ends, by an update that changes nothing, unless its stored error is the given one: a save that writes the row back after it does not interleave with another write of the row, whatever the database's locking of reads.
      Specified by:
      lockConfigUnlessClosedWith in interface EditorConfigDAO
      Parameters:
      id - the config's database id
      closedError - the error that keeps the config closed
      Returns:
      the number of locked configs, 0 if none is stored without that error