package com.acme.vcutil.bean;


import com.acme.model.domain.ad.entity.City;
import com.acme.model.domain.ad.entity.Country;
import com.acme.model.domain.ad.sessionbean.ADManager;
import com.acme.model.domain.ejf.sessionbean.EJFManager;
import com.acme.model.domain.sc.sessionbean.SCManager;
import com.acme.structure.ServiceLocator;

import java.util.Collection;

public class UtilBean
{
    public Collection findCountriesForList() throws Exception
    {
        Collection entities = null;
        ADManager managerBean = (ADManager)ServiceLocator.getInstance().getResource("ejb/ADManager/remote", ADManager.class);
        entities = managerBean.findCountries();
        return entities;
    }

    public Collection findBranchsForList() throws Exception
    {
        Collection entities = null;
        ADManager managerBean = (ADManager)ServiceLocator.getInstance().getResource("ejb/ADManager/remote", ADManager.class);
        entities=managerBean.findBranchs();
        return entities;
    }

    public Collection findServicesForList() throws Exception
    {
        Collection entities = null;
        SCManager managerBean = (SCManager)ServiceLocator.getInstance().getResource("ejb/SCManager/remote", SCManager.class);
        entities = managerBean.findServicesForList();
        return entities;
    }

    public Collection findRolesForList() throws Exception
    {
        Collection entities = null;
        EJFManager managerBean = (EJFManager)ServiceLocator.getInstance().getResource("ejb/EJFManager/remote", EJFManager.class);
        entities = managerBean.findRolesForList();
        return entities;
    }

    public Collection findRoleGroupsForList() throws Exception
    {
        Collection entities = null;
        EJFManager managerBean = (EJFManager)ServiceLocator.getInstance().getResource("ejb/EJFManager/remote", EJFManager.class);
        entities = managerBean.findRoleGroupsForList();
        return entities;
    }

    public Collection findDepartmensForList() throws Exception
    {
        Collection entities = null;
        ADManager managerBean = (ADManager)ServiceLocator.getInstance().getResource("ejb/ADManager/remote", ADManager.class);
        entities = managerBean.findDepartmentsForList();
        return entities;
    }

    public Collection findCitiesForCountryList(Country country) throws Exception
    {
        Collection entities = null;
        ADManager managerBean = (ADManager)ServiceLocator.getInstance().getResource("ejb/ADManager/remote", ADManager.class);
        entities = managerBean.findCitiesForCountryList(country);
        return entities;
    }

    public Collection findDistrictsForCityList(City city) throws Exception
    {
        Collection entities = null;
        ADManager managerBean = (ADManager)ServiceLocator.getInstance().getResource("ejb/ADManager/remote", ADManager.class);
        entities = managerBean.findDistrictsForCityList(city);
        return entities;
    }

    public Collection findCititesForList() throws Exception
    {
        Collection entities = null;
        ADManager managerBean = (ADManager)ServiceLocator.getInstance().getResource("ejb/ADManager/remote", ADManager.class);
        entities = managerBean.findCitiesForList();
        return entities;
    }

    public Collection findDistrictsForList() throws Exception
    {
        Collection entities = null;
        ADManager managerBean = (ADManager)ServiceLocator.getInstance().getResource("ejb/ADManager/remote", ADManager.class);
        entities = managerBean.findDistrictsForList();
        return entities;
    }

    public Collection findSections() throws Exception
    {
        Collection entities = null;
        SCManager managerBean = (SCManager)ServiceLocator.getInstance().getResource("ejb/SCManager/remote", ADManager.class);
        entities = managerBean.findSections();
        return entities;
    }

    public Collection findUnitGroupsForList() throws Exception
    {
        Collection entities = null;
        ADManager managerBean = (ADManager)ServiceLocator.getInstance().getResource("ejb/ADManager/remote", ADManager.class);
        entities = managerBean.findUnitGroupsForList();
        return entities;
    }

    public Collection findServiceGroupsForList() throws Exception
    {
        Collection entities = null;
        SCManager managerBean = (SCManager)ServiceLocator.getInstance().getResource("ejb/SCManager/remote", SCManager.class);
        entities = managerBean.findServiceGroupsForList();
        return entities;
    }

//    public Collection findCurrenciesForList() throws Exception
//    {
//        Collection entities = null;
//        ADManager managerBean = (ADManager)ServiceLocator.getInstance().getResource("ejb/ADManager/remote", ADManager.class);
//        entities = managerBean.findCurrenciesForList();
//        return entities;
//    }

    public Collection findCurrencies() throws Exception
    {
        Collection entities = null;
        ADManager managerBean = (ADManager)ServiceLocator.getInstance().getResource("ejb/ADManager/remote", ADManager.class);
        entities = managerBean.findCurrencies();
        return entities;
    }
    
    public Collection findTablesForList() throws Exception
    {
        Collection entities = null;
        SCManager managerBean = (SCManager)ServiceLocator.getInstance().getResource("ejb/SCManager/remote", SCManager.class);
        entities = managerBean.findTablesForList();
        return entities;
    }
}
