Package org.cyclos.impl.system
Interface EntityLogHandler<E extends BaseEntity,DTO extends EntityDTO>
-
- All Known Implementing Classes:
AccountFeeEntityLogHandlerImpl,AccountTypeEntityLogHandlerImpl,AdCustomFieldEntityLogHandlerImpl,AdCustomFieldPossibleValueEntityLogHandlerImpl,AdEntityLogHandlerImpl,AgreementEntityLogHandlerImpl,AuthorizationLevelEntityLogHandlerImpl,BaseCustomFieldEntityLogHandlerImpl,BaseCustomFieldPossibleValueEntityLogHandlerImpl,BaseEntityLogHandlerImpl,ChannelConfigurationEntityLogHandlerImpl,ConfigurationEntityLogHandlerImpl,ContactCustomFieldEntityLogHandlerImpl,ContactCustomFieldPossibleValueEntityLogHandlerImpl,ContactInfoFieldEntityLogHandlerImpl,ContactInfoFieldPossibleValueEntityLogHandlerImpl,CurrencyEntityLogHandlerImpl,CustomBackgroundTaskEntityLogHandlerImpl,CustomOperationEntityLogHandlerImpl,CustomOperationFieldEntityLogHandlerImpl,CustomOperationFieldPossibleValueEntityLogHandlerImpl,CustomScheduledTaskEntityLogHandlerImpl,CustomScriptEntityLogHandlerImpl,CustomWebServiceEntityLogHandlerImpl,CustomWizardEntityLogHandlerImpl,CustomWizardFieldEntityLogHandlerImpl,CustomWizardFieldPossibleValueEntityLogHandlerImpl,CustomWizardStepEntityLogHandlerImpl,DocumentCustomFieldEntityLogHandlerImpl,DocumentCustomFieldPossibleValueEntityLogHandlerImpl,ExportFormatEntityLogHandlerImpl,IdentityProviderEntityLogHandlerImpl,LanguageEntityLogHandlerImpl,OidcClientEntityLogHandlerImpl,OperatorEntityLogHandlerImpl,PasswordTypeEntityLogHandlerImpl,PhoneEntityLogHandlerImpl,PrincipalTypeEntityLogHandlerImpl,PrivacyControlEntityLogHandlerImpl,ProductEntityLogHandlerImpl,RecordCustomFieldEntityLogHandlerImpl,RecordCustomFieldPossibleValueEntityLogHandlerImpl,RecordEntityLogHandlerImpl,RecordTypeEntityLogHandlerImpl,ServiceInterceptorEntityLogHandlerImpl,SmsOperationConfigurationEntityLogHandlerImpl,TokenEntityLogHandlerImpl,TransactionCustomFieldEntityLogHandlerImpl,TransactionCustomFieldPossibleValueEntityLogHandlerImpl,TransferFeeEntityLogHandlerImpl,TransferFilterEntityLogHandlerImpl,TransferTypeEntityLogHandlerImpl,UserAddressEntityLogHandlerImpl,UserCustomFieldEntityLogHandlerImpl,UserCustomFieldPossibleValueEntityLogHandlerImpl,UserEntityLogHandlerImpl,VoucherConfigurationEntityLogHandlerImpl,VoucherCustomFieldEntityLogHandlerImpl,VoucherCustomFieldPossibleValueEntityLogHandlerImpl,VoucherTypeEntityLogHandlerImpl
public interface EntityLogHandler<E extends BaseEntity,DTO extends EntityDTO>To enable the log for an entity an implementation of this interface must be created.- See Also:
BaseEntityLogHandlerImpl,EntityLogRegistry
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidapplyLogFilters(DBQuery<?> query, EntityPropertyLogQuery params)Apply filters to the given query to ensure only the entity log the logged user can view are returnedbooleanareEquals(E oldEntity, E newEntity, PropertyAccess access, Object oldValue, Object newValue)Returns true if the old and new values extracted from its corresponding entities must be considered equals.booleancanViewEntityLog(long entityId)Returns whether the logged user can view the log of the given entity.booleancanViewPropertiesLog(EntityLog entityLog)Returns true if the logged user can view the properties log of the givenEntityLog.Class<E>getEntityClass()The entity class related to this handlerStringgetEntityLogName(E oldEntity, E newEntity, EntityLogEvent event)Return the name of the entity log being generated.EntityLogTypegetType()The log type this handler manages.Pair<Object,Object>getValues(E oldEntity, E newEntity, PropertyLogDescriptor<DTO> propertyDescriptor)Allows custom logic for a specific property to be logged bypassing the default log generation for it.booleanisLogEnabled(E entity)Returns true if the log is enabled for this specific entity instance.booleanisPrivateEntity(E entity)Return true if the given entity was marked as privateList<EntityPropertyLog>onBeforeLog(E oldEntity, E newEntity, List<EntityPropertyLog> propertyLogs, EntityLogEvent event)Allows perform custom logic before logging (i.e saving) the given property logs.EntityLogDescriptor<? extends DTO>resolveLogDescriptor(E entity)Return the descriptor with the mappings for each DTO property.
-
-
-
Method Detail
-
applyLogFilters
void applyLogFilters(DBQuery<?> query, EntityPropertyLogQuery params)
Apply filters to the given query to ensure only the entity log the logged user can view are returned
-
areEquals
boolean areEquals(E oldEntity, E newEntity, PropertyAccess access, Object oldValue, Object newValue)
Returns true if the old and new values extracted from its corresponding entities must be considered equals.
-
canViewEntityLog
boolean canViewEntityLog(long entityId)
Returns whether the logged user can view the log of the given entity.
-
canViewPropertiesLog
boolean canViewPropertiesLog(EntityLog entityLog)
Returns true if the logged user can view the properties log of the givenEntityLog. If the given entityLog's entity was removed, it checks if there is an owner entity and if it is visible.
-
getEntityLogName
String getEntityLogName(E oldEntity, E newEntity, EntityLogEvent event)
Return the name of the entity log being generated.
-
getType
EntityLogType getType()
The log type this handler manages.
-
getValues
Pair<Object,Object> getValues(E oldEntity, E newEntity, PropertyLogDescriptor<DTO> propertyDescriptor)
Allows custom logic for a specific property to be logged bypassing the default log generation for it.- Returns:
- null for the default generation (i.e no custom logic implemented) or a pair of the form
to be saved as-is only if areEquals(BaseEntity, BaseEntity, PropertyAccess, Object, Object)return false.
-
isLogEnabled
boolean isLogEnabled(E entity)
Returns true if the log is enabled for this specific entity instance.
-
isPrivateEntity
boolean isPrivateEntity(E entity)
Return true if the given entity was marked as private
-
onBeforeLog
List<EntityPropertyLog> onBeforeLog(E oldEntity, E newEntity, List<EntityPropertyLog> propertyLogs, EntityLogEvent event)
Allows perform custom logic before logging (i.e saving) the given property logs. The returned list will be final logs to be saved (subclasses can add / remove logs). In case ofEntityLogEvent.CREATEevent the result list will contain only one element, this is for that case we only log one line just to indicate when and who created the entity.
-
resolveLogDescriptor
EntityLogDescriptor<? extends DTO> resolveLogDescriptor(E entity)
Return the descriptor with the mappings for each DTO property.
-
-