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

    Population of TO bean for a custom DS operation


    we extensively use Spring services for our DataSources. One neat thing is the ability for smartgwt to match the data values to a TO in the method call, like this:

    public DSResponse add(UserReporterTO to, DSRequest request)

    However, i just tried to do the same for a custom operation, and it seems that the data fields are not matched.

    datasource (sorry for bad formatting, couldn't make it work):
    <operationBinding operationType="custom" operationId="send"> <serverMethod>send</serverMethod> </operationBinding>
    <serverObject lookupStyle="spring" bean="messageWebService"></serverObject>
    In the client i do something like this:

     Map dataMap = form.getValues();  
     messageDS.performCustomOperation("send", new Record(dataMap), new NubaOKDSCallback() {     @Override     public void doExecute(ResponseData rData, DSResponse response, Object o, DSRequest dsRequest) {
    and on the server i have
     public NubaDSResponse send(Map values, UserMessageTO to)
    The params in the values have the same names as the fields in the to. The TO object is created, but all values are null even though they exist in the map.

    Is there any way to do what i want, so that i don't have to manually drag out the parameters from the map?

    Last edited by mathias; 9 Apr 2018, 00:05.

    I noticed that i kind of asked this in a related thread. This is however a more detailed explanation, so perhaps good for others that wonder the same thing. Would be great to hear if there's any way to accomplish this without doing stuff "manually" in my code.


      For a "custom" operation, it's not clear that the framework should be auto-populating beans; we don't even make an assumption that the data for a "custom" operation consists of DataSource records.

      Further, as we already covered, it's just a single call to DataTools.setProperties() to populate a bean given a Map, if indeed your "custom" operation happens to do things with beans.


        OK, fair enough. Thanks for quick response.