Hi,
I am working on SmartGWT version 12.1-p20200926. I am trying to implement a UNDO feature on ListGrid using the audit datasources.
For the same I have my datasource like:
As you can see above I have used skipAudit with operation Bindings. even after using this, the audit entry is created for these operations.
My code for carrying out the above operations:
Even after setting the operationID correctly and the same can be seen in RPC calls in smartGWTConsole:
After this call Audit entry in the audit table is still created. Also, Please note that for the DSFields "created_time" & "modified_time" I have used the audit attribute with value as never. Still in the audit entry it shows the audit_changedFields as modified_time.
I am having my default server.properties and I have only made datasource related to it.
Can you please let me know what am I missing and why is the audit entry being created even after marking the operation binding with skip audit. Please let me know if you need any other inputs from my side for looking into this issue
Thanks
I am working on SmartGWT version 12.1-p20200926. I am trying to implement a UNDO feature on ListGrid using the audit datasources.
For the same I have my datasource like:
Code:
<DataSource ID="XXXSQL" serverType="sql" tableName="XXX" audit="true" xmlns:fmt="WEB-INF/"> <fmt:bundle basename="com.yyy.client.DSMessages"/> <fields> <field name="XXX_id" type="sequence" hidden="true" primaryKey="true"/> <field name="XXX_type_id" type="integer" foreignKey="CDSQL.code_id" joinType="outer" required="true"/> <field name="cmp_id" type="text" length="36" foreignKey="cmpSQL.cmp_id" required="true"/> <field name="name" type="text" length="100" required="true"> <title> <fmt:message key="name"/> </title> </field> <field name="address1" type="text" length="35"> <title> <fmt:message key="address1"/> </title> </field> <field name="address2" type="text" length="35"> <title> <fmt:message key="address2"/> </title> </field> <field name="address3" type="text" length="35"> <title> <fmt:message key="address3"/> </title> </field> <field name="city" type="text" length="35"> <title> <fmt:message key="city"/> </title> </field> <field name="created_by" type="creator" hidden="true" > <title> <fmt:message key="createdBy"/> </title> </field> <field name="created_time" type="creatorTimestamp" hidden="true" audit="never"> <title> <fmt:message key="createdTime"/> </title> </field> <field name="modified_by" type="modifier" hidden="true"> <title> <fmt:message key="modifiedBy"/> </title> </field> <field name="modified_time" type="modifierTimestamp" hidden="true" audit="never"> <title> <fmt:message key="modifiedTime"/> </title> </field> </fields> <operationBindings> <operationBinding operationType="update" operationId="auditUpdate" skipAudit="true"/> <operationBinding operationType="add" operationId="auditAdd" skipAudit="true"/> <operationBinding operationType="remove" operationId="auditRemove" skipAudit="true"/> </operationBindings> </DataSource>
My code for carrying out the above operations:
Code:
if (DSOperationType.UPDATE.getValue().equals(operationType)) { final Record changedRecord = getResultSet().find(primaryKeyName, primaryKeyValInAudit); final Object[] fieldsChangedObj = (Object[]) auditRecord.getAttributeAsObject("audit_changedFields"); for (final Object fieldChangedObj : fieldsChangedObj) { final String fieldName = fieldChangedObj.toString(); changedRecord.setAttribute(fieldName, auditRecord.getAttribute(fieldName)); } auditActionProperties.setOperationId("auditUpdate"); auditActionProperties.setCriteria(new Criteria(primaryKeyName, primaryKeyValInAudit.toString())); updateData(changedRecord, null, auditActionProperties); } else if (DSOperationType.ADD.getValue().equals(operationType)) { final Record changedRecord = getResultSet().find(primaryKeyName, primaryKeyValInAudit); final int rowNum = getRowNum(new ListGridRecord(changedRecord)); auditActionProperties.setOperationId("auditRemove"); auditActionProperties.setCriteria(new Criteria(primaryKeyName, primaryKeyValInAudit.toString())); removeData(getRecord(rowNum), null, auditActionProperties); } else if (DSOperationType.REMOVE.getValue().equals(operationType)) { auditRecord.setAttribute(primaryKeyName, (String) null); auditActionProperties.setOperationId("auditAdd"); addData(auditRecord, null, auditActionProperties); }
After this call Audit entry in the audit table is still created. Also, Please note that for the DSFields "created_time" & "modified_time" I have used the audit attribute with value as never. Still in the audit entry it shows the audit_changedFields as modified_time.
I am having my default server.properties and I have only made datasource related to it.
Can you please let me know what am I missing and why is the audit entry being created even after marking the operation binding with skip audit. Please let me know if you need any other inputs from my side for looking into this issue
Thanks
Comment