Package fr.ifremer.isisfish.logging
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 Summary
Modifier and TypeFieldDescriptionprotected static final String
CSV file name.protected org.nuiton.topia.TopiaContext
Context.protected static final char
CSV separator char.protected File
Output log file.protected RegionStorage
Region storage. -
Constructor Summary
ConstructorDescriptionRegionChangeLogger
(RegionStorage regionStorage, org.nuiton.topia.TopiaContext context) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Add line into file.protected void
addLogLine
(String changeType, Class<? extends org.nuiton.topia.persistence.TopiaEntity> clazz, Object entity) protected void
addLogLine
(String changeType, Class<? extends org.nuiton.topia.persistence.TopiaEntity> clazz, Object entity, String field, String oldValue, String newValue) void
create
(org.nuiton.topia.event.TopiaEntityEvent event) void
delete
(org.nuiton.topia.event.TopiaEntityEvent event) protected String
getEntityDisplayInfo
(Object entity) Most of entity have a 'name' attribute.void
load
(org.nuiton.topia.event.TopiaEntityEvent event) void
update
(org.nuiton.topia.event.TopiaEntityEvent event)
-
Field Details
-
CSV_SEPARATOR
protected static final char CSV_SEPARATORCSV separator char.- See Also:
-
CHANGES_FILE_NAME
CSV file name.- See Also:
-
regionStorage
Region storage. -
context
protected org.nuiton.topia.TopiaContext contextContext. -
logFile
Output log file.
-
-
Constructor Details
-
RegionChangeLogger
-
-
Method Details
-
create
public void create(org.nuiton.topia.event.TopiaEntityEvent event) - Specified by:
create
in interfaceorg.nuiton.topia.event.TopiaEntityListener
-
load
public void load(org.nuiton.topia.event.TopiaEntityEvent event) - Specified by:
load
in interfaceorg.nuiton.topia.event.TopiaEntityListener
-
update
public void update(org.nuiton.topia.event.TopiaEntityEvent event) - Specified by:
update
in interfaceorg.nuiton.topia.event.TopiaEntityListener
-
delete
public void delete(org.nuiton.topia.event.TopiaEntityEvent event) - Specified by:
delete
in interfaceorg.nuiton.topia.event.TopiaEntityListener
-
addLogLine
-
addLogLine
-
addLine
Add line into file. File is opened and closed each time (otherwize, content is not dumped to disk :( )- Parameters:
data
- data to add
-
getEntityDisplayInfo
Most of entity have a 'name' attribute. For those that don't, use toString().- Parameters:
entity
- entity- Returns:
- display info
-