Class RegionChangeLogger

java.lang.Object
fr.ifremer.isisfish.logging.RegionChangeLogger
All Implemented Interfaces:
EventListener, org.nuiton.topia.event.TopiaEntityListener

public class RegionChangeLogger extends Object implements org.nuiton.topia.event.TopiaEntityListener
Listener topia qui ecrit un fichier de log avec toutes les modifications de la base de données dans un fichier changes.csv dans le répertoire de la région.
  • Field Details

    • CSV_SEPARATOR

      protected static final char CSV_SEPARATOR
      CSV separator char.
      See Also:
    • CHANGES_FILE_NAME

      protected static final String CHANGES_FILE_NAME
      CSV file name.
      See Also:
    • regionStorage

      protected RegionStorage regionStorage
      Region storage.
    • context

      protected org.nuiton.topia.TopiaContext context
      Context.
    • logFile

      protected File logFile
      Output log file.
  • Constructor Details

    • RegionChangeLogger

      public RegionChangeLogger(RegionStorage regionStorage, org.nuiton.topia.TopiaContext context)
  • Method Details

    • create

      public void create(org.nuiton.topia.event.TopiaEntityEvent event)
      Specified by:
      create in interface org.nuiton.topia.event.TopiaEntityListener
    • load

      public void load(org.nuiton.topia.event.TopiaEntityEvent event)
      Specified by:
      load in interface org.nuiton.topia.event.TopiaEntityListener
    • update

      public void update(org.nuiton.topia.event.TopiaEntityEvent event)
      Specified by:
      update in interface org.nuiton.topia.event.TopiaEntityListener
    • delete

      public void delete(org.nuiton.topia.event.TopiaEntityEvent event)
      Specified by:
      delete in interface org.nuiton.topia.event.TopiaEntityListener
    • addLogLine

      protected void addLogLine(String changeType, Class<? extends org.nuiton.topia.persistence.TopiaEntity> clazz, Object entity)
    • addLogLine

      protected void addLogLine(String changeType, Class<? extends org.nuiton.topia.persistence.TopiaEntity> clazz, Object entity, String field, String oldValue, String newValue)
    • addLine

      protected void addLine(String... data)
      Add line into file. File is opened and closed each time (otherwize, content is not dumped to disk :( )
      Parameters:
      data - data to add
    • getEntityDisplayInfo

      protected String getEntityDisplayInfo(Object entity)
      Most of entity have a 'name' attribute. For those that don't, use toString().
      Parameters:
      entity - entity
      Returns:
      display info