You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2022/12/23 21:37:01 UTC

[myfaces] branch main updated: fixed compile errors

This is an automated email from the ASF dual-hosted git repository.

tandraschko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/myfaces.git


The following commit(s) were added to refs/heads/main by this push:
     new 645ca3bd1 fixed compile errors
645ca3bd1 is described below

commit 645ca3bd1b81c820a85c25530afabdc989683679
Author: tandraschko <ta...@apache.org>
AuthorDate: Fri Dec 23 22:36:55 2022 +0100

    fixed compile errors
---
 .../quarkus/deployment/MyFacesProcessor.java       | 63 ++++++++++++++--------
 extensions/quarkus/showcase/pom.xml                |  3 +-
 .../quarkus/showcase/view/LazyCarDataModel.java    | 23 +++++---
 3 files changed, 59 insertions(+), 30 deletions(-)

diff --git a/extensions/quarkus/deployment/src/main/java/org/apache/myfaces/core/extensions/quarkus/deployment/MyFacesProcessor.java b/extensions/quarkus/deployment/src/main/java/org/apache/myfaces/core/extensions/quarkus/deployment/MyFacesProcessor.java
index 9fe875b27..59c54218e 100644
--- a/extensions/quarkus/deployment/src/main/java/org/apache/myfaces/core/extensions/quarkus/deployment/MyFacesProcessor.java
+++ b/extensions/quarkus/deployment/src/main/java/org/apache/myfaces/core/extensions/quarkus/deployment/MyFacesProcessor.java
@@ -41,7 +41,6 @@ import org.apache.myfaces.cdi.FacesApplicationArtifactHolder;
 import org.apache.myfaces.cdi.FacesArtifactProducer;
 import org.apache.myfaces.cdi.config.FacesConfigBeanHolder;
 import org.apache.myfaces.cdi.model.FacesDataModelManager;
-import org.apache.myfaces.cdi.view.ViewScopeBeanHolder;
 import org.apache.myfaces.cdi.view.ViewTransientScoped;
 import org.apache.myfaces.config.webparameters.MyfacesConfig;
 import org.apache.myfaces.config.annotation.CdiAnnotationProviderExtension;
@@ -58,8 +57,8 @@ import org.jboss.jandex.DotName;
 
 import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
 import io.quarkus.arc.deployment.BeanDefiningAnnotationBuildItem;
-import io.quarkus.arc.deployment.BeanRegistrarBuildItem;
 import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem;
+import io.quarkus.arc.deployment.ContextRegistrationPhaseBuildItem;
 import io.quarkus.deployment.annotations.BuildProducer;
 import io.quarkus.deployment.annotations.BuildStep;
 import io.quarkus.deployment.annotations.ExecutionTime;
@@ -246,26 +245,47 @@ class MyFacesProcessor
     }
 
     @BuildStep
-    void buildCdiScopes(BuildProducer<ContextRegistrarBuildItem> contextRegistrar) throws IOException
+    ContextRegistrationPhaseBuildItem.ContextConfiguratorBuildItem registerViewScopedContext(
+            ContextRegistrationPhaseBuildItem phase)
     {
-        contextRegistrar.produce(new ContextRegistrarBuildItem(registrationContext -> {
-            registrationContext.configure(ViewScoped.class)
-                    .normal()
-                    .contextClass(QuarkusViewScopeContext.class)
-                    .done();
-            registrationContext.configure(FacesScoped.class)
-                    .normal()
-                    .contextClass(QuarkusFacesScopeContext.class)
-                    .done();
-            registrationContext.configure(ViewTransientScoped.class)
-                    .normal()
-                    .contextClass(QuarkusViewTransientScopeContext.class)
-                    .done();
-            registrationContext.configure(FlowScoped.class)
-                    .normal()
-                    .contextClass(QuarkusFlowScopedContext.class)
-                    .done();
-        }, ViewScoped.class, FacesScoped.class, ViewTransientScoped.class, FlowScoped.class));
+            return new ContextRegistrationPhaseBuildItem.ContextConfiguratorBuildItem(
+                    phase.getContext()
+                            .configure(ViewScoped.class)
+                            .normal()
+                            .contextClass(QuarkusViewScopeContext.class));
+    }
+
+    @BuildStep
+    ContextRegistrationPhaseBuildItem.ContextConfiguratorBuildItem registerFacesScopedContext(
+            ContextRegistrationPhaseBuildItem phase)
+    {
+            return new ContextRegistrationPhaseBuildItem.ContextConfiguratorBuildItem(
+                    phase.getContext()
+                            .configure(FacesScoped.class)
+                            .normal()
+                            .contextClass(QuarkusFacesScopeContext.class));
+    }
+ 
+    @BuildStep
+    ContextRegistrationPhaseBuildItem.ContextConfiguratorBuildItem registerViewTransientScopedContext(
+            ContextRegistrationPhaseBuildItem phase)
+    {
+            return new ContextRegistrationPhaseBuildItem.ContextConfiguratorBuildItem(
+                    phase.getContext()
+                            .configure(ViewTransientScoped.class)
+                            .normal()
+                            .contextClass(QuarkusViewTransientScopeContext.class));
+    }
+
+    @BuildStep
+    ContextRegistrationPhaseBuildItem.ContextConfiguratorBuildItem registerFlowScopedContext(
+            ContextRegistrationPhaseBuildItem phase)
+    {
+            return new ContextRegistrationPhaseBuildItem.ContextConfiguratorBuildItem(
+                    phase.getContext()
+                            .configure(FlowScoped.class)
+                            .normal()
+                            .contextClass(QuarkusFlowScopedContext.class));
     }
 
     @BuildStep
