Announcement

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

    12.0p Severe problem with .ds.xml RequestModifier and Velocity

    Hi Isomorphic,

    in order to solve a more advanced use case (using v12.0p_2019-02-24), I was changing my FETCH operationBinding .ds.xml criteria from this, which is working fine:
    Code:
            <operationBinding operationType="fetch" operationId="..." requiresRole="..." outputs="...">
                <criteria fieldName="RESELLER_ID" value="$session.authenticatedUserResellerID" />
                <criteria fieldName="USER_ID" value="$session.authenticatedUserID" />
            </operationBinding>
    The session values here are set before in the application via servletRequest.getSession().setAttribute().

    I now wanted to change this syntax (taken from here) to the more advanced one also listed in the link. This fails for me in many ways.
    Please see the sample and the two operationBindings there. They should do the same, but trigger very different codepath IMHO. Once MySQLDataSource.executeFetch() is called (good), once it is not (bad).
    If it is called, no Velocity replace takes place (bad). It it is not called, an Exception is thrown, perhaps because of some noVariable -> null subsequent fault (bad).

    Please see the .ds.xml comments and the presence or absence of the MySQLDataSource log messages depending on the button clicked.

    I'd expect to run a query in both cases and also the SQL statements to be the same.

    BuiltInDS.java:
    Code:
    package com.smartgwt.sample.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.Version;
    import com.smartgwt.client.core.KeyIdentifier;
    import com.smartgwt.client.data.AdvancedCriteria;
    import com.smartgwt.client.data.Criterion;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.data.SortSpecifier;
    import com.smartgwt.client.types.OperatorId;
    import com.smartgwt.client.types.SortDirection;
    import com.smartgwt.client.util.Page;
    import com.smartgwt.client.util.PageKeyHandler;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.Window;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class BuiltInDS implements EntryPoint {
        private VLayout mainLayout;
    
        public void onModuleLoad() {
            KeyIdentifier debugKey = new KeyIdentifier();
            debugKey.setCtrlKey(true);
            debugKey.setKeyName("D");
    
            Page.registerKey(debugKey, new PageKeyHandler() {
                public void execute(String keyName) {
                    SC.showConsole();
                }
            });
    
            mainLayout = new VLayout(20);
            mainLayout.setWidth100();
            mainLayout.setHeight100();
    
            {
                IButton recreateBtn = new IButton("Recreate fetchBadVelocityNoException");
                recreateBtn.setWidth(250);
                recreateBtn.addClickHandler(new ClickHandler() {
                    @Override
                    public void onClick(ClickEvent event) {
                        recreate("fetchBadVelocityNoException");
                    }
                });
                mainLayout.addMember(recreateBtn);
            }
            {
                IButton recreateBtn = new IButton("Recreate fetchBadNoVelocityException");
                recreateBtn.setWidth(250);
                recreateBtn.addClickHandler(new ClickHandler() {
                    @Override
                    public void onClick(ClickEvent event) {
                        recreate("fetchBadNoVelocityException");
                    }
                });
                mainLayout.addMember(recreateBtn);
            }
            mainLayout.draw();
        }
    
        private void recreate(String fetchOperation) {
            Window w = new Window();
            w.setWidth("95%");
            w.setHeight("95%");
            w.setMembersMargin(0);
            w.setModalMaskOpacity(70);
            w.setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")");
            w.setTitle("Problem with Velocity and .ds.xml RequestModifier" + w.getTitle());
            w.setShowMinimizeButton(false);
            w.setIsModal(true);
            w.setShowModalMask(true);
            w.centerInPage();
    
            final ListGrid employeesGrid = new ListGrid();
            employeesGrid.setHeight100();
            employeesGrid.setAutoFetchData(false);
            employeesGrid.setDataSource(DataSource.get("employees"));
            employeesGrid.setFetchOperation(fetchOperation);
    
            ListGridField employeeId = new ListGridField("EmployeeId");
            ListGridField name = new ListGridField("Name");
            ListGridField gender = new ListGridField("Gender");
            ListGridField job = new ListGridField("Job");
    
            employeesGrid.setFields(employeeId, name, gender, job);
            employeesGrid.setSort(new SortSpecifier[] { new SortSpecifier(name.getName(), SortDirection.ASCENDING) });
            employeesGrid.fetchData(new AdvancedCriteria(new Criterion(name.getName(), OperatorId.LESS_OR_EQUAL, "L")));
            w.addItem(employeesGrid);
            w.show();
        }
    }
    MySQLDataSource.java:
    Code:
    package com.smartgwt.sample.server.listener;
    
    import com.isomorphic.datasource.DSRequest;
    import com.isomorphic.datasource.DSResponse;
    import com.isomorphic.log.Logger;
    import com.isomorphic.sql.SQLDataSource;
    
    public class MySQLDataSource extends SQLDataSource {
        private static final long serialVersionUID = -2103887355803373948L;
        Logger log = new Logger(SQLDataSource.class.getName());
    
        @Override
        public DSResponse executeFetch(DSRequest request) throws Exception {
            request.addToTemplateContext("EmployeeType", "full time");
            log.info("Added velocity variable EmployeeType");
            log.info("HTTP parameter isc_v is " + request.getHttpServletRequest().getParameter("isc_v"));
            DSResponse fetchResponse = super.executeFetch(request);
            return fetchResponse;
        }
    }
    employees.ds.xml (see comments):
    Code:
    <DataSource xmlns="lmscompany/ds" serverConstructor="com.smartgwt.sample.server.listener.MySQLDataSource"
        ID="employees"
        serverType="sql"
        tableName="employeeTable"
        recordName="employee"
        testFileName="/examples/shared/ds/test_data/employees.data.xml"
        titleField="Name"
    >
        <fields>
            <field name="userOrder"       title="userOrder"       type="integer"  canEdit="false"    hidden="true"/>
            <field name="Name"            title="Name"            type="text"     length="128"/>
            <field name="EmployeeId"      title="Employee ID"     type="integer"  primaryKey="true"  required="true"/>
            <field name="ReportsTo"       title="Manager"         type="integer"  required="true" 
                   foreignKey="employees.EmployeeId"  rootValue="1" detail="true"/>
            <field name="Job"             title="Title"           type="text"     length="128"/> 
            <field name="Email"           title="Email"           type="text"     length="128"/>
            <field name="EmployeeType"    title="Employee Type"   type="text"     length="40"/>
            <field name="EmployeeStatus"  title="Status"          type="text"     length="40"/>
            <field name="Salary"          title="Salary"          type="float"/>
            <field name="OrgUnit"         title="Org Unit"        type="text"     length="128"/>
            <field name="Gender"          title="Gender"          type="text"     length="7">
                <valueMap>
                    <value>male</value>
                    <value>female</value>
                </valueMap>
            </field>
            <field name="MaritalStatus"   title="Marital Status"  type="text"     length="10">
                <valueMap>
                    <value>married</value>
                    <value>single</value>
                </valueMap>
            </field>
        </fields>
        <operationBindings>
        <operationBinding operationType="fetch" operationId="fetchBadNoVelocityException">
                <criteria fieldName="OrgUnit" value="Management" /> <!-- Good! -->
                <criteria fieldName="EmployeeStatus" value="$dsRequest.dataSourceName" /> <!-- Good! -->
                <criteria fieldName="EmployeeStatus" value="$httpParameters.isc_v" /> <!-- Good -->
                <criteria fieldName="EmployeeType" value="$EmployeeType" /> <!-- Null / Exception -->
        </operationBinding>
        <operationBinding operationType="fetch" operationId="fetchBadVelocityNoException">
                <criteria _constructor="AdvancedCriteria" operator="and">
                    <criteria>
                  <Criterion fieldName="OrgUnit" operator="equals" value="Management" /> <!-- Good! -->
                <Criterion fieldName="EmployeeStatus" operator="equals" value="$dsRequest.dataSourceName" /> <!-- Not replaced -->
                <Criterion fieldName="EmployeeStatus" operator="equals" value="$httpParameters.isc_v" /> <!-- Not replaced -->
                <Criterion fieldName="EmployeeType" operator="equals" value="$EmployeeType" /> <!-- Not replaced -->
                    </criteria>
            </criteria>
            </operationBinding>
        </operationBindings>
    </DataSource>
    Best regards
    Blama

    #2
    A direct reference to a field like $EmployeeType is not valid. $criteria.EmployeeType would be correct.

    It looks like you're expecting Velocity templating to be available for "value" attributes with arbitrary nesting. This isn't the case, although we agree that the docs don't make this limitation clear - we'll revise them.

    Comment


      #3
      Hi Isomorphic,

      no, I wasn't expecting that - I added that as a variable in my SQLDataSource subclass, see this line: request.addToTemplateContext("EmployeeType", "full time");

      Also without this you'll see replacement problems for the other variables in one operationBinding, that do work in the other one.
      Please just run the sample and see the log messages.

      Best regards
      Blama

      Comment


        #4
        Hi Isomorphic,

        here the logs, in case you need them.

        fetchBadNoVelocityException:
        Code:
        === 2019-03-14 10:56:03,646 [6-31] INFO  RequestContext - URL: '/builtinds/sc/IDACall', User-Agent: 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0': Moz (Gecko) with Accept-Encoding header
        === 2019-03-14 10:56:03,649 [6-31] DEBUG XML - Parsed XML from (in memory stream): 2ms
        === 2019-03-14 10:56:03,650 [6-31] DEBUG RPCManager - Processing 1 requests.
        === 2019-03-14 10:56:03,651 [6-31] DEBUG RPCManager - Request #1 (DSRequest) payload: {
            criteria:{
                operator:"lessOrEqual",
                fieldName:"Name",
                value:"L",
                _constructor:"AdvancedCriteria"
            },
            operationConfig:{
                dataSource:"employees",
                repo:null,
                operationType:"fetch",
                textMatchStyle:"exact"
            },
            startRow:0,
            endRow:75,
            sortBy:[
                "Name"
            ],
            componentId:"isc_ListGrid_3",
            appID:"builtinApplication",
            operation:"fetchBadVelocityNoException",
            oldValues:{
                operator:"lessOrEqual",
                fieldName:"Name",
                value:"L",
                _constructor:"AdvancedCriteria"
            }
        }
        === 2019-03-14 10:56:03,651 [6-31] INFO  IDACall - Performing 1 operation(s)
        === 2019-03-14 10:56:03,651 [6-31] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
        === 2019-03-14 10:56:03,651 [6-31] DEBUG DeclarativeSecurity - DataSource employees is not in the pre-checked list, processing...
        === 2019-03-14 10:56:03,652 [6-31] DEBUG DSTransaction - About to add advancedCriteria to criteria: {
            _constructor:"AdvancedCriteria",
            operator:"and",
            criteria:[
                {
                    fieldName:"OrgUnit",
                    operator:"equals",
                    value:"Management"
                },
                {
                    fieldName:"EmployeeStatus",
                    operator:"equals",
                    value:"$dsRequest.dataSourceName"
                },
                {
                    fieldName:"EmployeeStatus",
                    operator:"equals",
                    value:"$httpParameters.isc_v"
                },
                {
                    fieldName:"EmployeeType",
                    operator:"equals",
                    value:"$EmployeeType"
                }
            ]
        }
        === 2019-03-14 10:56:03,652 [6-31] DEBUG AppBase - [builtinApplication.fetchBadVelocityNoException] No userTypes defined, allowing anyone access to all operations for this application
        === 2019-03-14 10:56:03,652 [6-31] DEBUG AppBase - [builtinApplication.fetchBadVelocityNoException] No public zero-argument method named '_fetchBadVelocityNoException' found, performing generic datasource operation
        === 2019-03-14 10:56:03,652 [6-31] INFO  SQLDataSource - [builtinApplication.fetchBadVelocityNoException] Added velocity variable EmployeeType
        === 2019-03-14 10:56:03,652 [6-31] INFO  SQLDataSource - [builtinApplication.fetchBadVelocityNoException] HTTP parameter isc_v is v12.0p_2019-02-24
        === 2019-03-14 10:56:03,653 [6-31] INFO  SQLDataSource - [builtinApplication.fetchBadVelocityNoException] Performing fetch operation with
            criteria: {_constructor:"AdvancedCriteria",criteria:[{criteria:[{fieldName:"OrgUnit",value:"Management",operator:"equals"},{fieldName:"EmployeeStatus",value:"$dsRequest.dataSourceName",operator:"equals"},{fieldName:"EmployeeStatus",value:"$httpParameters.isc_v",operator:"equals"},{fieldName:"EmployeeType",value:"$EmployeeType",operator:"equals"}],operator:"and"},{fieldName:"Name",value:"L",operator:"lessOrEqual"}],operator:"and"}    values: {_constructor:"AdvancedCriteria",criteria:[{criteria:[{fieldName:"OrgUnit",value:"Management",operator:"equals"},{fieldName:"EmployeeStatus",value:"$dsRequest.dataSourceName",operator:"equals"},{fieldName:"EmployeeStatus",value:"$httpParameters.isc_v",operator:"equals"},{fieldName:"EmployeeType",value:"$EmployeeType",operator:"equals"}],operator:"and"},{fieldName:"Name",value:"L",operator:"lessOrEqual"}],operator:"and"}
        === 2019-03-14 10:56:03,654 [6-31] INFO  SQLDataSource - [builtinApplication.fetchBadVelocityNoException] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause ORDER BY $defaultOrderClause
        === 2019-03-14 10:56:03,655 [6-31] DEBUG SQLDataSource - [builtinApplication.fetchBadVelocityNoException] Executing row count query: SELECT COUNT(*) FROM $defaultTableClause WHERE $defaultWhereClause
        === 2019-03-14 10:56:03,655 [6-31] DEBUG SQLDataSource - [builtinApplication.fetchBadVelocityNoException] Eval'd row count query: SELECT COUNT(*) FROM employeeTable WHERE (((employeeTable.OrgUnit = 'Management' AND employeeTable.OrgUnit IS NOT NULL) AND (employeeTable.EmployeeStatus = '$dsRequest.dataSourceName' AND employeeTable.EmployeeStatus IS NOT NULL) AND (employeeTable.EmployeeStatus = '$httpParameters.isc_v' AND employeeTable.EmployeeStatus IS NOT NULL) AND (employeeTable.EmployeeType = '$EmployeeType' AND employeeTable.EmployeeType IS NOT NULL)) AND (employeeTable.Name <= 'L' OR employeeTable.Name IS NULL))
        === 2019-03-14 10:56:03,656 [6-31] DEBUG SQLConnectionManager - [builtinApplication.fetchBadVelocityNoException] Borrowed connection '1009446905'
        === 2019-03-14 10:56:03,656 [6-31] INFO  SQLDriver - [builtinApplication.fetchBadVelocityNoException] Executing SQL query on 'HSQLDB' using connection '1009446905': SELECT COUNT(*) FROM employeeTable WHERE (((employeeTable.OrgUnit = 'Management' AND employeeTable.OrgUnit IS NOT NULL) AND (employeeTable.EmployeeStatus = '$dsRequest.dataSourceName' AND employeeTable.EmployeeStatus IS NOT NULL) AND (employeeTable.EmployeeStatus = '$httpParameters.isc_v' AND employeeTable.EmployeeStatus IS NOT NULL) AND (employeeTable.EmployeeType = '$EmployeeType' AND employeeTable.EmployeeType IS NOT NULL)) AND (employeeTable.Name <= 'L' OR employeeTable.Name IS NULL))
        === 2019-03-14 10:56:03,660 [6-31] INFO  DSResponse - DSResponse: List with 0 items
        === 2019-03-14 10:56:03,660 [6-31] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
        === 2019-03-14 10:56:03,660 [6-31] DEBUG RPCManager - non-DMI response, dropExtraFields: false
        === 2019-03-14 10:56:03,660 [6-31] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 33
        === 2019-03-14 10:56:03,660 [6-31] DEBUG SQLDriver - Freeing SQLDriver dbConnection 1009446905 for SQLDriver instance 2082492527
        === 2019-03-14 10:56:03,661 [6-31] DEBUG SQLConnectionManager - About to close connection with hashcode "1009446905"
        === 2019-03-14 10:56:03,661 [6-31] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 33
        === 2019-03-14 10:56:03,661 [6-31] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 33
        === 2019-03-14 10:56:03,661 [6-31] INFO  Compression - /builtinds/sc/IDACall: 188 -> 152 bytes
        fetchBadVelocityNoException:
        Code:
        === 2019-03-14 10:56:16,739 [6-33] INFO  RequestContext - URL: '/builtinds/sc/IDACall', User-Agent: 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0': Moz (Gecko) with Accept-Encoding header
        === 2019-03-14 10:56:16,741 [6-33] DEBUG XML - Parsed XML from (in memory stream): 1ms
        === 2019-03-14 10:56:16,743 [6-33] DEBUG RPCManager - Processing 1 requests.
        === 2019-03-14 10:56:16,744 [6-33] DEBUG RPCManager - Request #1 (DSRequest) payload: {
            criteria:{
                operator:"lessOrEqual",
                fieldName:"Name",
                value:"L",
                _constructor:"AdvancedCriteria"
            },
            operationConfig:{
                dataSource:"employees",
                repo:null,
                operationType:"fetch",
                textMatchStyle:"exact"
            },
            startRow:0,
            endRow:75,
            sortBy:[
                "Name"
            ],
            componentId:"isc_ListGrid_4",
            appID:"builtinApplication",
            operation:"fetchBadNoVelocityException",
            oldValues:{
                operator:"lessOrEqual",
                fieldName:"Name",
                value:"L",
                _constructor:"AdvancedCriteria"
            }
        }
        === 2019-03-14 10:56:16,744 [6-33] INFO  IDACall - Performing 1 operation(s)
        === 2019-03-14 10:56:16,744 [6-33] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
        === 2019-03-14 10:56:16,744 [6-33] DEBUG DeclarativeSecurity - DataSource employees is not in the pre-checked list, processing...
        === 2019-03-14 10:56:16,745 [6-33] DEBUG DSTransaction - About to add to criteria: OrgUnit null Management
        === 2019-03-14 10:56:16,747 [6-33] DEBUG DSTransaction - About to add to criteria: EmployeeStatus null employees
        === 2019-03-14 10:56:16,749 [6-33] DEBUG DSTransaction - About to add to criteria: EmployeeStatus null v12.0p_2019-02-24
        === 2019-03-14 10:56:16,750 [6-33] DEBUG DSTransaction - About to add to criteria: EmployeeType null null
        === 2019-03-14 10:56:16,750 [6-33] WARN  RequestContext - dsRequest.execute() failed: 
        java.lang.NullPointerException
            at com.isomorphic.datasource.DSRequest.addToCriteria(DSRequest.java:6661)
            at com.isomorphic.datasource.DSTransaction.applyEarlierResponseValues(DSTransaction.java:858)
            at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:2806)
            at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:230)
            at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:187)
            at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:152)
            at com.isomorphic.servlet.IDACall._processRequest(IDACall.java:119)
            at com.isomorphic.servlet.IDACall.doPost(IDACall.java:79)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
            at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:176)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
            at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
            at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)
            at com.isomorphic.servlet.CompressionFilter._doFilter(CompressionFilter.java:260)
            at com.isomorphic.servlet.BaseFilter.doFilter(BaseFilter.java:93)
            at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474)
            at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)
            at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
            at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
            at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
            at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
            at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
            at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
            at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
            at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
            at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
            at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:68)
            at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
            at org.eclipse.jetty.server.Server.handle(Server.java:370)
            at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
            at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:960)
            at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1021)
            at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
            at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
            at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
            at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
            at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
            at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
            at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
            at java.lang.Thread.run(Unknown Source)
        === 2019-03-14 10:56:16,750 [6-33] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
        === 2019-03-14 10:56:16,751 [6-33] DEBUG RPCManager - non-DMI response, dropExtraFields: false
        === 2019-03-14 10:56:16,752 [6-33] INFO  Compression - /builtinds/sc/IDACall: 138 -> 126 bytes
        Best regards
        Blama

        Comment


          #5
          There are two issues here. Firstly, the failure to replace template values in AdvancedCriteria expressed through <criteria> tags is a regression introduced some time ago as a side-effect of a fix for an unrelated problem. A developer is scheduled to fix that regression, and at the same time we will remove the original limitation that nested conditions were not supported.

          The other issue is the reference to "$EmployeeType", which you set up in your executeFetch() override. That isn't being recognised because Velocity processing of <criteria> tags has already taken place by the time executeFetch() is called. If we were to change that timing, the criteria and values handed to the executeFetch() method would be incomplete, so we cannot do that. Instead, if you want to add elements to the criteria from Java code, use addToCriteria() directly rather than trying to arrange for that to happen with a declaration in the .ds.xml file and a replacement value in the template context.

          Regards
          Isomorphic Software Support

          Comment


            #6
            Hi Isomorphic,

            thanks.
            W.r.t "$EmployeeType" in executeFetch() and it being to late. We had a similar (I assume) discussion here. Would it be expected to work if the variable is injected way earlier, in IDACall-subclass.handleDSRequest()?
            (This is not important to me as the existing usecase was criteria with session variables, now it is going to be AdvancedCriteria with session variables. I did the injection just to test what the reason for the AdvancedCriteria not working might be.)

            W.r.t "at the same time we will remove the original limitation that nested conditions were not supported."
            I'm not sure what you mean here. IMHO this was supposed to work always. DSRequestModifier show a similar example at the very end. What will now additionally be possible?

            Best regards
            Blama

            Comment


              #7
              Yes, if you added the value to the request's template context in handleDSRequest(), that would work. Transaction chaining logic runs early on in DSRequest.execute()

              What will now additionally be possible?
              Nested conditions. The DSRequestModifier example you point to shows a single level of conditions, OR'd together. AdvancedCriteria allows you to express more complex conditions like "A and (B or (C and D))" - this is what will now be supported.

              Comment


                #8
                The issue with support for Velocity templating in AdvancedCriteria in <criteria> tags is now resolved. We have committed the fix as far back as version 10.1 (SamrtGWT 5.1). Please try your use with tomorrow's builds (those dated 19 March). We have also updated the documentation to note that variables added to the template context in a DMI or custom execute() method are not available during DSRequestModifier evaluation.

                Regards,
                Isomorphic Software Support

                Comment

                Working...
                X