Package overit.geocall.basic.bl
Class DataLogReactor<T extends BusinessEvent<?>>
java.lang.Object
overit.geocall.bl.BusinessTask<T>
overit.geocall.basic.bl.DataLogReactor<T>
- Type Parameters:
T- The event used to retrieve the information.
- All Implemented Interfaces:
Serializable,Tool
- Direct Known Subclasses:
BTAssumeRoleChangeLog,BTCompanyCreateLog,BTCompanyUpdateLog,BTConfigChangeLog,BTDaemonDataLog,BTDeleteSecretLog,BTDeleteSecretValueLog,BTEditSecretLog,BTGenerateSecretLog,BTGenerateSecretValueLog,BTGISServiceDataLog,BTSystemSettingDataLog,BTUserTypeAuthPolicyUpdateLog,BTUserTypeCreateLog,BTUserTypeGrantsLog,BTUserTypeUpdateLog
Abstract class that manages the insertion of data logs.
This class simplify the insertion of data logs inside the db. It's only needed to implement the abstract methods in
order to operate properly.
Here is a code snippet that illustrate a typical use of this task:
{@literal @}Geocall.Event(UserTypeUpdateEvent.class)
public class BTUserTypeUpdateLog extends DataLogReactor<UserTypeUpdateEvent> {
{@literal @}Override
protected String getType() {
return "User type";
}
{@literal @}Override
protected String getData(UserTypeUpdateEvent event) {
return event.getUserType().extract(true).toString();
}
{@literal @}Override
protected Long getObjectId(UserTypeUpdateEvent event) {
return event.getUserType().getId();
}
{@literal @}Override
protected Long getFactory(UserTypeUpdateEvent event) {
return event.getUserType().getFactory()!=null ? event.getUserType().getFactory() : Identity.current().getFactory();
}
}
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidImplements this method to write the specific task logic to handle the input parameter.protected abstract StringGets the data to log.protected abstract LonggetFactory(T event) Gets the id of the factory.protected abstract LonggetObjectId(T event) Gets the unique id associated to the object.protected abstract StringGets the type's name of the data log.Methods inherited from class overit.geocall.bl.BusinessTask
start, start, startAlone, startInBackground
-
Constructor Details
-
DataLogReactor
public DataLogReactor()
-
-
Method Details
-
body
Description copied from class:BusinessTaskImplements this method to write the specific task logic to handle the input parameter.- Specified by:
bodyin classBusinessTask<T extends BusinessEvent<?>>- Parameters:
event- the object upon which the task will works onpk- the poolkit containing the reference to the database connection that can be used- Throws:
DAException- in case of database errorDAValidateException- in case of database validation error
-
getType
Gets the type's name of the data log.- Parameters:
event- Event used to retrieve the information about the object to log.- Returns:
- The type's name of the data log.
-
getData
Gets the data to log.- Parameters:
event- Event used to retrieve the information about the object to log.- Returns:
- String representing all the data to log inside the db.
-
getObjectId
Gets the unique id associated to the object.- Parameters:
event- Event used to retrieve the information about the object to log.- Returns:
- The unique id associated to the object.
-
getFactory
Gets the id of the factory. Possibly the one associated with the object to log.- Parameters:
event- Event used to retrieve the information about the object to log.- Returns:
- The id associated to the factory.
-