Announcement

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

    DMI Fetch Operation Binding not working

    I´m using SmartGWT3.1 pro(build of Feb/12).

    problem: DMI operation binding configured at DataSource is never triggered on fech operations.

    I´ve followed the instrucions at pag-55 of Quick Start Guide. Defined a function to performe the fetch operation:

    Code:
    	@SuppressWarnings({ "rawtypes", "unchecked", "unused" })
    	public DSResponse fetchOrgao(DSRequest dsRequest) throws Exception {
    		DSResponse resp = dsRequest.execute();
    		return resp;
    
    	}
    obs- it should have some specific logic (removed for this test purposes)

    Properly configured the DynamicForm to use the FetchOperation ID = "fullFetch"

    Code:
    		formOrgaos = new DynamicForm();
    		formOrgaos.setDataSource(DataSource.get("orgaos"));
    		formOrgaos.setFetchOperation("fullFetch");
    		formOrgaos.setDataFetchMode(FetchMode.LOCAL);	
    		formOrgaos.setAutoFetchData(true);
    Then configured the redirection at DataSource:

    Code:
    	<operationBinding operationType="fetch" operationId="fullFetch">
    		<serverObject className="net.techdesk.audespSRC.server.TabelaOrgao"
    			methodName="fetchOrgao" />
    	</operationBinding>
    At Eclipse Debug Console I can see that DSRequest has the identification of the DMI operation to use, as follows:

    Code:
    === 2013-03-18 23:53:12,874 [82-3] DEBUG RPCManager - Request #1 (DSRequest) payload: {
        criteria:{
            nome:"PREFEITURA MUNICIPAL DE BALBINOS"
        },
        operationConfig:{
            dataSource:"orgaos",
            operationType:"fetch"
        },
        componentId:"isc_DynamicForm_5",
        appID:"builtinApplication",
        operation:"fullFetch",
        oldValues:{
            nome:"PREFEITURA MUNICIPAL DE BALBINOS"
        }
    }
    === 2013-03-18 23:53:12,874 [82-3] INFO  IDACall - Performing 1 operation(s)
    But I can also check that my function never gets triggered despite the fetch always happens (I believe it´s somehow using default fetch implementation).

    Could you please check my implementation and let me know what I may be missing?

    thanks
    Conejo

    #2
    Could you please check my implementation and let me know what I may be missing?
    We can't. You posted only a portion of the logs and a portion of your DataSource, and the problem isn't in the part you posted.

    This is why you should always post complete information.

    Comment


      #3
      Let me know what additional info you need?

      I tought just the implementation exactly as recommended at the "Quick Start Guide" (pg-55) should be enough.

      I´m pretty sure there is something wrong on the DMI redirection handling or on the instructions at "Quick Start Guide".


      Conejo

      Comment


        #4
        I´ve made some additional tests, still no success but may help to clarify the scenario.

        Code:
        === 2013-03-19 13:43:23,051 [6-10] INFO  IDACall - Performing 1 operation(s)
        === 2013-03-19 13:43:23,051 [6-10] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
        === 2013-03-19 13:43:23,051 [6-10] DEBUG DeclarativeSecurity - DataSource orgaos is not in the pre-checked list, processing...
        === 2013-03-19 13:43:23,052 [6-10] WARN  DataSourceDMI - DataSource orgaos: received a request to execute an operation of type 'fetch' named 'fullFetch', but this operation is not defined to the dataSource.  Falling back to default behavior for operationType 'fetch'
        === 2013-03-19 13:43:23,052 [6-10] DEBUG AppBase - [builtinApplication.fullFetch] No userTypes defined, allowing anyone access to all operations for this application
        === 2013-03-19 13:43:23,052 [6-10] DEBUG AppBase - [builtinApplication.fullFetch] No public zero-argument method named '_fullFetch' found, performing generic datasource operation
        === 2013-03-19 13:43:23,053 [6-10] INFO  SQLDataSource - [builtinApplication.fullFetch] Performing fetch operation with
        	criteria: {nome:"PREFEITURA MUNICIPAL DE BALBINOS"}	values: {nome:"PREFEITURA MUNICIPAL DE BALBINOS"}
        Could you please help me to understand what means:

        DEBUG DeclarativeSecurity - DataSource orgaos is not in the pre-checked list, processing...
        That is presented in the log.


        And I believe that following messages can give you some glue on what is happening:

        WARN DataSourceDMI - DataSource orgaos: received a request to execute an operation of type 'fetch' named 'fullFetch', but this operation is not defined to the dataSource. Falling back to default behavior for operationType 'fetch'
        === 2013-03-19 13:43:23,052 [6-10] DEBUG AppBase - [builtinApplication.fullFetch] No userTypes defined, allowing anyone access to all operations for this application
        === 2013-03-19 13:43:23,052 [6-10] DEBUG AppBase - [builtinApplication.fullFetch] No public zero-argument method named '_fullFetch' found, performing generic datasource operation

        I´ve tried to change the function to a zero-argument as follows:
        Code:
        	public void fetchOrgao() throws Exception {
        		System.out.println("########## Simply do Nothing");
        
        //		DSResponse resp = dsRequest.execute();
        //		return resp;
        
        	}
        But it does not makes any effect.

        My "fetchOrgao" function is defined on a source file at server side area, can it be related to the problem?

        Thanks in advance by the support.
        Conejo

        Comment


          #5
          You should post the complete server log for the request (as the forums tells you to).

          If you had posted the complete server log for the request, we would have seen these log messages you have just now noticed, and told you that they are the problem.

          Now, the problem is most likely in your DataSource file. But you still haven't posted the complete file, so you're still stopping anyone from helping you..

          Comment


            #6
            Use FireBug and examine the response of the http request to the DataSourceLoader URL. In the response scroll all the way to the bottom and see if you see any errors / exceptions in there.

            Comment


              #7
              My apologies by not sending the full log. Please see it attached (log_19Mar.txt and the FireBug version named FireBug_log_19Mar.txt). sjivan many thanks by the FireBug hint :)

              I´ve hunt for some possible error indication but could not recognize any. So I still need your help.

              In the Console all my DataSource xml seems to be succesfully parsed. Even for "orgaos.ds.xml" the one where I´m trying to set the DMI.

              Code:
              === 2013-03-19 21:57:45,329 [67-6] DEBUG XML - Parsed XML from C:\Conejo\desenvolvimento\projetos_eclipse\audespSource\war\audespsource\sc\system\schema\builtinTypes.xml: 33ms
              === 2013-03-19 21:57:45,564 [67-6] DEBUG XML - Parsed XML from C:\Conejo\desenvolvimento\projetos_eclipse\audespSource\war\ds\prefeituras.ds.xml: 5ms
              === 2013-03-19 21:57:45,575 [67-6] DEBUG XML - Parsed XML from C:\Conejo\desenvolvimento\projetos_eclipse\audespSource\war\audespsource\sc\system\schema\DataSource.ds.xml: 8ms
              === 2013-03-19 21:57:45,820 [67-6] DEBUG XML - Parsed XML from C:\Conejo\desenvolvimento\projetos_eclipse\audespSource\war\audespsource\sc\system\schema\DataSourceField.ds.xml: 9ms
              === 2013-03-19 21:57:46,039 [67-6] DEBUG XML - Parsed XML from C:\Conejo\desenvolvimento\projetos_eclipse\audespSource\war\ds\orgaos.ds.xml: 3ms
              === 2013-03-19 21:57:46,072 [67-6] DEBUG XML - Parsed XML from C:\Conejo\desenvolvimento\projetos_eclipse\audespSource\war\ds\classificacaoReceita_DS.ds.xml: 3ms
              === 2013-03-19 21:57:46,098 [67-6] DEBUG XML - Parsed XML from C:\Conejo\desenvolvimento\projetos_eclipse\audespSource\war\ds\codigoAplicacao_DS.ds.xml: 3ms
              === 2013-03-19 21:57:46,128 [67-6] DEBUG XML - Parsed XML from C:\Conejo\desenvolvimento\projetos_eclipse\audespSource\war\ds\codigoTipoReceita_DS.ds.xml: 4ms
              === 2013-03-19 21:57:46,155 [67-6] DEBUG XML - Parsed XML from C:\Conejo\desenvolvimento\projetos_eclipse\audespSource\war\ds\codigoFonteRecurso_DS.ds.xml: 2ms
              === 2013-03-19 21:57:46,186 [67-6] DEBUG XML - Parsed XML from C:\Conejo\desenvolvimento\projetos_eclipse\audespSource\war\ds\detalheReceita_DS.ds.xml: 6ms
              === 2013-03-19 21:57:46,292 [67-6] DEBUG XML - Parsed XML from C:\Conejo\desenvolvimento\projetos_eclipse\audespSource\war\ds\funcaoGoverno_DS.ds.xml: 5ms
              === 2013-03-19 21:57:46,317 [67-6] DEBUG XML - Parsed XML from C:\Conejo\desenvolvimento\projetos_eclipse\audespSource\war\ds\fornecedorCredor_DS.ds.xml: 4ms
              === 2013-03-19 21:57:46,342 [67-6] DEBUG XML - Parsed XML from C:\Conejo\desenvolvimento\projetos_eclipse\audespSource\war\ds\subFuncaoGoverno_DS.ds.xml: 4ms
              === 2013-03-19 21:57:46,366 [67-6] DEBUG XML - Parsed XML from C:\Conejo\desenvolvimento\projetos_eclipse\audespSource\war\ds\classificacaoDespesa_DS.ds.xml: 3ms
              === 2013-03-19 21:57:46,392 [67-6] DEBUG XML - Parsed XML from C:\Conejo\desenvolvimento\projetos_eclipse\audespSource\war\ds\detalheDespesa_DS.ds.xml: 5ms
              === 2013-03-19 21:57:46,448 [67-6] DEBUG XML - Parsed XML from C:\Conejo\desenvolvimento\projetos_eclipse\audespSource\war\ds\modalidadeLicitatoria_DS.ds.xml: 4ms
              === 2013-03-19 21:57:46,474 [67-6] DEBUG XML - Parsed XML from C:\Conejo\desenvolvimento\projetos_eclipse\audespSource\war\ds\logXMLImport_DS.ds.xml: 4ms
              === 2013-03-19 21:57:46,513 [67-6] DEBUG XML - Parsed XML from C:\Conejo\desenvolvimento\projetos_eclipse\audespSource\war\ds\balancoAnual_DS.ds.xml: 4ms
              === 2013-03-19 21:57:46,536 [67-6] DEBUG XML - Parsed XML from C:\Conejo\desenvolvimento\projetos_eclipse\audespSource\war\audespsource\sc\system\schema\ValueMap.ds.xml: 3ms
              === 2013-03-19 21:57:46,611 [67-6] DEBUG XML - Parsed XML from C:\Conejo\desenvolvimento\projetos_eclipse\audespSource\war\ds\treeDetalheReceita_DS.ds.xml: 5ms
              === 2013-03-19 21:57:46,644 [67-6] DEBUG XML - Parsed XML from C:\Conejo\desenvolvimento\projetos_eclipse\audespSource\war\audespsource\sc\system\schema\ServerObject.ds.xml: 3ms
              === 2013-03-19 21:57:46,679 [67-6] DEBUG XML - Parsed XML from C:\Conejo\desenvolvimento\projetos_eclipse\audespSource\war\ds\treeDetalheDespesa_DS.ds.xml: 4ms
              FireBug did not show anything wrong (full log also attached):

              Code:
              isc.DataSource.create({
                  allowAdvancedCriteria:false,
                  tableCode:"972350d545a9ba587f1ff0774e0dc336",
                  ID:"orgaos",
                  operationBinding:{
                      operationId:"fullFetch",
                      operationType:"fetch",
                      serverObject:{
                          className:"net.techdesk.audespSRC.server.TabelaOrgao",
                          methodName:"fetchOrgao"
                      }
                  },
                  fields:[
                      {
                          title:"Nome",
                          columnCode:"666ac576aa2666cff323f5d976d592a6",
                          name:"nome",
                          type:"text",
                          editorType:"ComboBoxItem"
                      },
                      {
                          title:"Cidade",
                          hidden:true,
                          columnCode:"0c25ff47c030162d31c91c9f45af496a",
                          primaryKey:true,
                          name:"cod_cidade",
                          type:"integer",
                          required:true,
                          foreignKey:"prefeituras.codigo"
                      },
                      {
                          title:"Codigo",
                          hidden:true,
                          columnCode:"41ef894026a8cd4da247105a6036db70",
                          primaryKey:true,
                          name:"codigo",
                          type:"integer",
                          required:true
                      }
                  ],
                  serverType:"sql"
              })
              Not sure if it can cause any side-effect but I´m not loading the DataSource XML through HTML. I´m in fact doing so at onModuleLoad:

              Code:
              	public void onModuleLoad() {
              		
                      setWidth100();  
                      setHeight100();  
                      setLayoutMargin(20);  
              
                      String [] d = {
                      				"prefeituras",
                      				"orgaos",
                      				"classificacaoReceita_DS",
                      				"codigoAplicacao_DS",
                      				"codigoTipoReceita_DS",
                      				"codigoFonteRecurso_DS",
                      				"detalheReceita_DS",
                      				"funcaoGoverno_DS", 
                      				"fornecedorCredor_DS",
                      				"subFuncaoGoverno_DS",
                      				"classificacaoDespesa_DS",
                      				"detalheDespesa_DS",
                      				"modalidadeLicitatoria_DS",
                      				"logXMLImport_DS",
                      				"balancoAnual_DS",
                      				"treeDetalheReceita_DS",
                      				"treeDetalheDespesa_DS"
                      				};
                      
                   
                      DataSource.load( d, new Function(){
              
              			@Override
              			public void execute() {
              		
              		     	VLayout VLayout = new VLayout();
              		     	VLayout.addMember( MenuSelecao.getMenuSelecao());
              		      	VLayout.addMember( UIFSM.getTabSet());
              		      	VLayout.setHeight("auto"); 
              		      	
              		        VLayout.draw();  
              
              		        UIFSM.handleToken(UITokens.STT_ANALISE);
              				
              			}}
                      
                      , true);
              And finally here you´re the "orgao.ds.xml" file:
              Code:
              <DataSource
                  ID="orgaos"
              	serverType="sql"
              	tableName="orgaos"
              	 >
              	
                  <fields>
                      <field name="nome"           title="Nome"             type="text"    editorType = "ComboBoxItem"></field>
                      
                      <field name="cod_cidade"     title="Cidade"           type="integer"  primaryKey="true"  required="true"
                          foreignKey="prefeituras.codigo" hidden="true"/>
                     
                      
                      <field name="codigo"         title="Codigo"           type="integer"  primaryKey="true"  required="true" hidden="true" />
                  </fields>
              
              
              	<operationBinding operationType="fetch" operationId="fullFetch">
              		<serverObject className="net.techdesk.audespSRC.server.TabelaOrgao"
              			methodName="fetchOrgao" />
              	</operationBinding>
                 
              </DataSource>
              And here a Post requesting a Fetch to use the new DMI

              Code:
              _transaction	<transaction xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:type="xsd:Object"><transactionNum xsi:type="xsd:long">4</transactionNum><operations xsi:type="xsd:List"><elem xsi:type="xsd:Object"><criteria xsi:type="xsd:Object"><nome>PREFEITURA MUNICIPAL DE BADY BASSITT</nome></criteria><operationConfig xsi:type="xsd:Object"><dataSource>orgaos</dataSource><operationType>fetch</operationType></operationConfig><componentId>isc_DynamicForm_5</componentId><appID>builtinApplication</appID><operation>fullFetch</operation><oldValues xsi:type="xsd:Object"><nome>PREFEITURA MUNICIPAL DE BADY BASSITT</nome></oldValues></elem></operations></transaction>
              isc_tnum	4
              protocolVersion	1.0
              And it´s correspondent Response:
              Code:
              //isc_RPCResponseStart-->[{data:[{codigo:1,cod_cidade:1,nome:"PREFEITURA MUNICIPAL DE BADY BASSITT"}],endRow:1,invalidateCache:false,isDSResponse:true,operationType:"fetch",queueStatus:0,startRow:0,status:0,totalRows:1}]//isc_RPCResponseEnd
              Again I thank you all for the support
              Conejo
              Attached Files
              Last edited by conejo; 19 Mar 2013, 14:38.

              Comment


                #8
                Missing <operationBindings> around <operationBinding>.

                Comment


                  #9
                  Originally posted by Isomorphic View Post
                  Missing <operationBindings> around <operationBinding>.
                  Sorry I did not get your point. You mentioned <operationBindings> and I can not see exactly where to use.
                  I´ve cut&pasted the example from "Quick Start Guide" (bottom pg-55) as follows:

                  Code:
                  <operationBinding operationType="fetch" operationId="fullTextSearch">
                      <serverObject className="com.sample.DMIHandler"
                                    methodName="doFullTextSearch"/>
                  </operationBinding>
                  and just replaced the operationId, className and methodName to mine ones.

                  Comment


                    #10
                    See earlier parts of the QuickStart that show a complete definition, or any sample that uses operationBindings - any of them.

                    Comment


                      #11
                      Originally posted by Isomorphic View Post
                      See earlier parts of the QuickStart that show a complete definition, or any sample that uses operationBindings - any of them.
                      Oh man!!! It´s really tricky.
                      I was just missing the <operationBindings> section.

                      In the Quick Start Guide it shows the full example a few paragraphs before:

                      Code:
                      <DataSource ... >
                         <operationBindings>
                           <operationBinding operationType="fetch">
                              <criteria fieldName="deleted" value="false"/>
                           </operationBinding>
                         </operationBindings>
                      </DataSource>
                      Thanks by the support !!!
                      Conejo

                      Comment

                      Working...
                      X