HTML and CSS Reference
In-Depth Information
viewRequest method gets the user role using its provided user ID by calling getUserGroup private method. If the
user role is ADMIN_GROUP , then the user will retrieve all of the requests under the provided status (pending, rejected, or
approved). If the user role is USER_GROUP , then the user will retrieve only the requests which are sent by the provided
user ID under the provided status (pending or rejected or approved).
viewRequest method will be called from backing beans in order to view pending, rejected, and approved book
requests for the current logged in user.
Let's check the details of BookRequest JPA entity, which holds the book request attributes. Listing 13-15 shows
BookRequest JPA entity class.
Listing 13-15. BookRequest JPA Entity Class
package com.jsfprohtml5.megaapp.model;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
@Entity
@Table(name = "BOOK_REQUEST")
public class BookRequest implements Serializable {
private static final long serialVersionUID = 132123123120090L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "ID")
private Integer id;
@Basic(optional = false)
@Column(name = "REQUEST_TIME")
private long requestTime;
@Basic(optional = false)
@Column(name = "RESPONSE_TIME")
private long responseTime;
@Basic(optional = false)
@NotNull
@Column(name = "STATUS")
private int status;
Search WWH ::




Custom Search