public void syncCategoryFeatures() throws Exception {
Map<String, CategoryType> categoriesCacheMap = this.siteFacade.getSiteCategoriesMap().get(apiContext.getSite());
Map<String, CategoryFeatureType> cfsMap = this.siteFacade.getSiteCategoriesFeaturesMap().get(apiContext.getSite());
SiteDefaultsType siteDefaults = this.siteFacade.getSiteFeatureDefaultMap().get(apiContext.getSite());
FeatureDefinitionsType featureDefinition = this.siteFacade.getSiteFeatureDefinitionsMap().get(apiContext.getSite());
//get itemSpecificsEnabled feature
itemSpecificEnabled = (ItemSpecificsEnabledCodeType)getInheritProperty(catId, "getItemSpecificsEnabled", categoriesCacheMap, cfsMap);
if (itemSpecificEnabled == null) {
itemSpecificEnabled = siteDefaults.getItemSpecificsEnabled();
}
//get returnPolicyEnabled feature
retPolicyEnabled = (Boolean)getInheritProperty(catId, "isReturnPolicyEnabled", categoriesCacheMap, cfsMap);
if (retPolicyEnabled == null) {
retPolicyEnabled = siteDefaults.isReturnPolicyEnabled();
}
//get listing durations
ListingDurationDefinitionsType listDuration = featureDefinition.getListingDurations();
ListingDurationDefinitionType[] durationArray = listDuration.getListingDuration();
listingDurationMap = FastMap.newInstance();
for (int i = 0; i < durationArray.length; i++) {
listingDurationMap.put(durationArray[i].getDurationSetID(), durationArray[i].getDuration());
}
//get listing types
ListingDurationReferenceType[] listingDuration = (ListingDurationReferenceType[])getInheritProperty(catId, "getListingDuration", categoriesCacheMap, cfsMap);
if (listingDuration == null || listingDuration.length == 0) {
listingDuration = siteDefaults.getListingDuration();
}
listingDurationReferenceMap = FastMap.newInstance();
for (int i = 0; i < listingDuration.length; i++) {
listingDurationReferenceMap.put(listingDuration[i].getType().value(),listingDuration[i].getValue());
}
//get payment methods
paymentMethods = (BuyerPaymentMethodCodeType[])getInheritProperty(catId, "getPaymentMethod", categoriesCacheMap, cfsMap);
if (paymentMethods == null || paymentMethods.length == 0) {
paymentMethods = siteDefaults.getPaymentMethod();
}
//fix 'invalid enum' issue
paymentMethods = fiterPaymentMethod(paymentMethods);
storeOwnerExtendedListingDuration = siteDefaults.getStoreOwnerExtendedListingDurations();
bestOfferEnabled = featureDefinition.getBestOfferEnabled();
}