Package edu.chl.jadetalk.admin.control

Source Code of edu.chl.jadetalk.admin.control.ConsoleControls

package edu.chl.jadetalk.admin.control;

import edu.chl.jadetalk.admin.view.ConsoleBackingBean;
import edu.chl.jadetalk.business.UserManagerBeanLocal;
import edu.chl.jadetalk.core.Comment;
import edu.chl.jadetalk.core.Image;
import edu.chl.jadetalk.core.User;
import edu.chl.jadetalk.db.ICommentFacade;
import edu.chl.jadetalk.db.IImageFacade;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;
import javax.faces.event.ActionEvent;

/**
*
* @author jesper
*/
@ManagedBean
@RequestScoped
public class ConsoleControls {

    @EJB
    private IImageFacade imageFacade;
    @EJB
    private ICommentFacade commentFacade;
    @EJB
    private UserManagerBeanLocal userManagerBean;
    @ManagedProperty(value = "#{consoleBackingBean}")
    private ConsoleBackingBean conBack;

    /**
     * Get the value of conBack
     *
     * @return the value of conBack
     */
    public ConsoleBackingBean getConBack() {
        return conBack;
    }

    /**
     * Set the value of conBack
     *
     * @param conBack new value of conBack
     */
    public void setConBack(ConsoleBackingBean conBack) {
        this.conBack = conBack;
    }

    /** Creates a new instance of ConsoleControls */
    public ConsoleControls() {
    }

    //Remove user
    public void removeUser(ActionEvent e) {
        User user = (User) e.getComponent().getAttributes().get(conBack.getUserAttName());
        userManagerBean.removeUser(user);
    }

    //Remove comment
    public void removeComment(ActionEvent e) {
        Comment comm = (Comment) e.getComponent().getAttributes().get(conBack.getCommentAttName());
        commentFacade.remove(comm);
    }

    //Remove image
    public void removeImage(ActionEvent e) {
        Image imag = (Image) e.getComponent().getAttributes().get(conBack.getImageAttName());
        imageFacade.remove(imag);
    }
}
TOP

Related Classes of edu.chl.jadetalk.admin.control.ConsoleControls

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.