@@ -338,7 +358,6 @@ class MyFacesProcessor
     @BuildStep
     @Record(ExecutionTime.STATIC_INIT)
     void buildFacesDataModels(MyFacesRecorder recorder,
-            BuildProducer<BeanRegistrarBuildItem> beanConfigurators,
             CombinedIndexBuildItem combinedIndex) throws IOException
     {
         for (AnnotationInstance ai : combinedIndex.getIndex()
diff --git a/extensions/quarkus/showcase/pom.xml b/extensions/quarkus/showcase/pom.xml
index 02ea0fbc8..9335c2bc0 100644
--- a/extensions/quarkus/showcase/pom.xml
+++ b/extensions/quarkus/showcase/pom.xml
@@ -59,7 +59,8 @@
         <dependency>
             <groupId>org.primefaces</groupId>
             <artifactId>primefaces</artifactId>
-            <version>8.0</version>
+            <version>12.0.0</version>
+            <classifier>jakarta</classifier>
         </dependency>
         <dependency>
             <groupId>javax.validation</groupId>
diff --git a/extensions/quarkus/showcase/src/main/java/org/apache/myfaces/core/extensions/quarkus/showcase/view/LazyCarDataModel.java b/extensions/quarkus/showcase/src/main/java/org/apache/myfaces/core/extensions/quarkus/showcase/view/LazyCarDataModel.java
index 224c40361..bab071b1b 100644
--- a/extensions/quarkus/showcase/src/main/java/org/apache/myfaces/core/extensions/quarkus/showcase/view/LazyCarDataModel.java
+++ b/extensions/quarkus/showcase/src/main/java/org/apache/myfaces/core/extensions/quarkus/showcase/view/LazyCarDataModel.java
@@ -25,6 +25,7 @@ import java.util.List;
 import java.util.Map;
 import org.primefaces.model.FilterMeta;
 import org.primefaces.model.LazyDataModel;
+import org.primefaces.model.SortMeta;
 import org.primefaces.model.SortOrder;
 
 /**
@@ -50,23 +51,23 @@ public class LazyCarDataModel extends LazyDataModel<Car> {
     }
 
     @Override
-    public Object getRowKey(Car car) {
+    public String getRowKey(Car car) {
         return car.getId();
     }
 
     @Override
-    public List<Car> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, FilterMeta> filters) {
+    public List<Car> load(int first, int pageSize, Map<String, SortMeta> sortMeta, Map<String, FilterMeta> filterMeta) {
         List<Car> data = new ArrayList<Car>();
 
         //filter
         for (Car car : datasource) {
             boolean match = true;
 
-            if (filters != null) {
-                for (Iterator<String> it = filters.keySet().iterator(); it.hasNext();) {
+            if (filterMeta != null) {
+                for (Iterator<String> it = filterMeta.keySet().iterator(); it.hasNext();) {
                     try {
                         String filterProperty = it.next();
-                        Object filterValue = filters.get(filterProperty).getFilterValue();
+                        Object filterValue = filterMeta.get(filterProperty).getFilterValue();
                         String fieldValue = String.valueOf(car.getClass().getField(filterProperty).get(car));
 
                         if (filterValue == null || fieldValue.startsWith(filterValue.toString())) {
@@ -89,8 +90,11 @@ public class LazyCarDataModel extends LazyDataModel<Car> {
         }
 
         //sort
-        if (sortField != null) {
-            Collections.sort(data, new LazySorter(sortField, sortOrder));
+        if (sortMeta != null) {
+            for (SortMeta current : sortMeta.values())
+            { 
+                Collections.sort(data, new LazySorter(current.getField(), current.getOrder()));
+            }
         }
 
         //rowCount
@@ -110,4 +114,9 @@ public class LazyCarDataModel extends LazyDataModel<Car> {
             return data;
         }
     }
+
+    @Override
+    public int count(Map<String, FilterMeta> map) {
+        return 0;
+    }
 }