com.ebay.sdk.helper.RegionServiceHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ebaysdkcore Show documentation
Show all versions of ebaysdkcore Show documentation
This SDK enables you to use Java to make API calls in the eBay Trading API, which is an XML API.
This maven build is provided by tonicsoft for convenience and is an exact copy of version 981 of
the project distributed by eBay via the official eBay SDK website.
The newest version!
/*
Copyright (c) 2013 eBay, Inc.
This program is licensed under the terms of the eBay Common Development and
Distribution License (CDDL) Version 1.0 (the "License") and any subsequent version
thereof released by eBay. The then-current version of the License can be found
at http://www.opensource.org/licenses/cddl1.php and in the eBaySDKLicense file that
is under the root directory at /LICENSE.txt.
*/
package com.ebay.sdk.helper;
import java.util.*;
import com.ebay.soap.eBLBaseComponents.*;
import com.ebay.sdk.helper.ui.*;
/**
* A helper class to retrieve the available search locations/regions for a given site.
*/
public class RegionServiceHelper {
static Hashtable _regionServiceMap = new Hashtable();
static RegionServiceHelper _regionServiceHelper = new RegionServiceHelper();
/**
* Return an instance of RegionServiceHelper.
* @return RegionServiceHelper
*/
public static RegionServiceHelper getInstanace()
{
return _regionServiceHelper;
}
private RegionServiceHelper() {
}
/**
* Return a map of the available search locations/regions for a given site.
* @param siteId SiteCodeType
* @return Hashtable
*/
public Hashtable getRegionsMap(SiteCodeType siteId)
{
Hashtable regionsMap = (Hashtable) _regionServiceMap.get(siteId);
if (regionsMap == null) {
Hashtable map = eBayDetailsHelper.getInstance().getDetailEntryMapWithIntValue(siteId, REGION);
if (map != null) {
_regionServiceMap.put(siteId, map);
int size = map.size();
if (size > 0) {
regionsMap = new Hashtable();
Enumeration keys = map.keys();
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
Object entry = map.get(key);
regionsMap.put(key, new ControlTagItem(entry.toString(), key));
}
}
_regionServiceMap.put(siteId, regionsMap);
}
}
return regionsMap;
}
private static String REGION = "Region";
}