I have an issue with previously saved filters.
In my project I have an entity(NewEntity_1), which have an attribute(a) of another entity(NewEntity). Both entities extend BaseIntegerIdEntity.
I open the browser of NewEntity_1 and create a filter of the attribute ‘A’. I choose the NewEntity named ‘asd’.
All works fine.
After this I save the filter with values.
I reopen the browser, choose the previously saved filter from the filters. I get this error:
java.lang.IllegalArgumentException: Invalid UUID string: 1
at java.util.UUID.fromString(UUID.java:194)
at com.haulmont.cuba.gui.components.filter.Param.loadEntity(Param.java:381)
at com.haulmont.cuba.gui.components.filter.Param.parseSingleValue(Param.java:333)
at com.haulmont.cuba.gui.components.filter.Param.parseValue(Param.java:325)
at com.haulmont.cuba.gui.components.filter.condition.AbstractCondition.resolveParam(AbstractCondition.java:197)
at com.haulmont.cuba.gui.components.filter.condition.AbstractCondition.(AbstractCondition.java:140)
at com.haulmont.cuba.gui.components.filter.condition.PropertyCondition.(PropertyCondition.java:55)
at com.haulmont.cuba.gui.components.filter.FilterParserImpl.createCondition(FilterParserImpl.java:94)
at com.haulmont.cuba.gui.components.filter.FilterParserImpl.recursiveFromXml(FilterParserImpl.java:63)
at com.haulmont.cuba.gui.components.filter.FilterParserImpl.getConditions(FilterParserImpl.java:49)
at com.haulmont.cuba.gui.components.filter.FilterDelegateImpl.setFilterEntity(FilterDelegateImpl.java:538)
at com.haulmont.cuba.gui.components.filter.FilterDelegateImpl$7.actionPerform(FilterDelegateImpl.java:1116)
…
The problem:
Param.java:381
LoadContext ctx = new LoadContext(javaClass).setId(UUID.fromString(id));
It seems you’ve confused the visual component Filter and the datasource query filter. You don’t need to modify the screen descriptor, just select “Save with values” and then “Make default” in the Filter editor in your application, and the browse screen will always be opened with the filtered data.
Thanks for your reply.
I appreciate you trying to help, but I don’t see why making it default would change anything
(for the record we did make the same filter default and that only made the error always pop up when the browse screen is opened and the table not filtered at all)
I thought I clearly stated that I didn’t change anything in the screen descriptor…
That’s the xml that was saved in the db in the sec_filter table…
But as usual if there is a bug I have to hack around it 'cause no version upgrade fixes it
I ended up writing a BeforeInsertEntityListener<FilterEntity> and manualy changeing the filter xml. It looks awful but at least it’s working and not throwing errors.
If anyone needs it: