Binding multiple select where option values may contain commas in Spring 3 - spring

We are having an issue with binding a multiple select element when the option values contain commas. We have tried binding to both a String and to a List<String>, but have issues with both.
When a multiple select element is posted, the value of each selected option is passed in a separate request parameter, all with the same name. For example, if the select element name is "code", the parameters might look like this:
code=ABC
code=A,B
code=XYZ
When binding to a String, Spring will automatically join these values into a comma-separated string. That is obviously an issue if one or more of the values contains a comma.
When binding to a List<String>, things work fine when multiple options are selected. In that case, Spring creates a List with an entry for each selected option. But if only one option is selected, Spring assumes the value is a comma-separated list and will split it into multiple entries.
Is there a way to tell Spring to use a different character than a comma when binding to a String? Is there a way to tell Spring not to split a single value when binding to a List<String>? Or is there another way to deal with this?

I believe this thread is related to your issue: How to prevent parameter binding from interpreting commas in Spring 3.0.5?. This Spring issue may also be helpful: https://jira.springsource.org/browse/SPR-7963
The solution provided at https://stackoverflow.com/a/5239841/1259928, which details how to create a new conversion service which uses a different string separator and wiring it into Spring config should do the trick.

Related

How to get the list after splitting the string using splitPart in jOOQ?

I have a field tags which is a string formed by comma-separated strings.
When I try to get the data from the database I want them to be separated.
jsonObject(
.......
key("tags").value(splitPart(TABLENAME.TAGS, ",", 1))
.......
)
From the above, I can only get one value but I want the entire array.
What should I do to get the entire array after splitting?
Unfortunately, the PostgreSQL SPLIT_PART function doesn't allow for accessing the entire split array, only a "part". You probably want to use string_to_array instead? That will produce a PostgreSQL array, which can be converted to a JSON(B) using the array_to_json function.
jOOQ does not yet support the latter (see #12841), but as always, when jOOQ doesn't know a vendor-specific SQL feature, you can easily resort to using plain SQL templating.

NiFi LookupRecord for multiple fields

I have a requirement of filtering the records from the source file if the value of few attributes (e.g., Emp_number, Manager_id, associate_num) matches with the list of values available in a lookup file (e.g., column name ID in a csv lookup file). For this, I have used NiFi LookupRecord processor (version 1.5). Added dynamic property in the lookup processor as "key" and gave the recordpath value as /Emp_number. It is working fine. But if i add additional dynamic properties like "key1": /Manager_id and "key2": /associate_num, it is not filtering the records which has matching values in column Manager_id and associate_num with lookup file.
As per the definition in NiFi document, my understanding is multiple field lookup is supported.
"The "coordinates" to use for looking up a value in the Lookup Service are defined by adding a user-defined property. Each property that is added will have an entry added to a Map, where the name of the property becomes the Map Key and the value returned by the RecordPath becomes the value for that key."
Could any one please help me on what am missing here.
The LookupRecord processor will take all of the user defined properties and create a coordinates Map and then call a LookupService.
The LookupService has a method like:
lookup(final Map<String, Object> coordinates)
Each implementation of LookupService may work differently and may or may not accept multiple coordinates.
There is a method on the service Set<String> getRequiredKeys(); where the service defines the required keys that are expected to be in the coordinates Map.
For example, CsvRecordLookupService returns a set of keys with one string in it called "key", so that service only supports a single coordinate.
I haven't gone through all the services, but many of them only support a single coordinate called "key".

Search box supports multiple search with comma separated vales

in Search box which allows to give one id for search. I want to make this search box that allows me to give multiple comma separated inputs like id1,id2,id3 if I click search then 3 records should pop up.
I am using telerikUI for the first time... is there any component that supports this functionality? I know I can achieve this in c# using split function. Looking how I can do in telerik.ui
We can add parameter which takes multiple values for this purpose. Here I have demonstrated it with a parameter(Organization)
Add multivalued Parameter
Add datasource to get list
Add display member and value member
Configure datasource

How to get Lookup and Match Column from single source table for tFuzzyMatch in Talend

I am using Talend to do a fuzzy match, I want to do a fuzzy match between two columns of the same table. But tFuzzyMatch will get Match Column from one input and Look up from another input.
What I need is that I want get Match column and lookup from single source.
I am using Talend 5.5.1
You can perform in-line fuzzy matching by using the tMatchGroup component. This will search for groups of matching/potentially matching records inside the single flow.
The tMatchGroup also allows for the output to be split by match likelihood that is specified by thresholds, giving an output for confident matches, suspect matches and rows that are unique.
The tMatchGroup component also has a graphical wizard showing expected match groups from a sample taken from the input data which can be useful when attempting to tweak the matching algorithms and parameters.
For example, a very basic job using the tMatchGroup component may look like this:
Where the tMatchGroup is configured so that a match group must have an exact age but will apply Jaro-Winkler to the name columns:
You can see in the above screenshot that the tMatchGroup has a match group containing 2 records, one with the name "Tom" and the other with the name "Thom" and they both have the exact same age.
This can be achieved by creating a duplicate input source, one used as the main source while the other used as a lookup, the rest is the same configuration as you would set otherwise.
In the tFuzzyMatch settings, you can compare the two columns within the same input (which is not tricked by using two input components that point to the same source) by choosing the Lookup and Matching Column settings inside the tFuzzyMatch components to point to the two columns you need to compare, one from each source (which logically are from the same source).
Hope it helps.

spring data jpa multiple sorting

I am using spring data jpa and JQGrid. I need response based on multiple sort parameters.
I tried using sort parameter=column a,column b and sort order=asc but I am getting an exception
:No property column a,column b found in pojo.
It works if I would pass either of one columns as sort parameter.
Code:
Pageable pageable = JPAUtility.constructPageSpecification(pageNumber, rowsPerPage, sortColName, sortOrder);
How can I pass multiple column names in sortColName parameter?
In Spring Data you just need to add Sort parameter into findBy* method. Sort object has got a couple constructors, e.g.
Sort(Direction direction, String... properties)
which is probably exactly what you need. If you need to specify different directions for various properties then you can use
Sort(Order... orders)
where Order has property and direction: Order(Direction direction, String property)

Resources