HTML and CSS Reference
In-Depth Information
As shown in the bolded lines, the Action column shows the available action based on the user role using
#{request.isUserInRole} :
If the user is a member in
megaAppUser group (i.e., Mega App user) and
#{bookRequestsBacking.status} is equal to 3 (approved), then the only available action is
"Download Book" .
If the user is a member in
megaAppAdmin group (i.e., Mega App administrator), then the
available actions are "Download Book" for all the topic request statuses, "Approve Request" ,
and "Reject Request" if #{bookRequestsBacking.status} equals to 1 (pending).
In all of the operations inside data table ( "Approve Request" , "Reject Request" , and "Download Book" ), a
property action listener is executed in order to bind the currently selected book request ( #{bookRequest} ) with the
( #{bookRequestsBacking.selectedBookRequest} ) property before performing the actual action. Listing 13-29 shows
BookRequestsBacking CDI bean.
Listing 13-29. BookRequestsBacking CDI Bean
package com.jsfprohtml5.megaapp.backing;
import com.jsfprohtml5.megaapp.model.Book;
import com.jsfprohtml5.megaapp.model.BookRequest;
import com.jsfprohtml5.megaapp.model.Constants;
import com.jsfprohtml5.megaapp.service.BookManagerLocal;
import com.jsfprohtml5.megaapp.service.BookRequestManagerLocal;
import com.jsfprohtml5.megaapp.service.exception.BookNotFound;
import com.jsfprohtml5.megaapp.service.exception.BookRequestNotFound;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.context.ExternalContext;
import javax.faces.event.ComponentSystemEvent;
import javax.inject.Named;
import javax.faces.view.ViewScoped;
public class BookRequestsBacking extends BaseBacking implements Serializable {
private BookManagerLocal bookManager;
private BookRequestManagerLocal bookRequestManager;
private List<BookRequest> bookRequestList;
private BookRequest selectedBookRequest;
private int status = 1;
private String infoMessage;
Search WWH ::

Custom Search