java - data filtering from db to match with UI -
this question more of approach question. having more theory. apologies that.
i have string getting api call queryparam in method. rest call. string has columns name of table present in ui. lets string this:
string columnsname= "columns1,column2,column3,column4"
now have method call backend. there list of object. these objects ones going fill in rows table columns date have got.
problem that, cannot change db call exact columns want. db call getting columns , in fixed order. columns getting front end might have less no of columns , in different order. data getting backend list of object, have iterate through , use writer make csv out of that.
csvcompletedata getting backend. list of object. objectdto dto object.
for (object csvrowdata : csvcompletedata) { objectdto dtoobj = (objectdto )csvrowdata; writer.append(dtoobj.getip()); writer.append(','); writer.append(dtoobj.getname()); writer.append(','); writer.append(stringescapeutils.escapecsv(dtoobj.getdescription())); writer.append(','); . . . . . total 10 rows }
so if have 4 columns coming ui, should take 4 columns in loop rather 10. should best approach filter out data backend match column values , order getting front end
just add, data in range of 100000 rows. should performance wise also.
hope clear.
Comments
Post a Comment