/*
 *  The MIT License (MIT)
 *
 *  View the full license at:
 *  https://github.com/hendrixjoseph/FamilyTree/blob/master/LICENSE.md
 *
 *  Copyright (c) 2015 Joseph Hendrix
 *
 *  Hosted on GitHub at https://github.com/hendrixjoseph/FamilyTree
 *
 */

package edu.wright.hendrix11.familyTree.bean;

import edu.wright.hendrix11.familyTree.dataBean.PersonDataBean;
import edu.wright.hendrix11.familyTree.entity.Person;
import edu.wright.hendrix11.familyTree.entity.event.Birth;
import edu.wright.hendrix11.familyTree.entity.event.Death;

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.view.ViewScoped;
import javax.inject.Named;

import java.io.Serializable;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * @author Joe Hendrix
 */
@Named
@ViewScoped
public class IndividualBean implements Serializable
{

    private static final Logger LOG = Logger.getLogger(IndividualBean.class.getName());
    @EJB
    private PersonDataBean personDataBean;
    private Person person;
    private Person tempPerson;

    /**
     *
     */
    @PostConstruct
    public void initialize()
    {
        person = personDataBean.findFirst();

        tempPerson = new Person();
        tempPerson.setName(person.getName());
        tempPerson.setGender(person.getGender());

        if ( person.getBirth() != null )
            tempPerson.setBirth(person.getBirth());
        else
            tempPerson.setBirth(new Birth());

        if ( person.getDeath() != null )
            tempPerson.setDeath(person.getDeath());
        else
            tempPerson.setDeath(new Death());
    }

    /**
     * @return
     */
    public int getPersonId()
    {
        return person.getId();
    }

    /**
     * @param personId
     */
    public void setPersonId(int personId)
    {
        person = personDataBean.find(personId);
    }

    /**
     * @return
     */
    public Person getPerson()
    {
        return person;
    }

    /**
     * @param person
     */
    public void setPerson(Person person)
    {
        this.person = person;
    }

    /**
     * @return
     */
    public Person getTempPerson()
    {
        return tempPerson;
    }

    /**
     * @param tempPerson
     */
    public void setTempPerson(Person tempPerson)
    {
        this.tempPerson = tempPerson;
    }

    /**
     *
     */
    public void updatePerson()
    {
        LOG.log(Level.SEVERE, "Still developing!! " + tempPerson.getName());

        person.setName(tempPerson.getName());
        person.setGender(tempPerson.getGender());

        personDataBean.update(person);
    }
}

@@ -1640,127 +1640,492 @@
   * 
-@return%0A     */%0A    public int getPersonId()%0A    %7B%0A        return person.getId();%0A    %7D%0A%0A    /**%0A     * @param personId
+Returns the id of the current %7B@link Person%7D.%0A     * %0A     * @return the id of the current %7B@link Person%7D%0A     * %0A     * @see edu.wright.hendrix11.familyTree.entity.Person#getId()%0A     */%0A    public int getPersonId()%0A    %7B%0A        return person.getId();%0A    %7D%0A%0A    /**%0A     * Sets the current %7B@link Person%7D based on the %7B@code personId%7D.%0A     * %0A     * @param personId the id of the %7B@link Person%7D to be set%0A     * %0A     * @see edu.wright.hendrix11.familyTree.dataBean.PersonDataBean
 %0A   
@@ -2239,38 +2239,112 @@
 %0A    /**%0A     * 
-@retur
+Returns the currently set person.%0A     * %0A     * @return the currently set perso
 n%0A     */%0A    pu
@@ -2418,29 +2418,98 @@
 %0A     * 
-@param person
+Sets the person to be viewed.%0A     * %0A     * @param person the person to be viewed
 %0A     */

Update IndividualBean.java