package oracle.byop.maf.data.collections.readonly;

import java.util.ArrayList;


import oracle.byop.maf.data.entities.Warehouse;

/**
 *
 * Title:   Bring Your Own Project (BYOP): Hackathon
 * Schema:  ADF Summit
 * Type:    Service Object with hard-coded sample data
 *
 *
 * @author Frank Nimphius - August, 2014
 */

public class WarehousesRO {
    
    private ArrayList warehouses = new ArrayList();
    
    public WarehousesRO() {
        super();
        warehouses.add(createWareHouse(new Integer(102),"457 120th Ave NE"," Bellevue"," WA",new Integer( 4),"98005",new Double( 47.614542),new Double(-122.179873),new Integer(6)));
        warehouses.add(createWareHouse(new Integer(103),"63455 North Highway 97"," Bend"," OR",new Integer( 4),"97701",new Double( 44.104404),new Double(-121.298073),new Integer(6)));
        warehouses.add(createWareHouse(new Integer(104),"8363 W Franklin Rd"," Boise","ID",new Integer( 4),"83709",new Double( 43.604973),new Double(-116.280341),new Integer(6)));
        warehouses.add(createWareHouse(new Integer(105),"4080 Stevens Creek Blvd","San Jose"," CA",new Integer( 4),"95129",new Double( 37.323042),new Double(-121.973525),new Integer(6)));
        warehouses.add(createWareHouse(new Integer(106),"2955 Mountain City Hwy"," Elko"," NV",new Integer( 4),"89801",new Double( 40.839251),new Double(-115.794816),new Integer(6)));
        warehouses.add(createWareHouse(new Integer(107),"100 E 400 St S"," Richfield","UT",new Integer( 4),"84701",new Double( 38.762564),new Double(-112.083137),new Integer(6)));
        warehouses.add(createWareHouse(new Integer(108),"12645 N 48th St","Phoenix","AZ",new Integer( 4),"85032",new Double( 33.60148),new Double(-111.977912),new Integer(6)));
        warehouses.add(createWareHouse(new Integer(109),"1801 E Custer Avenue"," Helena"," MT",new Integer( 4),"59602",new Double( 46.616722),new Double(-112.004752),new Integer(6)));
        warehouses.add(createWareHouse(new Integer(110),"1105 E Boxelder Road"," Gillette"," WY",new Integer( 4),"82718",new Double( 44.276084),new Double(-105.487727),new Integer(6)));
        warehouses.add(createWareHouse(new Integer(111),"7120 N Academy Blvd","Colorado Springs"," CO",new Integer( 4),"80920",new Double( 38.934817),new Double(-104.797193),new Integer(6)));
        warehouses.add(createWareHouse(new Integer(112),"2350 N Main","Roswell","NM",new Integer( 4),"88202",new Double( 33.393024),new Double(-104.522686),new Integer(6)));
    }
    

    private Warehouse createWareHouse(Integer id, String address, String city, String state, Integer countryId, String zipCode, Double latitude, Double longitude, Integer managerId) {
        return new Warehouse(id,address,city,state,countryId,zipCode,latitude,longitude,managerId);
    }


    public void setWarehouse(Warehouse[] warehouse) {}

    public Warehouse[] getWarehouse() {
        return (Warehouse[])warehouses.toArray(new Warehouse[warehouses.size()]);
    }
    
    public Warehouse getWarehouseById(Integer wId) {
        
        for (int i = 0; i < warehouses.size(); i++) {
            if(((Warehouse)warehouses.get(i)).getId().compareTo(wId)==0){
               return (Warehouse)warehouses.get(i);
            }
        }
      return null;
    }
    
}
