@Component(value="cuba_EntityLog") public class EntityLog extends java.lang.Object implements EntityLogAPI
Modifier and Type | Field and Description |
---|---|
protected AuditInfoProvider |
auditInfoProvider |
protected EntityLogConfig |
config |
protected DataManager |
dataManager |
protected DynamicAttributes |
dynamicAttributes |
protected DynamicAttributesTools |
dynamicAttributesTools |
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
entitiesAuto |
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
entitiesManual |
protected java.lang.ThreadLocal<java.lang.Boolean> |
entityLogSwitchedOn |
protected boolean |
loaded |
protected java.util.concurrent.locks.ReentrantReadWriteLock |
lock |
protected Metadata |
metadata |
protected MetadataTools |
metadataTools |
protected Persistence |
persistence |
protected ReferenceToEntitySupport |
referenceToEntitySupport |
protected ServerConfig |
serverConfig |
protected TimeSource |
timeSource |
NAME
Constructor and Description |
---|
EntityLog(Configuration configuration) |
Modifier and Type | Method and Description |
---|---|
protected java.util.Set<java.lang.String> |
calculateDirtyFields(Entity entity,
EntityAttributeChanges changes) |
protected void |
computeChanges(EntityLogItem itemToSave,
java.util.List<EntityLogItem> sameEntityList) |
protected java.util.Set<EntityLogAttr> |
createDynamicLogAttribute(CategoryAttributeValue entity,
EntityAttributeChanges changes,
boolean registerDeleteOp) |
protected java.util.Set<EntityLogAttr> |
createLogAttributes(Entity entity,
java.util.Set<java.lang.String> attributes,
EntityAttributeChanges changes) |
protected boolean |
doNotRegister(Entity entity) |
protected void |
enqueueItem(EntityLogItem item) |
protected java.util.Set<java.lang.String> |
filterRemovedAttributes(com.haulmont.chile.core.model.MetaClass metaClass,
java.util.Set<java.lang.String> attributes) |
protected Entity |
findEntity(EntityManager em,
CategoryAttributeValue categoryAttributeValue) |
protected User |
findUser(EntityManager em) |
void |
flush()
Flush records accumulated by invocations of
EntityLogAPI.registerCreate(Entity) and other registration methods
to the database. |
protected java.util.Set<java.lang.String> |
getAllAttributes(Entity entity) |
protected EntityLogAttr |
getAttrToSave(EntityLogAttr entityLogAttr,
EntityLogItem itemToSave) |
protected java.lang.String |
getCategoryAttributeValueName(CategoryAttributeValue attributeValue) |
protected java.lang.String |
getChanges(java.util.Properties properties) |
protected java.lang.String |
getEntityName(Entity entity) |
protected java.lang.String |
getIdAttributePath(com.haulmont.chile.core.model.MetaPropertyPath propertyPath,
java.lang.String storeName) |
protected java.util.Set<java.lang.String> |
getLoggedAttributes(java.lang.String entity,
boolean auto) |
protected java.lang.Object |
getOldCategoryAttributeValue(CategoryAttributeValue attributeValue,
EntityAttributeChanges changes) |
protected java.lang.Object |
getValueId(java.lang.Object value) |
protected void |
internalRegisterCreate(Entity entity,
java.lang.String entityName,
java.util.Set<java.lang.String> attributes) |
protected void |
internalRegisterDelete(Entity entity,
java.lang.String entityName,
java.util.Set<java.lang.String> attributes) |
protected void |
internalRegisterModify(Entity entity,
EntityAttributeChanges changes,
com.haulmont.chile.core.model.MetaClass metaClass,
java.lang.String storeName,
java.util.Set<java.lang.String> attributes) |
protected void |
internalRegisterModifyAttributeValue(CategoryAttributeValue entity,
EntityAttributeChanges changes,
java.util.Set<java.lang.String> attributes) |
void |
invalidateCache()
Invalidates configuration cache.
|
boolean |
isEnabled() |
boolean |
isLoggingForCurrentThread() |
protected void |
loadEntities() |
protected void |
logError(Entity entity,
java.lang.Exception e) |
void |
processLoggingForCurrentThread(boolean enabled)
Disables/enables entity logging for current thread.
|
void |
registerCreate(Entity entity)
Logs creation of an entity which is configured for manual logging (LoggedEntity.auto == false).
|
void |
registerCreate(Entity entity,
boolean auto)
Logs creation of an entity which is configured for auto or manual logging
(depending on the
auto parameter). |
void |
registerDelete(Entity entity)
Logs deletion of an entity which is configured for manual logging (LoggedEntity.auto == false).
|
void |
registerDelete(Entity entity,
boolean auto)
Logs deletion of an entity which is configured for auto or manual logging
(depending on the
auto parameter). |
void |
registerModify(Entity entity)
Logs modification of an entity which is configured for manual logging (LoggedEntity.auto == false).
|
void |
registerModify(Entity entity,
boolean auto)
Logs modification of an entity which is configured for auto or manual logging
(depending on the
auto parameter). |
void |
registerModify(Entity entity,
boolean auto,
EntityAttributeChanges changes)
Logs modification of an entity which is configured for auto or manual logging
(depending on the
auto parameter). |
protected void |
saveItem(EntityLogItem item) |
protected void |
setAttributeNewValue(EntityLogAttr entityLogAttr,
EntityLogItem itemToSave) |
protected void |
setAttributeOldValue(EntityLogAttr entityLogAttr,
EntityLogItem itemToSave) |
void |
setEnabled(boolean enabled) |
protected java.lang.String |
stringify(java.lang.Object value,
com.haulmont.chile.core.model.MetaProperty metaProperty) |
@Inject protected TimeSource timeSource
@Inject protected Persistence persistence
@Inject protected Metadata metadata
@Inject protected MetadataTools metadataTools
@Inject protected AuditInfoProvider auditInfoProvider
@Inject protected ReferenceToEntitySupport referenceToEntitySupport
@Inject protected DynamicAttributes dynamicAttributes
@Inject protected DynamicAttributesTools dynamicAttributesTools
@Inject protected DataManager dataManager
@Inject protected ServerConfig serverConfig
protected volatile boolean loaded
protected EntityLogConfig config
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> entitiesManual
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> entitiesAuto
protected java.util.concurrent.locks.ReentrantReadWriteLock lock
protected java.lang.ThreadLocal<java.lang.Boolean> entityLogSwitchedOn
@Inject public EntityLog(Configuration configuration)
public void processLoggingForCurrentThread(boolean enabled)
EntityLogAPI
processLoggingForCurrentThread
in interface EntityLogAPI
enabled
- entity logging disabled if false, enabled otherwise.public boolean isLoggingForCurrentThread()
isLoggingForCurrentThread
in interface EntityLogAPI
EntityLogAPI.processLoggingForCurrentThread(boolean)
public void flush()
EntityLogAPI
EntityLogAPI.registerCreate(Entity)
and other registration methods
to the database.flush
in interface EntityLogAPI
protected void computeChanges(EntityLogItem itemToSave, java.util.List<EntityLogItem> sameEntityList)
protected void setAttributeOldValue(EntityLogAttr entityLogAttr, EntityLogItem itemToSave)
protected void setAttributeNewValue(EntityLogAttr entityLogAttr, EntityLogItem itemToSave)
protected EntityLogAttr getAttrToSave(EntityLogAttr entityLogAttr, EntityLogItem itemToSave)
protected void saveItem(EntityLogItem item)
public boolean isEnabled()
isEnabled
in interface EntityLogAPI
public void setEnabled(boolean enabled)
setEnabled
in interface EntityLogAPI
public void invalidateCache()
EntityLogAPI
invalidateCache
in interface EntityLogAPI
protected java.util.Set<java.lang.String> getLoggedAttributes(java.lang.String entity, boolean auto)
protected void loadEntities()
protected java.lang.String getEntityName(Entity entity)
protected boolean doNotRegister(Entity entity)
public void registerCreate(Entity entity)
EntityLogAPI
registerCreate
in interface EntityLogAPI
public void registerCreate(Entity entity, boolean auto)
EntityLogAPI
auto
parameter).registerCreate
in interface EntityLogAPI
protected java.util.Set<java.lang.String> filterRemovedAttributes(com.haulmont.chile.core.model.MetaClass metaClass, java.util.Set<java.lang.String> attributes)
protected void internalRegisterCreate(Entity entity, java.lang.String entityName, java.util.Set<java.lang.String> attributes) throws java.io.IOException
java.io.IOException
protected void internalRegisterModifyAttributeValue(CategoryAttributeValue entity, @Nullable EntityAttributeChanges changes, java.util.Set<java.lang.String> attributes)
protected Entity findEntity(EntityManager em, CategoryAttributeValue categoryAttributeValue)
protected User findUser(EntityManager em)
protected void enqueueItem(EntityLogItem item)
public void registerModify(Entity entity)
EntityLogAPI
registerModify
in interface EntityLogAPI
public void registerModify(Entity entity, boolean auto)
EntityLogAPI
auto
parameter).registerModify
in interface EntityLogAPI
public void registerModify(Entity entity, boolean auto, @Nullable EntityAttributeChanges changes)
EntityLogAPI
auto
parameter).registerModify
in interface EntityLogAPI
changes
- attribute changes provided by callerprotected void internalRegisterModify(Entity entity, @Nullable EntityAttributeChanges changes, com.haulmont.chile.core.model.MetaClass metaClass, java.lang.String storeName, java.util.Set<java.lang.String> attributes)
protected java.util.Set<EntityLogAttr> createLogAttributes(Entity entity, java.util.Set<java.lang.String> attributes, @Nullable EntityAttributeChanges changes)
protected java.util.Set<EntityLogAttr> createDynamicLogAttribute(CategoryAttributeValue entity, @Nullable EntityAttributeChanges changes, boolean registerDeleteOp)
protected java.lang.String getChanges(java.util.Properties properties)
public void registerDelete(Entity entity)
EntityLogAPI
registerDelete
in interface EntityLogAPI
public void registerDelete(Entity entity, boolean auto)
EntityLogAPI
auto
parameter).registerDelete
in interface EntityLogAPI
protected void internalRegisterDelete(Entity entity, java.lang.String entityName, java.util.Set<java.lang.String> attributes) throws java.io.IOException
java.io.IOException
protected java.util.Set<java.lang.String> getAllAttributes(Entity entity)
protected java.lang.Object getValueId(java.lang.Object value)
protected java.lang.String stringify(java.lang.Object value, com.haulmont.chile.core.model.MetaProperty metaProperty)
protected java.lang.Object getOldCategoryAttributeValue(CategoryAttributeValue attributeValue, EntityAttributeChanges changes)
protected java.util.Set<java.lang.String> calculateDirtyFields(Entity entity, EntityAttributeChanges changes)
protected java.lang.String getIdAttributePath(com.haulmont.chile.core.model.MetaPropertyPath propertyPath, java.lang.String storeName)
protected java.lang.String getCategoryAttributeValueName(CategoryAttributeValue attributeValue)
protected void logError(Entity entity, java.lang.Exception e)