DataTable migration to PF 10

UI Components for JSF
Post Reply
User avatar
afterbit
Posts: 100
Joined: 19 Mar 2012, 23:51
Contact:

10 Sep 2021, 16:53

Hello,

I want to migrate my website from PF 6 to PF 10.

I have a problem with the DataTable filter.
I do this (filter) by building an SQL query ..
I saw the LazyCustomerDataModel example in the PF showcase (https://www.primefaces.org/showcase/ui/ ... fwid=dbc51) where filtering is done with streams java ..

so .. how can i convert this piece of code to create a sql query?

Code: Select all

private boolean filter(FacesContext context, Collection<FilterMeta> filterBy, Object o) {
        boolean matching = true;

        for (FilterMeta filter : filterBy) {
            FilterConstraint constraint = filter.getConstraint();
            Object filterValue = filter.getFilterValue();

            try {
                Object columnValue = String.valueOf(o.getClass().getField(filter.getField()).get(o));
                matching = constraint.isMatching(context, columnValue, filterValue, LocaleUtils.getCurrentLocale());
            } catch (ReflectiveOperationException e) {
                matching = false;
            }

            if (!matching) {
                break;
            }
        }

        return matching;
    }
thanks!

christophs78
Posts: 85
Joined: 01 Mar 2018, 12:29

11 Sep 2021, 22:32

Should not be that much different to PF6. You should already have code for PF6 which does your query via JPA, jOOQ, JDBC, whatever.
The main difference between PF6 and PF10 is how PrimeFaces passes sort- and filter-info to your implementation of LazyDataModel.

User avatar
afterbit
Posts: 100
Joined: 19 Mar 2012, 23:51
Contact:

12 Sep 2021, 09:30

do you mean the source code of the PF 6 showcase ?

christophs78
Posts: 85
Joined: 01 Mar 2018, 12:29

13 Sep 2021, 16:32

The sourcecode of your "website".

NOTiFY
Posts: 393
Joined: 25 May 2016, 22:57

13 Sep 2021, 16:53

afterbit wrote:
10 Sep 2021, 16:53
I want to migrate my website from PF 6 to PF 10.
Do you have your 'application' running & working on PF 6 with your Entities using SQL or NoSQL?

Which Server is your 'application' deployed on (WildFly, GlassFish, Spring Boot, Apache Tomcat etc.) ?
PF 13.0.0--Jakarta. Jakarta Faces 4.0.1/Kotlin Multiplatform 1.9.10
Mojarra 4.0.2, OmniFaces 4.2
WildFly 29.0.1.Final 'preview' Jakarta EE 10.0.0
JDK 20.0.2, Kotlin 1.9.10, Gradle 8.3 Groovy DSL, MongoDB 7.0.0
IntelliJ IDEA 2023.2.1, macOS Ventura 13.5.1

User avatar
afterbit
Posts: 100
Joined: 19 Mar 2012, 23:51
Contact:

13 Sep 2021, 17:23

NOTiFY wrote:
13 Sep 2021, 16:53
afterbit wrote:
10 Sep 2021, 16:53
I want to migrate my website from PF 6 to PF 10.
Do you have your 'application' running & working on PF 6 with your Entities using SQL or NoSQL?

Which Server is your 'application' deployed on (WildFly, GlassFish, Spring Boot, Apache Tomcat etc.) ?
Entity with SQL..
Server Tomcat 9

NOTiFY
Posts: 393
Joined: 25 May 2016, 22:57

13 Sep 2021, 19:07

So what's the issue? Replace the JAR.

I've moved from PF 5, 6, 7, 8 & 10, Very little effort to Upgrade/Migrate ...
PF 13.0.0--Jakarta. Jakarta Faces 4.0.1/Kotlin Multiplatform 1.9.10
Mojarra 4.0.2, OmniFaces 4.2
WildFly 29.0.1.Final 'preview' Jakarta EE 10.0.0
JDK 20.0.2, Kotlin 1.9.10, Gradle 8.3 Groovy DSL, MongoDB 7.0.0
IntelliJ IDEA 2023.2.1, macOS Ventura 13.5.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 27 guests