diff --git a/booking-faces/pom.xml b/booking-faces/pom.xml
index 4882f67..f3c3b7e 100644
--- a/booking-faces/pom.xml
+++ b/booking-faces/pom.xml
@@ -28,6 +28,16 @@
org.springframework
spring-orm
+
+ org.springframework.webflow
+ spring-binding
+ ${webflow.version}
+
+
+ org.springframework.webflow
+ spring-webflow
+ ${webflow.version}
+
org.springframework.webflow
spring-faces
@@ -43,38 +53,41 @@
- javax.servlet
- javax.servlet-api
+ jakarta.servlet
+ jakarta.servlet-api
${servlet.version}
provided
- com.sun.faces
- jsf-api
- ${mojarra.version}
-
-
- com.sun.faces
- jsf-impl
+ org.glassfish
+ jakarta.faces
${mojarra.version}
+
+ jakarta.enterprise
+ jakarta.enterprise.cdi-api
+ provided
+ ${cdi-api}
+
+
+ org.jboss.weld.servlet
+ weld-servlet-shaded
+ runtime
+ ${weld.version}
+
org.primefaces
primefaces
${primefaces.version}
+ jakarta
@@ -83,6 +96,11 @@
${hsqldb.version}
runtime
+
+ org.hibernate
+ hibernate-core-jakarta
+ ${hibernate.version}
+
org.hibernate
hibernate-entitymanager
@@ -90,7 +108,7 @@
- org.hibernate
+ org.hibernate.validator
hibernate-validator
${hibernate-validator.version}
@@ -157,8 +175,8 @@
maven-compiler-plugin
3.7.0
- 1.8
- 1.8
+ 17
+ 17
diff --git a/booking-faces/src/main/java/org/springframework/webflow/samples/booking/Booking.java b/booking-faces/src/main/java/org/springframework/webflow/samples/booking/Booking.java
index 11900ce..661212b 100755
--- a/booking-faces/src/main/java/org/springframework/webflow/samples/booking/Booking.java
+++ b/booking-faces/src/main/java/org/springframework/webflow/samples/booking/Booking.java
@@ -6,18 +6,18 @@ import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
-import javax.persistence.Basic;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
-import javax.validation.constraints.Future;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
+import jakarta.persistence.Basic;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+import jakarta.persistence.Transient;
+import jakarta.validation.constraints.Future;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Pattern;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.binding.message.MessageBuilder;
diff --git a/booking-faces/src/main/java/org/springframework/webflow/samples/booking/Hotel.java b/booking-faces/src/main/java/org/springframework/webflow/samples/booking/Hotel.java
index 7154295..5782507 100755
--- a/booking-faces/src/main/java/org/springframework/webflow/samples/booking/Hotel.java
+++ b/booking-faces/src/main/java/org/springframework/webflow/samples/booking/Hotel.java
@@ -3,10 +3,10 @@ package org.springframework.webflow.samples.booking;
import java.io.Serializable;
import java.math.BigDecimal;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.Id;
/**
* A hotel where users may book stays.
diff --git a/booking-faces/src/main/java/org/springframework/webflow/samples/booking/HotelLazyDataModel.java b/booking-faces/src/main/java/org/springframework/webflow/samples/booking/HotelLazyDataModel.java
index 7c07ddc..ae996f9 100644
--- a/booking-faces/src/main/java/org/springframework/webflow/samples/booking/HotelLazyDataModel.java
+++ b/booking-faces/src/main/java/org/springframework/webflow/samples/booking/HotelLazyDataModel.java
@@ -5,6 +5,7 @@ import java.util.Map;
import org.primefaces.model.FilterMeta;
import org.primefaces.model.LazyDataModel;
+import org.primefaces.model.SortMeta;
import org.primefaces.model.SortOrder;
import org.springframework.beans.factory.annotation.Autowired;
@@ -32,9 +33,21 @@ public class HotelLazyDataModel extends LazyDataModel {
}
@Override
- public List load(int first, int pageSize, String sortField, SortOrder order, Map filterBy) {
+ public int count(Map filterBy) {
+ return bookingService.getNumberOfHotels(this.searchCriteria);
+ }
+
+ @Override
+ public List load(int first, int pageSize, Map sortBy, Map filterBy) {
this.searchCriteria.setCurrentPage(first / pageSize + 1);
- this.hotels = bookingService.findHotels(searchCriteria, first, sortField, order.equals(SortOrder.ASCENDING));
+ String sortField = null;
+ SortOrder sortOrder = SortOrder.ASCENDING;
+ if (!sortBy.isEmpty()) {
+ SortMeta sortMeta = sortBy.values().iterator().next();
+ sortField = sortMeta.getField();
+ sortOrder = sortMeta.getOrder();
+ }
+ this.hotels = bookingService.findHotels(searchCriteria, first, sortField, !sortOrder.equals(SortOrder.DESCENDING));
return hotels;
}
@@ -49,8 +62,8 @@ public class HotelLazyDataModel extends LazyDataModel {
}
@Override
- public Object getRowKey(Hotel hotel) {
- return hotel.getId();
+ public String getRowKey(Hotel hotel) {
+ return String.valueOf(hotel.getId());
}
@Override
diff --git a/booking-faces/src/main/java/org/springframework/webflow/samples/booking/JpaBookingService.java b/booking-faces/src/main/java/org/springframework/webflow/samples/booking/JpaBookingService.java
index 460b63e..f6efa96 100755
--- a/booking-faces/src/main/java/org/springframework/webflow/samples/booking/JpaBookingService.java
+++ b/booking-faces/src/main/java/org/springframework/webflow/samples/booking/JpaBookingService.java
@@ -3,8 +3,8 @@ package org.springframework.webflow.samples.booking;
import java.io.Serializable;
import java.util.List;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.PersistenceContext;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
diff --git a/booking-faces/src/main/java/org/springframework/webflow/samples/booking/ReferenceData.java b/booking-faces/src/main/java/org/springframework/webflow/samples/booking/ReferenceData.java
index f4f1339..22d6b0c 100644
--- a/booking-faces/src/main/java/org/springframework/webflow/samples/booking/ReferenceData.java
+++ b/booking-faces/src/main/java/org/springframework/webflow/samples/booking/ReferenceData.java
@@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
-import javax.faces.model.SelectItem;
+import jakarta.faces.model.SelectItem;
import org.springframework.stereotype.Service;
@@ -23,17 +23,17 @@ public class ReferenceData {
public List getBedOptions() {
if (bedOptions == null) {
- bedOptions = new ArrayList();
- bedOptions.add(new SelectItem(new Integer(1), "One king-size bed"));
- bedOptions.add(new SelectItem(new Integer(2), "Two double beds"));
- bedOptions.add(new SelectItem(new Integer(3), "Three beds"));
+ bedOptions = new ArrayList<>();
+ bedOptions.add(new SelectItem(1, "One king-size bed"));
+ bedOptions.add(new SelectItem(2, "Two double beds"));
+ bedOptions.add(new SelectItem(3, "Three beds"));
}
return bedOptions;
}
public List getSmokingOptions() {
if (smokingOptions == null) {
- smokingOptions = new ArrayList();
+ smokingOptions = new ArrayList<>();
smokingOptions.add(new SelectItem(Boolean.TRUE, "Smoking"));
smokingOptions.add(new SelectItem(Boolean.FALSE, "Non-Smoking"));
}
@@ -42,42 +42,42 @@ public class ReferenceData {
public List getCreditCardExpMonths() {
if (creditCardExpMonths == null) {
- creditCardExpMonths = new ArrayList();
- creditCardExpMonths.add(new SelectItem(new Integer(1), "Jan"));
- creditCardExpMonths.add(new SelectItem(new Integer(2), "Feb"));
- creditCardExpMonths.add(new SelectItem(new Integer(3), "Mar"));
- creditCardExpMonths.add(new SelectItem(new Integer(4), "Apr"));
- creditCardExpMonths.add(new SelectItem(new Integer(5), "May"));
- creditCardExpMonths.add(new SelectItem(new Integer(6), "Jun"));
- creditCardExpMonths.add(new SelectItem(new Integer(7), "Jul"));
- creditCardExpMonths.add(new SelectItem(new Integer(8), "Aug"));
- creditCardExpMonths.add(new SelectItem(new Integer(9), "Sep"));
- creditCardExpMonths.add(new SelectItem(new Integer(10), "Oct"));
- creditCardExpMonths.add(new SelectItem(new Integer(11), "Nov"));
- creditCardExpMonths.add(new SelectItem(new Integer(12), "Dec"));
+ creditCardExpMonths = new ArrayList<>();
+ creditCardExpMonths.add(new SelectItem(1, "Jan"));
+ creditCardExpMonths.add(new SelectItem(2, "Feb"));
+ creditCardExpMonths.add(new SelectItem(3, "Mar"));
+ creditCardExpMonths.add(new SelectItem(4, "Apr"));
+ creditCardExpMonths.add(new SelectItem(5, "May"));
+ creditCardExpMonths.add(new SelectItem(6, "Jun"));
+ creditCardExpMonths.add(new SelectItem(7, "Jul"));
+ creditCardExpMonths.add(new SelectItem(8, "Aug"));
+ creditCardExpMonths.add(new SelectItem(9, "Sep"));
+ creditCardExpMonths.add(new SelectItem(10, "Oct"));
+ creditCardExpMonths.add(new SelectItem(11, "Nov"));
+ creditCardExpMonths.add(new SelectItem(12, "Dec"));
}
return creditCardExpMonths;
}
public List getCreditCardExpYears() {
if (creditCardExpYears == null) {
- creditCardExpYears = new ArrayList();
+ creditCardExpYears = new ArrayList<>();
Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR);
- creditCardExpYears.add(new SelectItem(new Integer(year), String.valueOf(year++)));
- creditCardExpYears.add(new SelectItem(new Integer(year), String.valueOf(year++)));
- creditCardExpYears.add(new SelectItem(new Integer(year), String.valueOf(year++)));
- creditCardExpYears.add(new SelectItem(new Integer(year), String.valueOf(year++)));
- creditCardExpYears.add(new SelectItem(new Integer(year), String.valueOf(year++))); }
+ creditCardExpYears.add(new SelectItem(year, String.valueOf(year++)));
+ creditCardExpYears.add(new SelectItem(year, String.valueOf(year++)));
+ creditCardExpYears.add(new SelectItem(year, String.valueOf(year++)));
+ creditCardExpYears.add(new SelectItem(year, String.valueOf(year++)));
+ creditCardExpYears.add(new SelectItem(year, String.valueOf(year++))); }
return creditCardExpYears;
}
public List getPageSizeOptions() {
if (pageSizeOptions == null) {
- pageSizeOptions = new ArrayList();
- pageSizeOptions.add(new SelectItem(new Integer(5), "5"));
- pageSizeOptions.add(new SelectItem(new Integer(10), "10"));
- pageSizeOptions.add(new SelectItem(new Integer(20), "20"));
+ pageSizeOptions = new ArrayList<>();
+ pageSizeOptions.add(new SelectItem(5, "5"));
+ pageSizeOptions.add(new SelectItem(10, "10"));
+ pageSizeOptions.add(new SelectItem(20, "20"));
}
return pageSizeOptions;
}
diff --git a/booking-faces/src/main/java/org/springframework/webflow/samples/booking/User.java b/booking-faces/src/main/java/org/springframework/webflow/samples/booking/User.java
index 5b4789d..aeba312 100755
--- a/booking-faces/src/main/java/org/springframework/webflow/samples/booking/User.java
+++ b/booking-faces/src/main/java/org/springframework/webflow/samples/booking/User.java
@@ -2,9 +2,9 @@ package org.springframework.webflow.samples.booking;
import java.io.Serializable;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.Table;
/**
* A user who can book hotels.
diff --git a/booking-faces/src/main/java/org/springframework/webflow/samples/booking/config/DataAccessConfig.java b/booking-faces/src/main/java/org/springframework/webflow/samples/booking/config/DataAccessConfig.java
index 7167a1b..c424c1a 100644
--- a/booking-faces/src/main/java/org/springframework/webflow/samples/booking/config/DataAccessConfig.java
+++ b/booking-faces/src/main/java/org/springframework/webflow/samples/booking/config/DataAccessConfig.java
@@ -2,7 +2,7 @@ package org.springframework.webflow.samples.booking.config;
import java.util.Collections;
-import javax.persistence.EntityManagerFactory;
+import jakarta.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.springframework.context.annotation.Bean;
diff --git a/booking-faces/src/main/java/org/springframework/webflow/samples/booking/config/DispatcherServletInitializer.java b/booking-faces/src/main/java/org/springframework/webflow/samples/booking/config/DispatcherServletInitializer.java
index b673cdd..36c6f1e 100644
--- a/booking-faces/src/main/java/org/springframework/webflow/samples/booking/config/DispatcherServletInitializer.java
+++ b/booking-faces/src/main/java/org/springframework/webflow/samples/booking/config/DispatcherServletInitializer.java
@@ -1,8 +1,8 @@
package org.springframework.webflow.samples.booking.config;
-import javax.servlet.Filter;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
+import jakarta.servlet.Filter;
+import jakarta.servlet.ServletContext;
+import jakarta.servlet.ServletException;
import org.springframework.web.filter.CharacterEncodingFilter;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
@@ -34,13 +34,13 @@ public class DispatcherServletInitializer extends AbstractAnnotationConfigDispat
public void onStartup(ServletContext servletContext) throws ServletException {
// Use JSF view templates saved as *.xhtml, for use with Facelets
- servletContext.setInitParameter("javax.faces.DEFAULT_SUFFIX", ".xhtml");
+ servletContext.setInitParameter("jakarta.faces.DEFAULT_SUFFIX", ".xhtml");
// Enable special Facelets debug output during development
- servletContext.setInitParameter("javax.faces.PROJECT_STAGE", "Development");
+ servletContext.setInitParameter("jakarta.faces.PROJECT_STAGE", "Development");
// Causes Facelets to refresh templates during development
- servletContext.setInitParameter("javax.faces.FACELETS_REFRESH_PERIOD", "1");
+ servletContext.setInitParameter("jakarta.faces.FACELETS_REFRESH_PERIOD", "1");
// Declare Spring Security Facelets tag library
- servletContext.setInitParameter("javax.faces.FACELETS_LIBRARIES", "/WEB-INF/springsecurity.taglib.xml");
+ servletContext.setInitParameter("jakarta.faces.FACELETS_LIBRARIES", "/WEB-INF/springsecurity.taglib.xml");
// Comment out if not using Mojarra
servletContext.addListener(com.sun.faces.config.ConfigureListener.class);
diff --git a/booking-faces/src/main/java/org/springframework/webflow/samples/booking/config/SecurityConfig.java b/booking-faces/src/main/java/org/springframework/webflow/samples/booking/config/SecurityConfig.java
index c781c9b..5798901 100644
--- a/booking-faces/src/main/java/org/springframework/webflow/samples/booking/config/SecurityConfig.java
+++ b/booking-faces/src/main/java/org/springframework/webflow/samples/booking/config/SecurityConfig.java
@@ -1,18 +1,20 @@
package org.springframework.webflow.samples.booking.config;
+import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
-import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.core.userdetails.User;
+import org.springframework.security.provisioning.InMemoryUserDetailsManager;
+import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.savedrequest.HttpSessionRequestCache;
@Configuration
@EnableWebSecurity
-public class SecurityConfig extends WebSecurityConfigurerAdapter {
+public class SecurityConfig {
- @Override
- protected void configure(HttpSecurity http) throws Exception {
+ @Bean
+ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.formLogin()
.loginPage("/spring/login")
@@ -26,16 +28,16 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.and()
.requestCache()
.requestCache(new HttpSessionRequestCache());
+ return http.build();
}
- @Override
- @SuppressWarnings("deprecation")
- protected void configure(AuthenticationManagerBuilder auth) throws Exception {
- auth.inMemoryAuthentication()
- .withUser("keith").password("{MD5}417c7382b16c395bc25b5da1398cf076").roles("USER", "SUPERVISOR").and()
- .withUser("erwin").password("{MD5}12430911a8af075c6f41c6976af22b09").roles("USER", "SUPERVISOR").and()
- .withUser("jeremy").password("{MD5}57c6cbff0d421449be820763f03139eb").roles("USER").and()
- .withUser("scott").password("{MD5}942f2339bf50796de535a384f0d1af3e").roles("USER");
+ @Bean
+ public InMemoryUserDetailsManager userDetailsService() {
+ return new InMemoryUserDetailsManager(
+ User.withUsername("keith").password("{MD5}417c7382b16c395bc25b5da1398cf076").roles("USER", "SUPERVISOR").build(),
+ User.withUsername("erwin").password("{MD5}12430911a8af075c6f41c6976af22b09").roles("USER", "SUPERVISOR").build(),
+ User.withUsername("jeremy").password("{MD5}57c6cbff0d421449be820763f03139eb").roles("USER").build(),
+ User.withUsername("scott").password("{MD5}942f2339bf50796de535a384f0d1af3e").roles("USER").build());
}
}
diff --git a/booking-faces/src/main/resources/JsfMessageResources.properties b/booking-faces/src/main/resources/JsfMessageResources.properties
index 497baf8..76c25c3 100644
--- a/booking-faces/src/main/resources/JsfMessageResources.properties
+++ b/booking-faces/src/main/resources/JsfMessageResources.properties
@@ -3,4 +3,4 @@
# the {0} is the Bean Validation constraint message (e.g. "may not be empty") and {1} is the
# field name or the field label if defined (e.g. "First name").
#
-javax.faces.validator.BeanValidator.MESSAGE={1} {0}
\ No newline at end of file
+jakarta.faces.validator.BeanValidator.MESSAGE={1} {0}
\ No newline at end of file
diff --git a/booking-faces/src/main/webapp/WEB-INF/beans.xml b/booking-faces/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..20ac74c
--- /dev/null
+++ b/booking-faces/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/booking-faces/src/test/java/org/springframework/webflow/samples/booking/MainFlowExecutionTests.java b/booking-faces/src/test/java/org/springframework/webflow/samples/booking/MainFlowExecutionTests.java
index 29811dd..f0a4827 100644
--- a/booking-faces/src/test/java/org/springframework/webflow/samples/booking/MainFlowExecutionTests.java
+++ b/booking-faces/src/test/java/org/springframework/webflow/samples/booking/MainFlowExecutionTests.java
@@ -3,7 +3,7 @@ package org.springframework.webflow.samples.booking;
import java.util.ArrayList;
import java.util.List;
-import javax.faces.model.DataModel;
+import jakarta.faces.model.DataModel;
import org.easymock.EasyMock;
import org.springframework.binding.mapping.Mapper;
diff --git a/pom.xml b/pom.xml
index 303e673..2ef28c1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,8 +10,8 @@
booking-mvc
-
@@ -19,20 +19,22 @@
3.4
+ 4.0.1
2.5.1
5.6.15.Final
8.0.0.Final
2.2.3
11.0.11
- 3.0.0
- 2.0.0
+ 3.1.0
+ 3.0.0
4.13.2
2.14.0
- 2.2.20
- 2.3.8
- 8.0
+ 4.0.2
+ 4.0.0
+ 11.0.0
6.0.0
3.0.0-SNAPSHOT
+ 5.0.0.Final
2.22.2