/*
 *  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.entity.place;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

/**
 * @author Joe Hendrix
 */
@Entity
@DiscriminatorValue(value = "4")
@NamedQueries({
                      @NamedQuery(name = City.FIND_BY_NAME, query = "SELECT p FROM City p WHERE p.name = :name"),
                      @NamedQuery(name = City.FIND_ALL, query = "SELECT p FROM City p")
              })
public class City extends Place
{

    /**
     *
     */
    public static final String FIND_ALL = "City.findAll";

    /**
     *
     */
    public static final String FIND_BY_NAME = "City.findByName";

    /**
     * @return
     */
    public Country getCountry()
    {
        return (Country) getRegionByClass(Country.class);
    }

    /**
     * @return
     */
    public County getCounty()
    {
        return (County) getRegionByClass(County.class);
    }

    /**
     * @return
     */
    public State getState()
    {
        return (State) getRegionByClass(State.class);
    }

    /**
     * @return
     */
    @Override
    public String getLink()
    {
        StringBuilder sb = new StringBuilder(getName());

        State state = getState();

        if ( state != null )
        {
            sb.append(", ").append(state.getName());
        }
        else
        {
            Country country = getCountry();

            if ( country != null )
                sb.append(", ").append(country.getName());
        }

        return sb.toString();
    }
}

@@ -797,17 +797,16 @@
 Place%0A%7B%0A
-%0A
     /**%0A
@@ -815,186 +815,604 @@
    *
-%0A     */%0A    public static final String FIND_ALL = %22City.findAll%22;%0A%0A    /**%0A     *%0A     */%0A    public static final String FIND_BY_NAME = %22City.findByName%22;%0A%0A    /**%0A     * @retur
+ Specifies the %7B@link String%7D that represents the %7B@link javax.persistence.NamedQuery%7D to create a %7B@link%0A     * javax.persistence.TypedQuery%7D to get all cities.%0A     */%0A    public static final String FIND_ALL = %22City.findAll%22;%0A%0A    /**%0A     * Specifies the %7B@link String%7D that represents the %7B@link javax.persistence.NamedQuery%7D to create a %7B@link%0A     * javax.persistence.TypedQuery%7D to get all states by name.%0A     */%0A    public static final String FIND_BY_NAME = %22City.findByName%22;%0A%0A    /**%0A     * Returns the country that the city is in.%0A     * %0A     * @return the country that the city is i
 n%0A  
@@ -1527,38 +1527,124 @@
 %0A    /**%0A     * 
-@retur
+Returns the county that the city is in.%0A     * %0A     * @return the county that the city is i
 n%0A     */%0A    pu
@@ -1743,38 +1743,122 @@
 %0A    /**%0A     * 
-@retur
+Returns the state that the city is in.%0A     * %0A     * @return the state that the city is i
 n%0A     */%0A    pu
@@ -1961,23 +1961,66 @@
 %0A     * 
-@return
+%7B@inheritDoc%7D%0A     * %0A     * @return %7B@inheritDoc%7D
 %0A     */

Update City.java