package de.unibremen.opensores.controller;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;

/**
 * Provisional LoginController to show usage of log4j logging.
 */

@ManagedBean
@SessionScoped
public class LoginController {

    /**
     * @todo
     */
    private static Logger log = LogManager.getLogger(LoginController.class);

    private String email;
    private String password;

    /**
     * @todo
     */
    public final String login() {
        log.error("login called");
        if (validate()) {
            log.debug("login succeeded");
            FacesMessage msg = new FacesMessage("Login success");
            FacesContext.getCurrentInstance().addMessage(null, msg);
            return "/index.xhtml";
        } else {
            log.debug("login failed");
            FacesMessage msg = new FacesMessage("Login failed");
            msg.setSeverity(FacesMessage.SEVERITY_ERROR);
            FacesContext.getCurrentInstance().addMessage(null, msg);
            return "/index.xhtml?faces-redirect=true";
        }
    }

    /**
     * @todo
     */
    private boolean validate() {
        return (email == null || password == null);
    }

    /* Getters and Setters */

    /**
     * @todo
     */
    public final String getEmail() {
        return email;
    }

    /**
     * @todo
     */
    public final void setEmail(final String mail) {
        this.email = mail;
    }

    /**
     * @todo
     */
    public final String getPassword() {
        return password;
    }

    /**
     * @todo
     */
    public final void setPassword(final String pw) {
        this.password = pw;
    }
}

@@ -416,17 +416,16 @@
 oller %7B%0A
-%0A
     /**%0A
@@ -428,32 +428,33 @@
 /**%0A     * @todo
+.
 %0A     */%0A    pri
@@ -532,29 +532,90 @@
     
-private String email;
+/**%0A     * @todo.%0A     */%0A    private String email;%0A%0A    /**%0A     * @todo.%0A     */
 %0A   
@@ -653,32 +653,33 @@
 /**%0A     * @todo
+.
 %0A     */%0A    pub
@@ -1310,32 +1310,33 @@
 /**%0A     * @todo
+.
 %0A     */%0A    pri
@@ -1424,39 +1424,8 @@
  %7D%0A%0A
-    /* Getters and Setters */%0A%0A
     
@@ -1432,32 +1432,33 @@
 /**%0A     * @todo
+.
 %0A     */%0A    pub
@@ -1528,32 +1528,33 @@
 /**%0A     * @todo
+.
 %0A     */%0A    pub
@@ -1644,32 +1644,33 @@
 /**%0A     * @todo
+.
 %0A     */%0A    pub
@@ -1754,16 +1754,17 @@
  * @todo
+.
 %0A     */

Fix checkstyle violations in LoginController