Package org.spw.model

Examples of org.spw.model.Country


public class CountryDataProvider extends ObjectListDataProvider {
    private ArrayList<Country> aList = new ArrayList<Country>();
    /** Creates a new instance of CountryDataProvider */
    public CountryDataProvider() {
        // Put in dummy data for design time
        aList.add(new Country());

        // Wrap the list
        setList(aList);       
    }
View Full Code Here


       
        // </editor-fold>
        // Perform application initialization that must complete
        // *after* managed components are initialized
        if (getSessionBean1().getCountry() == null) {
            getSessionBean1().setCountry(new Country());
        }
        if (getSessionBean1().getCountry().getCountryCode() != null ) {
            code.setReadOnly(true);
        }
       
View Full Code Here

    }
   
    public String buttonChange_action() {
        // Persist the new object
        CountryController ctrl = new CountryController();
        Country object = getSessionBean1().getCountry();
        ctrl.update(object);
       
        return "success";
    }
View Full Code Here

     * @param key The name of the country. It is assumed that this name is unique.
     * @return The corresponding country object.
     */
    public Country getCountryByName(String key) {
        EntityManager em = emf.createEntityManager();
        Country retValue = null;
        try {
            Query query =
                    em.createNamedQuery("Country.findByCountryName");
            query.setParameter("countryName", key);
            retValue = (Country) query.getSingleResult();
View Full Code Here

        }
    }
   
    public Country read(String key) {
        EntityManager em = emf.createEntityManager();
        Country retValue = null;
        try {
            retValue = em.find(Country.class, key);
        } catch (Exception e) {
            Logger.getLogger(CountryController.class.getName()).
                    log(Level.SEVERE, "Error reading " + key, e);
View Full Code Here

        }
        return retValue;
    }
   
    public Country update(Country object) {
        Country result = null;
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        try {
            result = em.merge(object);
            em.getTransaction().commit();
View Full Code Here

   
    public void delete(Country object) {
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        try {
            Country entity = em.find(Country.class, object.getCountryCode());
            em.remove(entity);
            em.getTransaction().commit();
        } catch (Exception e) {
            Logger.getLogger(CountryController.class.getName()).
                    log(Level.SEVERE, "Error deleting " + object, e);
View Full Code Here

   
    public String buttonDelete_action() {
        RowKey rk = tableRowGroup1.getRowKey();
        if (rk != null) {
            CountryController  ctrl = new CountryController();
            Country country = (Country)list.getObject(rk);
            ctrl.delete(country);
            list.refreshList();
        }
        return null;
    }
View Full Code Here

    }
   
    public String buttonEdit_action() {
        RowKey rk = tableRowGroup1.getRowKey();
        if (rk != null) {
            Country country = (Country)list.getObject(rk);
            getSessionBean1().setCountry(country);
        }
        return "edit";
    }
View Full Code Here

        }
        return "edit";
    }
   
    public String buttonNew_action() {
        getSessionBean1().setCountry(new Country());
       
        return "new";
    }
View Full Code Here

TOP

Related Classes of org.spw.model.Country

Copyright © 2018 www.massapicom. 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.