Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • sidharth1917
    replied
    Hi Team,

    I was trying this on a sample project "built-in-ds". In the project I have made changes to :
    1. BuildInDS.java- Added a performUndo method and called on keyPress event. File attached
    2. animals.ds.xml - added audite attribute and new operations with SkipAudit as true.
    This code works fine and the ds.updateData call with operationID (with skipAudit as true) does not make any further AUDIT entry.

    But when I implement this same login in my application DS and ListGrid, the skipAudit operations are creating audit entries. Also, I have used
    audit="never"
    with fields, but in the audit entries the audit_changedFields still has the field names.

    Please note that my application is a Spring based GWT web application where I am using SQL data sources.

    Can you please give me some pointer to why I must be facing such an issue where as on the other hand same code works fine in the sample project.
    Attached Files

    Leave a comment:


  • Isomorphic
    replied
    Yes, in order to address this we need more details. Ideally standalone test case or just enough details for us to reproduce this issue. Thank you.

    Leave a comment:


  • sidharth1917
    replied
    Hi,

    Please let me know in case I need to provide more details to let you look into this issue.

    Thanks.

    Leave a comment:


  • Audit record created for Operation even after using skipAudit

    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:

    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>
    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:

    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);
                        }
    Even after setting the operationID correctly and the same can be seen in RPC calls in smartGWTConsole:

    Click image for larger version  Name:	Capture.JPG Views:	0 Size:	18.5 KB ID:	264036
    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
    Last edited by sidharth1917; 11 Nov 2020, 05:43.
Working...
X