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), then the only available
action is "Request Copy" .
If the user is a member in
megaAppAdmin group (i.e., Mega App administrator), then the
available actions are ( "Delete Book" and "Download Book" ).
In all of the operations inside data table ( "Request Copy" , "Delete Book" , and "Download Book" ), a
property action listener is executed in order to bind the currently selected book ( #{currentBook} ) with the
( #{bookSearchBacking.selectedBook} ) property before performing the actual action. Listing 13-27 shows
BookSearchBacking CDI bean.
Listing 13-27. BookSearchBacking 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.model.MegaUser;
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.BookRequestAlreadyExists;
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.inject.Named;
import javax.faces.view.ViewScoped;
public class BookSearchBacking extends BaseBacking implements Serializable {
private BookManagerLocal bookManager;
private BookRequestManagerLocal bookRequestManager;
private List<Book> bookList;
private String searchTitle;
private String infoMessage;
private Book selectedBook;
Search WWH ::

Custom Search