Announcement

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

    RestDataSource tagName property not sent

    I just installed the latest version of smartgwt 3.0 along with GWT 2.4.
    I notice that the xml request structure has changed. It used to be
    <request><data><tag name of the datasource>

    It has changed to <request><data><object element tags>

    The <tag name of the datasource> is not longer sent.

    The property tagname of the datasource seems to be disabled.

    Is this changed something planned or are we missing a new property name?

    #2
    DataSource class:

    Code:
    public class OfertasDS extends RestDataSource {
    
        private static OfertasDS instance = null;
        private String url_rest = "/com.acens.crm/resources/ofertas/";
        private static Integer totalRow = 0;
    
        public static OfertasDS getInstance() {
            if (instance == null) {
                instance = new OfertasDS("OfertasDS");
            }
            return instance;
        }
    
        public static Integer getTotalRow() {
            return totalRow;
        }
    
        public OfertasDS(String id) {
            
            setID(id);
            setTagName("pedido");
    
            DataSourceField[] dataSourceField = new DataSourceField[18];
    
            //Primary Key
            DataSourceTextField idOferta = new DataSourceTextField("id_pedido");
            idOferta.setPrimaryKey(true);
            dataSourceField[0] = idOferta;
           
            dataSourceField[1] = new DataSourceTextField("codigo_pedido");
            dataSourceField[2] = new DataSourceTextField("marca");
            dataSourceField[3] = new DataSourceTextField("id_usuario");
            dataSourceField[3].setType(FieldType.INTEGER);
            dataSourceField[4] = new DataSourceTextField("tipo_cliente");
            dataSourceField[5] = new DataSourceTextField("dfiscal");
            dataSourceField[6] = new DataSourceTextField("titular");
            dataSourceField[7] = new DataSourceTextField("tipo");
            dataSourceField[8] = new DataSourceTextField("estado");
            dataSourceField[9] = new DataSourceTextField("estado_idc");
            dataSourceField[10] = new DataSourceTextField("estado_ad");
            dataSourceField[11] = new DataSourceTextField("comercial");
            dataSourceField[12] = new DataSourceFloatField("imp_total_anualizado");
            dataSourceField[13] = new DataSourceTextField("prioridad");
            dataSourceField[14] = new DataSourceTextField("prob_exito");
            dataSourceField[14].setType(FieldType.INTEGER);
            dataSourceField[15] = new DataSourceTextField("fecha_creacion");
            dataSourceField[15].setType(FieldType.INTEGER);
            dataSourceField[16] = new DataSourceTextField("fecha_presentacion");
            dataSourceField[16].setType(FieldType.INTEGER);
            dataSourceField[17] = new DataSourceTextField("ticket");       
    
            this.setFields(dataSourceField);
            //Operaciones
            OperationBinding fetch = new OperationBinding(DSOperationType.FETCH, url_rest);
    
            DSRequest ds = new DSRequest();
            ds.setContentType("application/xml");
            fetch.setRequestProperties(ds);
            fetch.setDataFormat(DSDataFormat.XML);        
            fetch.setDataProtocol(DSProtocol.POSTXML);
    
            this.setOperationBindings(fetch);
        }
    
    
        @Override
        protected void transformResponse(DSResponse response, DSRequest request, Object data) {
            //Recupero el número de registros.
            totalRow = Integer.parseInt(XMLTools.selectString(data, "/response/totalRow"));
            //Llamada al método de la superclase.
            super.transformResponse(response, request, data);
    
        }
    RPC request (version smartgwt 2.5)
    Code:
    <request>
        <data>
            <pedido>
                <fecha_creacion>1</fecha_creacion>
                <id_comercial>1028181</id_comercial>
                <id_tipo>1</id_tipo>
                <fecha_inicio>1341784800000</fecha_inicio>
                <fecha_fin>1341957600000</fecha_fin>
                <num_max_reg>50</num_max_reg>
            </pedido>
        </data>
        <dataSource>OfertasDS</dataSource>
        <operationType>fetch</operationType>
        <startRow>0</startRow>
        <endRow>75</endRow>
        <sortBy>fecha_asignacion_idc</sortBy>
        <textMatchStyle>exact</textMatchStyle>
        <componentId>isc_OfertasListGrid_1_0</componentId>
        <oldValues></oldValues>
    </request>
    RPC request (version smartgwt 3.0) .... tagName of DataSource not sent
    Code:
    <request>
        <data>
            <fecha_creacion>1</fecha_creacion>
            <fecha_inicio>1341914400000</fecha_inicio>
            <fecha_fin>1342000800000</fecha_fin>
            <num_max_reg>50</num_max_reg>
        </data>
        <dataSource>OfertasDS</dataSource>
        <operationType>fetch</operationType>
        <startRow>0</startRow>
        <endRow>75</endRow>
        <sortBy>fecha_asignacion_idc</sortBy>
        <textMatchStyle>exact</textMatchStyle>
        <componentId>isc_OfertasListGrid_1_0</componentId>
        <oldValues></oldValues>
    </request>

    Comment


      #3
      Any ideas why this is happening?

      Comment


        #4
        In the version 3.1 still happening .....

        Comment


          #5
          Hello,

          Any updates on this issue ? We have some server endpoints which expect the object tag to be included as the earlier poster. Is this change intentional ?

          Marko

          Comment


            #6
            Any updates

            Even we are facing the same issue after upgrading to Smartclient 9.0. Can you please share an update on this. Is this intentional or controlled by some other property now. A lot of server code is depending on this.
            Last edited by asadani; 18 Feb 2014, 23:05. Reason: corrected typo

            Comment


              #7
              Overriding the data source method transformRequest

              Code:
              @Override
                  public Object transformRequest(DSRequest dsRequest) {
              
                      // <editor-fold defaultstate="collapsed" desc="setTagName">
              
                      //Recupero la petición request.
                      Map mRequest  = JSOHelper.convertToMap(dsRequest.getData());
              
                      Record record = new Record();
                      record.setAttribute("pedido", mRequest);
              
                      //Finalmente reestasblezco el valor.
                      dsRequest.setData(record);
              
                      // </editor-fold>
              
                      return super.transformRequest(dsRequest);
                  }

              Comment

              Working...
              X