item.setAttributes(new LinkedHashSet<>(attributes)); return; item.setAttributes(new LinkedHashSet<>(attributes));
protected void internalRegisterModifyAttributeValue(CategoryAttributeValue entity, @Nullable EntityAttributeChanges changes, Set<String> attributes) { String propertyName = DynamicAttributesUtils.encodeAttributeCode(entity.getCode()); if (!attributes.contains(propertyName)) { return; } Date ts = timeSource.currentTimestamp(); EntityManager em = persistence.getEntityManager(); Set<String> dirty = changes == null ? persistence.getTools().getDirtyFields(entity) : changes.getOwnAttributes(); boolean registerDeleteOp = dirty.contains("deleteTs") && entity.isDeleted(); boolean hasChanges = dirty.stream().anyMatch(s -> s.endsWith("Value")); if (hasChanges) { EntityLogItem item = metadata.create(EntityLogItem.class); item.setEventTs(ts); item.setUser(findUser(em)); item.setType(EntityLogItem.Type.MODIFY); item.setEntity(getEntityName(entity)); item.setObjectEntityId(entity.getObjectEntityId()); item.setAttributes(createDynamicLogAttribute(entity, changes, registerDeleteOp)); enqueueItem(item); } }
item.setEntity(metadata.getExtendedEntities().getOriginalOrThisMetaClass(metaClass).getName()); item.setObjectEntityId(referenceToEntitySupport.getReferenceId(entity)); item.setAttributes(entityLogAttrs);
protected void internalRegisterDelete(Entity entity, String entityName, Set<String> attributes) throws IOException { Date ts = timeSource.currentTimestamp(); EntityManager em = persistence.getEntityManager(); EntityLogItem item = metadata.create(EntityLogItem.class); item.setEventTs(ts); item.setUser(findUser(em)); item.setType(EntityLogItem.Type.DELETE); item.setEntity(entityName); item.setObjectEntityId(referenceToEntitySupport.getReferenceId(entity)); item.setAttributes(createLogAttributes(entity, attributes, null)); enqueueItem(item); }
protected void internalRegisterCreate(Entity entity, String entityName, Set<String> attributes) throws IOException { Date ts = timeSource.currentTimestamp(); EntityManager em = persistence.getEntityManager(); EntityLogItem item = metadata.create(EntityLogItem.class); item.setEventTs(ts); item.setUser(findUser(em)); item.setType(EntityLogItem.Type.CREATE); item.setEntity(entityName); if (entity instanceof BaseDbGeneratedIdEntity) { item.setDbGeneratedIdEntity((BaseDbGeneratedIdEntity) entity); } else { item.setObjectEntityId(referenceToEntitySupport.getReferenceId(entity)); } item.setAttributes(createLogAttributes(entity, attributes, null)); enqueueItem(item); }