Announcement

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

    #16
    Hi Isomorphic,

    could you please revisit this:

    Originally posted by Isomorphic View Post
    We've done some testing and this feature is working for us.

    We've been testing against the shipped "animals" data source.

    For simple criteria you can use this approach (for example):
    Code:
        <operationBindings>
            <operationBinding operationType="fetch">
                <criteria fieldName="lifeSpan" value="20"/>
                <criteria fieldName="scientificName" value="Ateles panicus"/>
            </operationBinding>
        </operationBindings>
    This works for me like for you.


    Originally posted by Isomorphic View Post
    For AdvancedCriteria, you can set the "_constructor" attribute, like this:
    Code:
    <operationBindings>
            <operationBinding operationType="fetch"  >
    
                <criteria _constructor="AdvancedCriteria" operator="and">
                    <criterion fieldName="lifeSpan" operator="greaterThan" value="10" />
                    <criterion fieldName="scientificName" operator="iContains" value="ana" />
                </criteria>
    
            </operationBinding>
        </operationBindings>
    which behaves as expected, generating output like this:
    === 2014-08-29 19:51:28,316 [l0-0] INFO SQLDataSource - [builtinApplication.animals_fetch] Performing fetch operation with
    criteria: {criteria:[{value:"10",fieldName:"lifeSpan",operator:"greaterThan"},{value:"ana",fieldName:"scientificName",operator:"iContains"}],operator:"and",_constructor:"AdvancedCriteria"} values: {criteria:[{value:"10",fieldName:"lifeSpan",operator:"greaterThan"},{value:"ana",fieldName:"scientificName",operator:"iContains"}],operator:"and",_constructor:"AdvancedCriteria"}
    === 2014-08-29 19:51:28,331 [l0-0] INFO SQLDataSource - [builtinApplication.animals_fetch] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
    === 2014-08-29 19:51:28,341 [l0-0] DEBUG SQLDataSource - [builtinApplication.animals_fetch] Executing row count query: SELECT COUNT(*) FROM $defaultTableClause WHERE $defaultWhereClause
    === 2014-08-29 19:51:28,342 [l0-0] DEBUG SQLDataSource - [builtinApplication.animals_fetch] Eval'd row count query: SELECT COUNT(*) FROM animals WHERE ((animals.lifeSpan > 10 AND animals.lifeSpan IS NOT NULL) AND (animals.scientificName LIKE '%ana%' AND animals.scientificName IS NOT NULL))
    This does not work for me. Using v10.0p_2015-05-19/PowerEdition Deployment (built 2015-05-19) I get this log (see bold lines for SQLs):
    Code:
    === 2015-05-19 17:14:27,280 [9-47] 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
    === 2015-05-19 17:14:27,280 [9-47] DEBUG IDACall - Header Name:Value pair: Cookie:isc_cState=ready; JSESSIONID=s4rqhlhyotnt1ttl3vtqoh5e1; GLog=%7B%0D%20%20%20%20trackRPC%3Atrue%2C%20%0D%20%20%20%20pageGUID%3A%2221815023-43EB-4995-8A08-E47132200934%22%2C%20%0D%20%20%20%20priorityDefaults%3A%7B%0D%20%20%20%20%20%20%20%20sgwtInternal%3A1%0D%20%20%20%20%7D%2C%20%0D%20%20%20%20defaultPriority%3A3%2C%20%0D%20%20%20%20left%3A0%2C%20%0D%20%20%20%20top%3A0%2C%20%0D%20%20%20%20width%3A525%2C%20%0D%20%20%20%20height%3A966%0D%7D
    === 2015-05-19 17:14:27,281 [9-47] DEBUG IDACall - Header Name:Value pair: DNT:1
    === 2015-05-19 17:14:27,281 [9-47] DEBUG IDACall - Header Name:Value pair: Host:127.0.0.1:8888
    === 2015-05-19 17:14:27,281 [9-47] DEBUG IDACall - Header Name:Value pair: Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    === 2015-05-19 17:14:27,281 [9-47] DEBUG IDACall - Header Name:Value pair: Content-Length:1044
    === 2015-05-19 17:14:27,281 [9-47] DEBUG IDACall - Header Name:Value pair: Content-Type:application/x-www-form-urlencoded; charset=UTF-8
    === 2015-05-19 17:14:27,281 [9-47] DEBUG IDACall - Header Name:Value pair: Accept-Language:de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
    === 2015-05-19 17:14:27,281 [9-47] DEBUG IDACall - Header Name:Value pair: Pragma:no-cache
    === 2015-05-19 17:14:27,281 [9-47] DEBUG IDACall - Header Name:Value pair: Connection:keep-alive
    === 2015-05-19 17:14:27,281 [9-47] DEBUG IDACall - Header Name:Value pair: Referer:http://127.0.0.1:8888/BuiltInDS.html?gwt.codesvr=127.0.0.1:9997
    === 2015-05-19 17:14:27,281 [9-47] DEBUG IDACall - Header Name:Value pair: User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0
    === 2015-05-19 17:14:27,282 [9-47] DEBUG IDACall - Header Name:Value pair: Cache-Control:no-cache
    === 2015-05-19 17:14:27,282 [9-47] DEBUG IDACall - Header Name:Value pair: Accept-Encoding:gzip, deflate
    === 2015-05-19 17:14:27,282 [9-47] DEBUG IDACall - session exists: s4rqhlhyotnt1ttl3vtqoh5e1
    === 2015-05-19 17:14:27,282 [9-47] DEBUG IDACall - remote user: null
    === 2015-05-19 17:14:27,295 [9-47] DEBUG XML - Parsed XML from (in memory stream): 8ms
    === 2015-05-19 17:14:27,296 [9-47] DEBUG ISCKeyedObjectPool - Borrowing object for 'transaction'
    === 2015-05-19 17:14:27,296 [9-47] DEBUG PoolableDataSourceFactory - Created DataSource null of type 'transaction' in the pooling flow
    === 2015-05-19 17:14:27,297 [9-47] DEBUG ISCKeyedObjectPool - Borrowing object for 'Object'
    === 2015-05-19 17:14:27,297 [9-47] DEBUG PoolableDataSourceFactory - Created DataSource 48 of type 'Object' and assigned it to thread qtp1473125779-47
    === 2015-05-19 17:14:27,298 [9-47] DEBUG PoolableDataSourceFactory - Created DataSource 48 of type 'Object' in the pooling flow
    === 2015-05-19 17:14:27,298 [9-47] DEBUG PoolableDataSourceFactory - Activated DataSource 48 of type 'Object'
    === 2015-05-19 17:14:27,299 [9-47] DEBUG ISCKeyedObjectPool - Borrowing object for 'List'
    === 2015-05-19 17:14:27,300 [9-47] DEBUG PoolableDataSourceFactory - Created DataSource 49 of type 'List' and assigned it to thread qtp1473125779-47
    === 2015-05-19 17:14:27,300 [9-47] DEBUG PoolableDataSourceFactory - Created DataSource 49 of type 'List' in the pooling flow
    === 2015-05-19 17:14:27,300 [9-47] DEBUG PoolableDataSourceFactory - Activated DataSource 49 of type 'List'
    === 2015-05-19 17:14:27,301 [9-47] DEBUG ISCKeyedObjectPool - Borrowing object for 'elem'
    === 2015-05-19 17:14:27,302 [9-47] DEBUG PoolableDataSourceFactory - Created DataSource null of type 'elem' in the pooling flow
    === 2015-05-19 17:14:27,304 [9-47] DEBUG RPCManager - Processing 1 requests.
    === 2015-05-19 17:14:27,304 [9-47] DEBUG ISCKeyedObjectPool - Borrowing object for 'animals'
    === 2015-05-19 17:14:27,304 [9-47] DEBUG PoolableDataSourceFactory - Activated DataSource 32 of type 'animals'
    === 2015-05-19 17:14:27,305 [9-47] DEBUG DSRequest - Caching instance 32 of DS 'animals' from DSRequest.getDataSource()
    === 2015-05-19 17:14:27,305 [9-47] DEBUG DSRequest - Caching instance 32 of DS animals
    === 2015-05-19 17:14:27,306 [9-47] DEBUG RPCManager - Request #1 (DSRequest) payload: {
        criteria:{
        },
        operationConfig:{
            dataSource:"animals",
            repo:null,
            operationType:"fetch",
            textMatchStyle:"exact"
        },
        startRow:0,
        endRow:75,
        componentId:"isc_ListGrid_1",
        appID:"builtinApplication",
        operation:"animals_fetch",
        oldValues:{
        }
    }
    === 2015-05-19 17:14:27,307 [9-47] INFO  IDACall - Performing 1 operation(s)
    === 2015-05-19 17:14:27,307 [9-47] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
    === 2015-05-19 17:14:27,307 [9-47] DEBUG DeclarativeSecurity - DataSource animals is not in the pre-checked list, processing...
    === 2015-05-19 17:14:27,307 [9-47] DEBUG AppBase - [builtinApplication.animals_fetch] No userTypes defined, allowing anyone access to all operations for this application
    === 2015-05-19 17:14:27,308 [9-47] DEBUG AppBase - [builtinApplication.animals_fetch] No public zero-argument method named '_animals_fetch' found, performing generic datasource operation
    === 2015-05-19 17:14:27,309 [9-47] INFO  SQLDataSource - [builtinApplication.animals_fetch] Performing fetch operation with
    	criteria: {}	values: {}
    === 2015-05-19 17:14:27,309 [9-47] INFO  SQLWhereClause - [builtinApplication.animals_fetch] empty condition
    === 2015-05-19 17:14:27,310 [9-47] INFO  SQLDataSource - [builtinApplication.animals_fetch] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
    === 2015-05-19 17:14:27,311 [9-47] DEBUG SQLDataSource - [builtinApplication.animals_fetch] Executing row count query: SELECT COUNT(*) FROM $defaultTableClause WHERE $defaultWhereClause
    [B]=== 2015-05-19 17:14:27,312 [9-47] DEBUG SQLDataSource - [builtinApplication.animals_fetch] Eval'd row count query: SELECT COUNT(*) FROM animals WHERE ('1'='1')[/B]
    === 2015-05-19 17:14:27,312 [9-47] DEBUG PoolableSQLConnectionFactory - [builtinApplication.animals_fetch] DriverManager fetching connection for HSQLDB via jdbc url jdbc:hsqldb:hsql://localhost/isomorphic
    === 2015-05-19 17:14:27,312 [9-47] DEBUG PoolableSQLConnectionFactory - [builtinApplication.animals_fetch] Passing JDBC URL only to getConnection
    === 2015-05-19 17:14:27,415 [9-47] DEBUG PoolableSQLConnectionFactory - [builtinApplication.animals_fetch] makeObject() created an unpooled Connection '788586398'
    === 2015-05-19 17:14:27,415 [9-47] DEBUG SQLConnectionManager - [builtinApplication.animals_fetch] Borrowed connection '788586398'
    === 2015-05-19 17:14:27,416 [9-47] DEBUG SQLDriver - [builtinApplication.animals_fetch] About to execute SQL query in 'HSQLDB' using connection '788586398'
    [B]=== 2015-05-19 17:14:27,416 [9-47] INFO  SQLDriver - [builtinApplication.animals_fetch] Executing SQL query on 'HSQLDB': SELECT COUNT(*) FROM animals WHERE ('1'='1')
    === 2015-05-19 17:14:27,420 [9-47] DEBUG SQLDataSource - [builtinApplication.animals_fetch] Using SQL Limit query
    === 2015-05-19 17:14:27,421 [9-47] DEBUG SQLDataSource - [builtinApplication.animals_fetch] SQL windowed select rows 0->75, result size 75. Query: SELECT LIMIT 0 75  animals.commonName, animals.scientificName, animals.lifeSpan, animals.status, animals.diet, animals.information, animals.picture FROM animals WHERE ('1'='1')
    === 2015-05-19 17:14:27,421 [9-47] DEBUG SQLDataSource - [builtinApplication.animals_fetch] SQL windowed select rows 0->75, result size 75. Query: SELECT LIMIT 0 75  animals.commonName, animals.scientificName, animals.lifeSpan, animals.status, animals.diet, animals.information, animals.picture FROM animals WHERE ('1'='1')[/B]
    === 2015-05-19 17:14:27,429 [9-47] INFO  DSResponse - [builtinApplication.animals_fetch] DSResponse: List with 29 items
    === 2015-05-19 17:14:27,429 [9-47] DEBUG DSRequest - About to free up resources for request of type fetch on DataSource animals
    === 2015-05-19 17:14:27,430 [9-47] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
    === 2015-05-19 17:14:27,430 [9-47] DEBUG RPCManager - non-DMI response, dropExtraFields: false
    === 2015-05-19 17:14:27,440 [9-47] DEBUG SQLDriver - Freeing SQLDriver dbConnection 788586398
    === 2015-05-19 17:14:27,441 [9-47] DEBUG SQLConnectionManager - About to close JDBCConnection with hashcode "788586398"
    === 2015-05-19 17:14:27,442 [9-47] DEBUG PoolableDataSourceFactory - Cleared and passivated DataSource 32 of type 'animals'
    === 2015-05-19 17:14:27,443 [9-47] INFO  Compression - /builtinds/sc/IDACall: 10585 -> 4153 bytes
    My only change to the sample is this animals.ds.xml:
    Code:
    <DataSource ID="animals" serverType="sql" tableName="animals" testFileName="animals.data.xml">
    	<fields>
    		<field name="commonName" title="Animal" type="text" />
    		<field name="scientificName" title="Scientific Name" type="text" primaryKey="true" required="true" />
    		<field name="lifeSpan" title="Life Span" type="integer" />
    		<field name="status" title="Endangered Status" type="text">
    			<valueMap>
    				<value>Threatened</value>
    				<value>Endangered</value>
    				<value>Not Endangered</value>
    				<value>Not currently listed</value>
    				<value>May become threatened</value>
    				<value>Protected</value>
    			</valueMap>
    		</field>
    		<field name="diet" title="Diet" type="text" />
    		<field name="information" title="Interesting Facts" type="text" length="1000" />
    		<field name="picture" title="Picture" type="image" detail="true" imageURLPrefix="/isomorphic/system/reference/inlineExamples/tiles/images/" />
    	</fields>
    
    	<operationBindings>
    		<criteria _constructor="AdvancedCriteria" operator="and">
    			<criterion fieldName="lifeSpan" operator="greaterThan" value="10" />
    			<criterion fieldName="scientificName" operator="iContains" value="ana" />
    		</criteria>
    	</operationBindings>
    </DataSource>
    I should definitely see what you are seeing, but I'm not.
    I'm using v10.0p_2015-05-19/PowerEdition, GWT 2.7.0 DevMode using built-in Jetty, Eclipse Luna SR2, FF26+GWT Plugin, Win8.1.
    I can change log settings in log4j.isc.config.xml if that would help.

    Best regards
    Blama

    Comment


      #17
      Hi all,

      this .ds.xml is obviously wrong as it misses the <operationBinding>-tag. I just retested with:
      Code:
      <DataSource ID="animals" serverType="sql" tableName="animals" testFileName="animals.data.xml">
          <fields>
              <field name="commonName" title="Animal" type="text" />
              <field name="scientificName" title="Scientific Name" type="text" primaryKey="true" required="true" />
              <field name="lifeSpan" title="Life Span" type="integer" />
              <field name="status" title="Endangered Status" type="text">
                  <valueMap>
                      <value>Threatened</value>
                      <value>Endangered</value>
                      <value>Not Endangered</value>
                      <value>Not currently listed</value>
                      <value>May become threatened</value>
                      <value>Protected</value>
                  </valueMap>
              </field>
              <field name="diet" title="Diet" type="text" />
              <field name="information" title="Interesting Facts" type="text" length="1000" />
              <field name="picture" title="Picture" type="image" detail="true" imageURLPrefix="/isomorphic/system/reference/inlineExamples/tiles/images/" />
          </fields>
      
          <operationBindings>
              [B]<operationBinding operationType="fetch">[/B]
                  <criteria _constructor="AdvancedCriteria" operator="and">
                      <criterion fieldName="lifeSpan" operator="greaterThan" value="10" />
                      <criterion fieldName="scientificName" operator="iContains" value="ana" />
                  </criteria>
              [B]</operationBinding>[/B]
          </operationBindings>
      </DataSource>
      which is working as expected.

      Best regards
      Blama

      Comment


        #18
        Hi Isomorphic,

        please note the .ds.xml-AdvancedCriteria docs and .ds.xml-Criterion seem to be text-copies of their respective com.smartgwt.client.data-classes.

        How to include a Criteria in .ds.xml is only shown in the QuickStartGuide (chapter "Server-Assigned Criteria/Values"). For AdvancedCriteria/Criterion this is shown nowhere. It would be good to have information in the ds.xml docs, most likely instead of the current docs.

        Best regards
        Blama

        Comment


          #19
          We've added some samples of Criteria declaration in ds.xml to DSRequestModifier javadocs.

          Comment


            #20
            Great, I just saw them.

            Thank you
            Blama

            Comment


              #21
              Hi Isomorphic,

              this thread is about <values> and <criteria> DSRequestModifier in .ds.xml operationBinding only being applied to client initiated requests.

              While this is OK the way it is, it would be great if the docs somehow mentioned it. I couldn't find this in any docs recently in order to explain observed behavior.
              I think it's only in this thread.
              I would be great if the docs above or criteria and values get an update saying something like:
              • Normal clientside requests get the additional criteria from <criteria>.
              • New serverside DSRequests picking up the RPCManager from the clientside request get the additional criteria from <criteria>.
              • New serverside DSRequests without a RPCManager don't get the additional criteria.
              • Use <whereClause>field = 'N' AND ($defaultWhereClause)</whereClause> if you want restrictions to be always applied.
              Perhaps this should also be linked from serverside BaseRequest.isClientRequest().

              Best regards
              Blama

              Comment

              Working...
              X