You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2015/08/10 18:15:38 UTC

svn commit: r1695126 [22/22] - in /ofbiz/trunk: applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/ applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/ applications/content/src/org/ofbiz/content/webapp/ftl/ a...

Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreSiteFacade.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreSiteFacade.java?rev=1695126&r1=1695125&r2=1695126&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreSiteFacade.java (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreSiteFacade.java Mon Aug 10 16:15:37 2015
@@ -1,238 +1,238 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.ebaystore;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import com.ebay.sdk.ApiContext;
-import com.ebay.sdk.ApiException;
-import com.ebay.sdk.SdkException;
-import com.ebay.sdk.attributes.AttributesMaster;
-import com.ebay.sdk.attributes.AttributesXmlDownloader;
-import com.ebay.sdk.attributes.AttributesXslDownloader;
-import com.ebay.sdk.attributes.CategoryCSDownloader;
-import com.ebay.sdk.attributes.model.IAttributesMaster;
-import com.ebay.sdk.attributes.model.IAttributesXmlProvider;
-import com.ebay.sdk.attributes.model.IAttributesXslProvider;
-import com.ebay.sdk.attributes.model.ICategoryCSProvider;
-import com.ebay.sdk.call.GetStoreCall;
-import com.ebay.sdk.helper.cache.CategoriesDownloader;
-import com.ebay.sdk.helper.cache.DetailsDownloader;
-import com.ebay.sdk.helper.cache.FeaturesDownloader;
-import com.ebay.soap.eBLBaseComponents.CategoryFeatureType;
-import com.ebay.soap.eBLBaseComponents.CategoryType;
-import com.ebay.soap.eBLBaseComponents.FeatureDefinitionsType;
-import com.ebay.soap.eBLBaseComponents.GetCategoryFeaturesResponseType;
-import com.ebay.soap.eBLBaseComponents.GetStoreRequestType;
-import com.ebay.soap.eBLBaseComponents.GetStoreResponseType;
-import com.ebay.soap.eBLBaseComponents.GeteBayDetailsResponseType;
-import com.ebay.soap.eBLBaseComponents.SiteCodeType;
-import com.ebay.soap.eBLBaseComponents.SiteDefaultsType;
-import com.ebay.soap.eBLBaseComponents.StoreCustomCategoryArrayType;
-import com.ebay.soap.eBLBaseComponents.StoreCustomCategoryType;
-import com.ebay.soap.eBLBaseComponents.StoreType;
-
-public class EbayStoreSiteFacade {
-    public static final String module = EbayStoreSiteFacade.class.getName();
-    private ApiContext apiContext = null;
-    private IAttributesMaster attrMaster = null;
-    private static final int MAP_SIZE = 30000;
-    private Map<SiteCodeType, Map<String, CategoryType>> siteCategoriesMap = new HashMap<SiteCodeType, Map<String, CategoryType>>();
-    private Map<SiteCodeType, List<StoreCustomCategoryType>> siteStoreCategoriesMap = new HashMap<SiteCodeType, List<StoreCustomCategoryType>>();
-    private Map<SiteCodeType, List<CategoryType>> siteCategoriesCSMap = new HashMap<SiteCodeType,List<CategoryType>>();
-    private Map<SiteCodeType, Map<String, CategoryFeatureType>> siteCategoriesFeaturesMap = new HashMap<SiteCodeType, Map<String, CategoryFeatureType>>();
-    private Map<SiteCodeType, SiteDefaultsType> siteFeatureDefaultMap = new HashMap<SiteCodeType, SiteDefaultsType>();
-    private Map<SiteCodeType, FeatureDefinitionsType> siteFeatureDefinitionsMap = new HashMap<SiteCodeType, FeatureDefinitionsType>();
-    private Map<SiteCodeType, GeteBayDetailsResponseType> eBayDetailsMap = new HashMap<SiteCodeType, GeteBayDetailsResponseType>();
-
-    public EbayStoreSiteFacade(ApiContext ctx) throws ApiException, SdkException, Exception {
-        this.apiContext = ctx;
-        initAttributeMaster();
-        syncAllCategoriesFeatures();
-        syncEBayDetails();
-        getAllMergedCategories();
-        getEbayStoreCategories();
-    }
-
-    public static IAttributesXslProvider getDefaultStyleXsl() throws java.io.IOException {
-        IAttributesXslProvider iAttr = IAttributesXslProvider.class.cast(AttributesXslDownloader.class.getResourceAsStream("Attributes_Style.xsl"));
-        return iAttr;
-    }
-
-    private void initAttributeMaster() throws ApiException, SdkException, Exception, java.io.IOException {
-        //java.io.InputStream strm = IAttributesXmlProvider.class.getResourceAsStream("Attributes_Style.xsl");
-        IAttributesMaster amst = new AttributesMaster();
-        IAttributesXmlProvider axd = new AttributesXmlDownloader(this.apiContext);
-        amst.setXmlProvider(axd);
-        IAttributesXslProvider asd = new AttributesXslDownloader(this.apiContext);
-        //IAttributesXslProvider asd = getDefaultStyleXsl();
-        //asd.downloadXsl();
-        amst.setXslProvider(asd);
-        this.attrMaster = amst;
-    }
-
-    private void syncEBayDetails() throws Exception {
-        if (!eBayDetailsMap.containsKey(this.apiContext.getSite())) {
-            DetailsDownloader downloader = new DetailsDownloader(this.apiContext);
-            GeteBayDetailsResponseType resp = downloader.geteBayDetails();
-            eBayDetailsMap.put(this.apiContext.getSite(), resp);
-        }
-    }
-
-    //sync and cache all categories features in memory
-    private void syncAllCategoriesFeatures() throws Exception {
-        if (!siteCategoriesFeaturesMap.containsKey(this.apiContext.getSite())) { 
-            FeaturesDownloader fd = new FeaturesDownloader(this.apiContext);
-            GetCategoryFeaturesResponseType cfrt = fd.getAllCategoryFeatures();
-            CategoryFeatureType[] categoryFeatures = cfrt.getCategory();
-            Map<String, CategoryFeatureType> cfsMap = new HashMap<String, CategoryFeatureType>(MAP_SIZE);
-            for (CategoryFeatureType cf: categoryFeatures) {
-                cfsMap.put(cf.getCategoryID(), cf);
-            }
-            siteCategoriesFeaturesMap.put(this.apiContext.getSite(), cfsMap);
-            siteFeatureDefaultMap.put(this.apiContext.getSite(), cfrt.getSiteDefaults());
-            siteFeatureDefinitionsMap.put(this.apiContext.getSite(), cfrt.getFeatureDefinitions());
-        }
-    }
-
-    /**
-     * Get categories using GetCategory2CS and GetCategories calls,
-     * and merge the categories
-     * 
-     */
-    public List<CategoryType> getAllMergedCategories() throws ApiException, SdkException, Exception {
-        //Get all categories that are mapped to characteristics sets
-        IAttributesMaster amst = this.attrMaster;
-        if (!siteCategoriesCSMap.containsKey(this.apiContext.getSite())) {
-            ICategoryCSProvider catCSProvider = new CategoryCSDownloader(this.apiContext);
-            amst.setCategoryCSProvider(catCSProvider);
-            CategoryType[] csCats = catCSProvider.getCategoriesCS();
-            Map<String, CategoryType> csCatsMap = new HashMap<String, CategoryType>(MAP_SIZE);
-            for (CategoryType cat : csCats) {
-                csCatsMap.put(cat.getCategoryID(), cat);
-            }
-
-            //Get all categories
-            Map<String, CategoryType> allCatsMap = this.getAllCategories();
-            for (CategoryType cat : allCatsMap.values()) {
-                CategoryType csCat = csCatsMap.get(cat.getCategoryID());
-                if (csCat != null) {
-                    //copy category name and leaf category fields, since these
-                    //fields are not set when using GetCategoryCS call.
-                    csCat.setCategoryName(cat.getCategoryName());
-                    csCat.setLeafCategory(cat.isLeafCategory());
-                } else {
-                    //some category has no characteristic sets, 
-                    //but it may has custom item specifics
-                    csCatsMap.put(cat.getCategoryID(), cat);
-                }
-            }
-
-            //convert the map to list
-            List<CategoryType> catsList = new LinkedList<CategoryType>();
-            for (CategoryType cat : csCatsMap.values()) {
-                catsList.add(cat);
-            }
-            siteCategoriesCSMap.put(this.apiContext.getSite(), catsList);
-            return catsList;
-        } else {
-            return siteCategoriesCSMap.get(this.apiContext.getSite());
-        }
-    }
-
-    //get all categories map
-    private Map<String, CategoryType> getAllCategories() throws Exception {
-        if (!siteCategoriesMap.containsKey(this.apiContext.getSite())) {
-            Map<String, CategoryType> catsMap = new HashMap<String, CategoryType>(30000);
-            CategoriesDownloader cd = new CategoriesDownloader(this.apiContext);
-            CategoryType[] cats = cd.getAllCategories();
-
-            for (CategoryType cat : cats) {
-                catsMap.put(cat.getCategoryID(), cat);
-            }
-            siteCategoriesMap.put(this.apiContext.getSite(), catsMap);
-            return catsMap;
-        } else {
-            return siteCategoriesMap.get(this.apiContext.getSite());
-        }
-    }
-
-    //get all categories from ebay store depend on siteId
-    private List<StoreCustomCategoryType> getEbayStoreCategories() {
-        Map<String, StoreCustomCategoryType> catsMap = new HashMap<String, StoreCustomCategoryType>(30000);
-        List<StoreCustomCategoryType> catsList = new LinkedList<StoreCustomCategoryType>();
-        try {
-            GetStoreCall call = new GetStoreCall(this.apiContext);
-            GetStoreRequestType req = new GetStoreRequestType();
-            GetStoreResponseType resp = null;
-            resp = (GetStoreResponseType) call.execute(req);
-            if (resp != null && "SUCCESS".equals(resp.getAck().toString())) {
-                StoreType store = resp.getStore();
-                StoreCustomCategoryArrayType categoriesArr = store.getCustomCategories();
-                StoreCustomCategoryType[] cateogries = categoriesArr.getCustomCategory();
-                for (StoreCustomCategoryType cat : cateogries) {
-                    String categoryId = Long.toString(cat.getCategoryID());
-                    catsMap.put(categoryId, cat);
-                }
-                for (StoreCustomCategoryType cat : catsMap.values()) {
-                    catsList.add(cat);
-                }
-                siteStoreCategoriesMap.put(this.apiContext.getSite(), catsList);
-            }
-        } catch (Exception e) {
-            return siteStoreCategoriesMap.get(this.apiContext.getSite());
-        }
-        return catsList;
-    }
-
-    public IAttributesMaster getAttrMaster() {
-        return attrMaster;
-    }
-
-    public Map<SiteCodeType, Map<String, CategoryFeatureType>> getSiteCategoriesFeaturesMap() {
-        return siteCategoriesFeaturesMap;
-    }
-
-    public Map<SiteCodeType, SiteDefaultsType> getSiteFeatureDefaultMap() {
-        return siteFeatureDefaultMap;
-    }
-
-    public Map<SiteCodeType, FeatureDefinitionsType> getSiteFeatureDefinitionsMap() {
-        return siteFeatureDefinitionsMap;
-    }
-
-    public Map<SiteCodeType, Map<String, CategoryType>> getSiteCategoriesMap() {
-        return siteCategoriesMap;
-    }
-
-    public Map<SiteCodeType, List<CategoryType>> getSiteCategoriesCSMap() {
-        return siteCategoriesCSMap;
-    }
-
-    public Map<SiteCodeType, List<StoreCustomCategoryType>> getSiteStoreCategoriesMap() {
-        return siteStoreCategoriesMap;
-    }
-
-    public Map<SiteCodeType, GeteBayDetailsResponseType> getEBayDetailsMap() {
-        return eBayDetailsMap;
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.ofbiz.ebaystore;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import com.ebay.sdk.ApiContext;
+import com.ebay.sdk.ApiException;
+import com.ebay.sdk.SdkException;
+import com.ebay.sdk.attributes.AttributesMaster;
+import com.ebay.sdk.attributes.AttributesXmlDownloader;
+import com.ebay.sdk.attributes.AttributesXslDownloader;
+import com.ebay.sdk.attributes.CategoryCSDownloader;
+import com.ebay.sdk.attributes.model.IAttributesMaster;
+import com.ebay.sdk.attributes.model.IAttributesXmlProvider;
+import com.ebay.sdk.attributes.model.IAttributesXslProvider;
+import com.ebay.sdk.attributes.model.ICategoryCSProvider;
+import com.ebay.sdk.call.GetStoreCall;
+import com.ebay.sdk.helper.cache.CategoriesDownloader;
+import com.ebay.sdk.helper.cache.DetailsDownloader;
+import com.ebay.sdk.helper.cache.FeaturesDownloader;
+import com.ebay.soap.eBLBaseComponents.CategoryFeatureType;
+import com.ebay.soap.eBLBaseComponents.CategoryType;
+import com.ebay.soap.eBLBaseComponents.FeatureDefinitionsType;
+import com.ebay.soap.eBLBaseComponents.GetCategoryFeaturesResponseType;
+import com.ebay.soap.eBLBaseComponents.GetStoreRequestType;
+import com.ebay.soap.eBLBaseComponents.GetStoreResponseType;
+import com.ebay.soap.eBLBaseComponents.GeteBayDetailsResponseType;
+import com.ebay.soap.eBLBaseComponents.SiteCodeType;
+import com.ebay.soap.eBLBaseComponents.SiteDefaultsType;
+import com.ebay.soap.eBLBaseComponents.StoreCustomCategoryArrayType;
+import com.ebay.soap.eBLBaseComponents.StoreCustomCategoryType;
+import com.ebay.soap.eBLBaseComponents.StoreType;
+
+public class EbayStoreSiteFacade {
+    public static final String module = EbayStoreSiteFacade.class.getName();
+    private ApiContext apiContext = null;
+    private IAttributesMaster attrMaster = null;
+    private static final int MAP_SIZE = 30000;
+    private Map<SiteCodeType, Map<String, CategoryType>> siteCategoriesMap = new HashMap<SiteCodeType, Map<String, CategoryType>>();
+    private Map<SiteCodeType, List<StoreCustomCategoryType>> siteStoreCategoriesMap = new HashMap<SiteCodeType, List<StoreCustomCategoryType>>();
+    private Map<SiteCodeType, List<CategoryType>> siteCategoriesCSMap = new HashMap<SiteCodeType,List<CategoryType>>();
+    private Map<SiteCodeType, Map<String, CategoryFeatureType>> siteCategoriesFeaturesMap = new HashMap<SiteCodeType, Map<String, CategoryFeatureType>>();
+    private Map<SiteCodeType, SiteDefaultsType> siteFeatureDefaultMap = new HashMap<SiteCodeType, SiteDefaultsType>();
+    private Map<SiteCodeType, FeatureDefinitionsType> siteFeatureDefinitionsMap = new HashMap<SiteCodeType, FeatureDefinitionsType>();
+    private Map<SiteCodeType, GeteBayDetailsResponseType> eBayDetailsMap = new HashMap<SiteCodeType, GeteBayDetailsResponseType>();
+
+    public EbayStoreSiteFacade(ApiContext ctx) throws ApiException, SdkException, Exception {
+        this.apiContext = ctx;
+        initAttributeMaster();
+        syncAllCategoriesFeatures();
+        syncEBayDetails();
+        getAllMergedCategories();
+        getEbayStoreCategories();
+    }
+
+    public static IAttributesXslProvider getDefaultStyleXsl() throws java.io.IOException {
+        IAttributesXslProvider iAttr = IAttributesXslProvider.class.cast(AttributesXslDownloader.class.getResourceAsStream("Attributes_Style.xsl"));
+        return iAttr;
+    }
+
+    private void initAttributeMaster() throws ApiException, SdkException, Exception, java.io.IOException {
+        //java.io.InputStream strm = IAttributesXmlProvider.class.getResourceAsStream("Attributes_Style.xsl");
+        IAttributesMaster amst = new AttributesMaster();
+        IAttributesXmlProvider axd = new AttributesXmlDownloader(this.apiContext);
+        amst.setXmlProvider(axd);
+        IAttributesXslProvider asd = new AttributesXslDownloader(this.apiContext);
+        //IAttributesXslProvider asd = getDefaultStyleXsl();
+        //asd.downloadXsl();
+        amst.setXslProvider(asd);
+        this.attrMaster = amst;
+    }
+
+    private void syncEBayDetails() throws Exception {
+        if (!eBayDetailsMap.containsKey(this.apiContext.getSite())) {
+            DetailsDownloader downloader = new DetailsDownloader(this.apiContext);
+            GeteBayDetailsResponseType resp = downloader.geteBayDetails();
+            eBayDetailsMap.put(this.apiContext.getSite(), resp);
+        }
+    }
+
+    //sync and cache all categories features in memory
+    private void syncAllCategoriesFeatures() throws Exception {
+        if (!siteCategoriesFeaturesMap.containsKey(this.apiContext.getSite())) { 
+            FeaturesDownloader fd = new FeaturesDownloader(this.apiContext);
+            GetCategoryFeaturesResponseType cfrt = fd.getAllCategoryFeatures();
+            CategoryFeatureType[] categoryFeatures = cfrt.getCategory();
+            Map<String, CategoryFeatureType> cfsMap = new HashMap<String, CategoryFeatureType>(MAP_SIZE);
+            for (CategoryFeatureType cf: categoryFeatures) {
+                cfsMap.put(cf.getCategoryID(), cf);
+            }
+            siteCategoriesFeaturesMap.put(this.apiContext.getSite(), cfsMap);
+            siteFeatureDefaultMap.put(this.apiContext.getSite(), cfrt.getSiteDefaults());
+            siteFeatureDefinitionsMap.put(this.apiContext.getSite(), cfrt.getFeatureDefinitions());
+        }
+    }
+
+    /**
+     * Get categories using GetCategory2CS and GetCategories calls,
+     * and merge the categories
+     * 
+     */
+    public List<CategoryType> getAllMergedCategories() throws ApiException, SdkException, Exception {
+        //Get all categories that are mapped to characteristics sets
+        IAttributesMaster amst = this.attrMaster;
+        if (!siteCategoriesCSMap.containsKey(this.apiContext.getSite())) {
+            ICategoryCSProvider catCSProvider = new CategoryCSDownloader(this.apiContext);
+            amst.setCategoryCSProvider(catCSProvider);
+            CategoryType[] csCats = catCSProvider.getCategoriesCS();
+            Map<String, CategoryType> csCatsMap = new HashMap<String, CategoryType>(MAP_SIZE);
+            for (CategoryType cat : csCats) {
+                csCatsMap.put(cat.getCategoryID(), cat);
+            }
+
+            //Get all categories
+            Map<String, CategoryType> allCatsMap = this.getAllCategories();
+            for (CategoryType cat : allCatsMap.values()) {
+                CategoryType csCat = csCatsMap.get(cat.getCategoryID());
+                if (csCat != null) {
+                    //copy category name and leaf category fields, since these
+                    //fields are not set when using GetCategoryCS call.
+                    csCat.setCategoryName(cat.getCategoryName());
+                    csCat.setLeafCategory(cat.isLeafCategory());
+                } else {
+                    //some category has no characteristic sets, 
+                    //but it may has custom item specifics
+                    csCatsMap.put(cat.getCategoryID(), cat);
+                }
+            }
+
+            //convert the map to list
+            List<CategoryType> catsList = new LinkedList<CategoryType>();
+            for (CategoryType cat : csCatsMap.values()) {
+                catsList.add(cat);
+            }
+            siteCategoriesCSMap.put(this.apiContext.getSite(), catsList);
+            return catsList;
+        } else {
+            return siteCategoriesCSMap.get(this.apiContext.getSite());
+        }
+    }
+
+    //get all categories map
+    private Map<String, CategoryType> getAllCategories() throws Exception {
+        if (!siteCategoriesMap.containsKey(this.apiContext.getSite())) {
+            Map<String, CategoryType> catsMap = new HashMap<String, CategoryType>(30000);
+            CategoriesDownloader cd = new CategoriesDownloader(this.apiContext);
+            CategoryType[] cats = cd.getAllCategories();
+
+            for (CategoryType cat : cats) {
+                catsMap.put(cat.getCategoryID(), cat);
+            }
+            siteCategoriesMap.put(this.apiContext.getSite(), catsMap);
+            return catsMap;
+        } else {
+            return siteCategoriesMap.get(this.apiContext.getSite());
+        }
+    }
+
+    //get all categories from ebay store depend on siteId
+    private List<StoreCustomCategoryType> getEbayStoreCategories() {
+        Map<String, StoreCustomCategoryType> catsMap = new HashMap<String, StoreCustomCategoryType>(30000);
+        List<StoreCustomCategoryType> catsList = new LinkedList<StoreCustomCategoryType>();
+        try {
+            GetStoreCall call = new GetStoreCall(this.apiContext);
+            GetStoreRequestType req = new GetStoreRequestType();
+            GetStoreResponseType resp = null;
+            resp = (GetStoreResponseType) call.execute(req);
+            if (resp != null && "SUCCESS".equals(resp.getAck().toString())) {
+                StoreType store = resp.getStore();
+                StoreCustomCategoryArrayType categoriesArr = store.getCustomCategories();
+                StoreCustomCategoryType[] cateogries = categoriesArr.getCustomCategory();
+                for (StoreCustomCategoryType cat : cateogries) {
+                    String categoryId = Long.toString(cat.getCategoryID());
+                    catsMap.put(categoryId, cat);
+                }
+                for (StoreCustomCategoryType cat : catsMap.values()) {
+                    catsList.add(cat);
+                }
+                siteStoreCategoriesMap.put(this.apiContext.getSite(), catsList);
+            }
+        } catch (Exception e) {
+            return siteStoreCategoriesMap.get(this.apiContext.getSite());
+        }
+        return catsList;
+    }
+
+    public IAttributesMaster getAttrMaster() {
+        return attrMaster;
+    }
+
+    public Map<SiteCodeType, Map<String, CategoryFeatureType>> getSiteCategoriesFeaturesMap() {
+        return siteCategoriesFeaturesMap;
+    }
+
+    public Map<SiteCodeType, SiteDefaultsType> getSiteFeatureDefaultMap() {
+        return siteFeatureDefaultMap;
+    }
+
+    public Map<SiteCodeType, FeatureDefinitionsType> getSiteFeatureDefinitionsMap() {
+        return siteFeatureDefinitionsMap;
+    }
+
+    public Map<SiteCodeType, Map<String, CategoryType>> getSiteCategoriesMap() {
+        return siteCategoriesMap;
+    }
+
+    public Map<SiteCodeType, List<CategoryType>> getSiteCategoriesCSMap() {
+        return siteCategoriesCSMap;
+    }
+
+    public Map<SiteCodeType, List<StoreCustomCategoryType>> getSiteStoreCategoriesMap() {
+        return siteStoreCategoriesMap;
+    }
+
+    public Map<SiteCodeType, GeteBayDetailsResponseType> getEBayDetailsMap() {
+        return eBayDetailsMap;
+    }
+}

Propchange: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreSiteFacade.java
            ('svn:eol-style' removed)

Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/PromoStatusBar.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/PromoStatusBar.java?rev=1695126&r1=1695125&r2=1695126&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/PromoStatusBar.java (original)
+++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/PromoStatusBar.java Mon Aug 10 16:15:37 2015
@@ -1,81 +1,81 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *******************************************************************************/
-package org.ofbiz.pos.component;
-
-import java.util.Locale;
-
-import net.xoetrope.swing.XEdit;
-
-import org.ofbiz.base.util.UtilProperties;
-import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.pos.PosTransaction;
-import org.ofbiz.pos.screen.PosScreen;
-
-public class PromoStatusBar {
-    protected static PosScreen m_pos = null;
-    protected XEdit statusbarPromoCode = null;
-    protected XEdit statusbarClient = null;
-    private String customer = (UtilProperties.getMessage(PosTransaction.resource, "PosCustomer", Locale.getDefault()));
-    private String promoCode = (UtilProperties.getMessage(PosTransaction.resource, "PosPromoCode", Locale.getDefault()));
-
-
-    public PromoStatusBar(PosScreen page) {
-        m_pos = page;
-        statusbarClient = (XEdit) page.findComponent("statusbarClient");
-        statusbarClient.setFocusable(false);
-        statusbarPromoCode = (XEdit) page.findComponent("statusbarPromoCode");
-        statusbarPromoCode.setFocusable(false);
-    }
-
-    public void addPromoCode(String message) {
-        String promoCodes = statusbarPromoCode.getText();
-        if (UtilValidate.isNotEmpty(promoCodes)) {
-            statusbarPromoCode.setText(promoCodes + ", " + message);
-        } else {
-            statusbarPromoCode.setText(promoCode + " " + message);
-        }
-    }
-
-    public void displayClient(String message) {
-        statusbarClient.setText(customer + " " + message);
-    }
-
-    public void clear() {
-        if (UtilValidate.isEmpty(statusbarPromoCode.getText())) { // to handle when on another screen
-            PosScreen newPos = m_pos.showPage("promopanel");
-            PromoStatusBar promoStatusBar = newPos.getPromoStatusBar();
-            XEdit statusbarPromoCode = promoStatusBar.getStatusbarPromoCode();
-            statusbarPromoCode.setText("");
-            XEdit statusbarClient = promoStatusBar.getStatusbarClient();
-            statusbarClient.setText("");
-            m_pos.showPage("paypanel");
-        } else {
-            statusbarPromoCode.setText("");
-            statusbarClient.setText("");
-        }
-    }
-    
-    private XEdit getStatusbarPromoCode() {
-        return statusbarPromoCode;
-    }
-    
-    private XEdit getStatusbarClient() {
-        return statusbarClient;
-    }
-}
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.ofbiz.pos.component;
+
+import java.util.Locale;
+
+import net.xoetrope.swing.XEdit;
+
+import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.pos.PosTransaction;
+import org.ofbiz.pos.screen.PosScreen;
+
+public class PromoStatusBar {
+    protected static PosScreen m_pos = null;
+    protected XEdit statusbarPromoCode = null;
+    protected XEdit statusbarClient = null;
+    private String customer = (UtilProperties.getMessage(PosTransaction.resource, "PosCustomer", Locale.getDefault()));
+    private String promoCode = (UtilProperties.getMessage(PosTransaction.resource, "PosPromoCode", Locale.getDefault()));
+
+
+    public PromoStatusBar(PosScreen page) {
+        m_pos = page;
+        statusbarClient = (XEdit) page.findComponent("statusbarClient");
+        statusbarClient.setFocusable(false);
+        statusbarPromoCode = (XEdit) page.findComponent("statusbarPromoCode");
+        statusbarPromoCode.setFocusable(false);
+    }
+
+    public void addPromoCode(String message) {
+        String promoCodes = statusbarPromoCode.getText();
+        if (UtilValidate.isNotEmpty(promoCodes)) {
+            statusbarPromoCode.setText(promoCodes + ", " + message);
+        } else {
+            statusbarPromoCode.setText(promoCode + " " + message);
+        }
+    }
+
+    public void displayClient(String message) {
+        statusbarClient.setText(customer + " " + message);
+    }
+
+    public void clear() {
+        if (UtilValidate.isEmpty(statusbarPromoCode.getText())) { // to handle when on another screen
+            PosScreen newPos = m_pos.showPage("promopanel");
+            PromoStatusBar promoStatusBar = newPos.getPromoStatusBar();
+            XEdit statusbarPromoCode = promoStatusBar.getStatusbarPromoCode();
+            statusbarPromoCode.setText("");
+            XEdit statusbarClient = promoStatusBar.getStatusbarClient();
+            statusbarClient.setText("");
+            m_pos.showPage("paypanel");
+        } else {
+            statusbarPromoCode.setText("");
+            statusbarClient.setText("");
+        }
+    }
+    
+    private XEdit getStatusbarPromoCode() {
+        return statusbarPromoCode;
+    }
+    
+    private XEdit getStatusbarClient() {
+        return statusbarClient;
+    }
+}

Propchange: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/PromoStatusBar.java
            ('svn:eol-style' removed)

Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ClientProfile.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ClientProfile.java?rev=1695126&r1=1695125&r2=1695126&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ClientProfile.java (original)
+++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ClientProfile.java Mon Aug 10 16:15:37 2015
@@ -1,357 +1,357 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *******************************************************************************/
-package org.ofbiz.pos.screen;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.swing.DefaultComboBoxModel;
-
-import net.xoetrope.swing.XButton;
-import net.xoetrope.swing.XComboBox;
-import net.xoetrope.swing.XDialog;
-import net.xoetrope.swing.XEdit;
-import net.xoetrope.swing.XLabel;
-import net.xoetrope.swing.XRadioButton;
-import net.xoetrope.xui.XPage;
-import net.xoetrope.xui.events.XEventHelper;
-
-import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.base.util.UtilProperties;
-import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.entity.GenericEntityException;
-import org.ofbiz.entity.GenericValue;
-import org.ofbiz.pos.PosTransaction;
-
-
-@SuppressWarnings("serial")
-public class ClientProfile extends XPage implements ActionListener {
-
-    /**
-     * To allow searching, creating or editing a client profile (ie for now : Name, Email Address, Phone Number, Membership Card Number)
-     */
-
-    public static final String module = ClientProfile.class.getName();
-    protected static PosScreen m_pos = null;
-    protected XDialog m_dialog = null;
-    protected XLabel m_nameLabel = null;
-    protected XEdit m_nameEdit = null;
-    protected XRadioButton m_nameRadioEquals = null;
-    protected XRadioButton m_nameRadioContains = null;
-    protected XLabel m_emailLabel = null;
-    protected XEdit m_emailEdit = null;
-    protected XLabel m_phoneLabel = null;
-    protected XEdit m_phoneEdit = null;
-    protected XLabel m_cardLabel = null;
-    protected XEdit m_cardEdit = null;
-    protected XLabel m_clientListLabel = null;
-    protected XComboBox m_clientListCombo = null;
-    protected List<String> m_clientListBidingCombo = new LinkedList<String>();
-    protected XLabel m_tipLoginPwdLabel = null;
-    protected XButton m_search = null;
-    protected XButton m_create = null;
-    protected XButton m_edit = null;
-    protected XButton m_select = null;
-    protected XButton m_cancel = null;
-    protected DefaultComboBoxModel m_comboModel = null;
-    protected static PosTransaction m_trans = null;
-    protected String m_type = null;
-    protected boolean cancelled = false;
-    private static final Boolean SWIP_WITH_CARD = UtilProperties.propertyValueEqualsIgnoreCase("parameters", "SwipWithCard", "Y");
-    private static final String START_SENTINEL = UtilProperties.getPropertyValue("parameters", "StartSentinel", ";");
-    private static final String END_SENTINEL = UtilProperties.getPropertyValue("parameters", "EndSentinel", "?");
-    private static Locale locale = Locale.getDefault();
-    private String m_partyId = null;
-
-    //TODO : make getter and setter for members (ie m_*) if needed (extern calls). For that in Eclipse use Source/Generate Getters and setters
-
-    public ClientProfile(PosTransaction trans, PosScreen page) {
-        m_trans = trans;
-        m_pos = page;
-    }
-
-    public void openDlg() {
-        m_dialog = (XDialog) pageMgr.loadPage(m_pos.getScreenLocation() + "/dialog/ClientProfile");
-
-        m_nameEdit = (XEdit) m_dialog.findComponent("nameEdit"); // 1st for focus (still does not work)
-        m_nameLabel = (XLabel) m_dialog.findComponent("nameLabel");
-        m_nameRadioEquals = (XRadioButton) m_dialog.findComponent("NameRadioEquals");
-        m_nameRadioEquals.setToolTipText(UtilProperties.getMessage(PosTransaction.resource, "PosTipNameRadioEquals", locale));
-        m_nameRadioContains = (XRadioButton) m_dialog.findComponent("NameRadioContain");
-        m_nameRadioContains.setToolTipText(UtilProperties.getMessage(PosTransaction.resource, "PosTipNameRadioContains", locale));
-
-        m_emailLabel = (XLabel) m_dialog.findComponent("emailLabel");
-        m_emailEdit = (XEdit) m_dialog.findComponent("emailEdit");
-        m_phoneLabel = (XLabel) m_dialog.findComponent("phoneLabel");
-        m_phoneEdit = (XEdit) m_dialog.findComponent("phoneEdit");
-        m_cardLabel = (XLabel) m_dialog.findComponent("cardLabel");
-        m_cardEdit = (XEdit) m_dialog.findComponent("cardEdit");
-
-        m_clientListLabel = (XLabel) m_dialog.findComponent("clientListLabel");
-        m_clientListCombo = (XComboBox) m_dialog.findComponent("clientListCombo");
-
-        m_tipLoginPwdLabel = (XLabel) m_dialog.findComponent("tipLoginPwdLabel");
-
-        m_search = (XButton) m_dialog.findComponent("BtnSearch");
-        m_create = (XButton) m_dialog.findComponent("BtnCreate");
-        m_edit = (XButton) m_dialog.findComponent("BtnEdit");
-        m_select = (XButton) m_dialog.findComponent("BtnSelect");
-        m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
-
-        XEventHelper.addMouseHandler(this, m_search, "search");
-        XEventHelper.addMouseHandler(this, m_create, "edit(create)");
-        XEventHelper.addMouseHandler(this, m_edit, "edit(update)");
-        XEventHelper.addMouseHandler(this, m_select, "select");
-        XEventHelper.addMouseHandler(this, m_cancel, "cancel");
-        XEventHelper.addMouseHandler(this, m_nameEdit, "editName");
-        XEventHelper.addMouseHandler(this, m_emailEdit, "editEmail");
-        XEventHelper.addMouseHandler(this, m_phoneEdit, "editPhone");
-        XEventHelper.addMouseHandler(this, m_cardEdit, "editCard");
-
-        m_comboModel = new DefaultComboBoxModel();
-        m_dialog.setCaption(UtilProperties.getMessage(PosTransaction.resource, "PosClientProfile", locale));
-        m_clientListCombo.setModel(m_comboModel);
-        m_clientListCombo.setToolTipText(UtilProperties.getMessage(PosTransaction.resource, "PosSelectClientToEdit", locale));
-        m_clientListCombo.addActionListener(this);
-
-        m_dialog.pack();
-        m_nameEdit.requestFocusInWindow();
-        m_dialog.showDialog(this);
-        if (!cancelled) {
-            GenericValue  person = null;
-            try {
-                person = m_trans.getSession().getDelegator().findOne("Person", UtilMisc.toMap("partyId", m_partyId), false);
-            } catch (GenericEntityException e) {
-                Debug.logError(e, module);
-            }
-            if (UtilValidate.isNotEmpty(person)) {
-                String cardId = person.getString("cardId");
-                if (UtilValidate.isNotEmpty(cardId)) {
-                    String partyId = m_trans.getPartyId();
-                    m_trans.setPartyId(m_partyId);
-                    String result = m_trans.addProductPromoCode(cardId);
-                    if (UtilValidate.isEmpty(result)) {
-                        m_pos.getPromoStatusBar().displayClient(person.getString("lastName"));
-                        m_pos.getPromoStatusBar().addPromoCode(cardId);
-                    } else {
-                        m_trans.setPartyId(partyId);
-                        m_pos.showDialog("dialog/error/exception", result);
-                    }
-                }
-            }
-        }
-    }
-
-    public synchronized void cancel() {
-        if (wasMouseClicked()) {
-            cancelled = true;
-            m_dialog.closeDlg();
-        }
-    }
-
-    public synchronized void editName() {
-        if (wasMouseClicked() && UtilProperties.propertyValueEqualsIgnoreCase("parameters", "ShowKeyboardInSaveSale", "Y")) {
-            try {
-                Keyboard keyboard = new Keyboard(m_pos);
-                keyboard.setText(m_nameEdit.getText());
-                m_nameEdit.setText(keyboard.openDlg());
-            } catch (Exception e) {
-                Debug.logError(e, module);
-            }
-            m_dialog.repaint();
-        }
-        return;
-    }
-
-    public synchronized void editEmail() {
-        if (wasMouseClicked() && UtilProperties.propertyValueEqualsIgnoreCase("parameters", "ShowKeyboardInSaveSale", "Y")) {
-            try {
-                Keyboard keyboard = new Keyboard(m_pos);
-                keyboard.setText(m_emailEdit.getText());
-                m_emailEdit.setText(keyboard.openDlg());
-            } catch (Exception e) {
-                Debug.logError(e, module);
-            }
-            m_dialog.repaint();
-        }
-        return;
-    }
-
-    public synchronized void editPhone() {
-        if (wasMouseClicked() && UtilProperties.propertyValueEqualsIgnoreCase("parameters", "ShowKeyboardInSaveSale", "Y")) {
-            try {
-                NumericKeypad numericKeypad = new NumericKeypad(m_pos);
-                numericKeypad.setMinus(false); // this order must be respected
-                numericKeypad.setPercent(false);
-                numericKeypad.setText(m_phoneEdit.getText());
-                m_phoneEdit.setText(numericKeypad.openDlg());
-            } catch (Exception e) {
-                Debug.logError(e, module);
-            }
-            m_dialog.repaint();
-        }
-        return;
-    }
-
-
-
-    public synchronized void editCard() {
-        if (wasMouseClicked() && UtilProperties.propertyValueEqualsIgnoreCase("parameters", "ShowKeyboardInSaveSale", "Y") && !SWIP_WITH_CARD) {
-            try {
-                NumericKeypad numericKeypad = new NumericKeypad(m_pos);
-                numericKeypad.setMinus(false); // this order must be respected
-                numericKeypad.setPercent(false);
-                numericKeypad.setText(m_cardEdit.getText());
-                m_cardEdit.setText(numericKeypad.openDlg());
-            } catch (Exception e) {
-                Debug.logError(e, module);
-            }
-            m_dialog.repaint();
-        } else {
-            String card = m_cardEdit.getText();
-            if (SWIP_WITH_CARD && UtilValidate.isNotEmpty(m_cardEdit.getText())
-                    && (card.startsWith(START_SENTINEL) && card.endsWith(END_SENTINEL))) {
-                m_cardEdit.setText(card.substring(1, card.length() - 1));
-            }
-        }
-
-        return;
-    }
-
-    public synchronized void search() {
-        if (wasMouseClicked()) {
-            String name = m_nameEdit.getText().trim();
-            String email = m_emailEdit.getText().trim();
-            String phone = m_phoneEdit.getText().trim();
-            String card = m_cardEdit.getText().trim();
-            searchClientProfile(name, email, phone, card);
-        }
-    }
-
-    public synchronized void edit(String editType) {
-        if (wasMouseClicked()) {
-            String name = m_nameEdit.getText().trim();
-            String email = m_emailEdit.getText().trim();
-            String phone = m_phoneEdit.getText().trim();
-            String card = m_cardEdit.getText().trim();
-            if (UtilValidate.isNotEmpty(name)) {
-                if (UtilValidate.isNotEmpty(card) && SWIP_WITH_CARD &&  card.startsWith(START_SENTINEL) && card.endsWith(END_SENTINEL)) {
-                    card = card.substring(1, card.length() - 1);
-                }
-                editClientProfile(name, email, phone, card, editType, m_partyId);
-            } else {
-                m_pos.showDialog("dialog/error/exception", UtilProperties.getMessage(PosTransaction.resource, "PosFieldsRequired", locale));
-            }
-        }
-    }
-
-    private void searchClientProfile(String name, String email, String  phone, String card) {
-        final ClassLoader cl = this.getClassLoader(m_pos);
-        Thread.currentThread().setContextClassLoader(cl);
-        Boolean equalsName = m_nameRadioEquals.isSelected();
-        List<Map<String, String>> partyList = m_trans.searchClientProfile(name, email, phone, card, m_pos, equalsName);
-        boolean first = true;
-        m_clientListCombo.removeAll();
-        m_clientListBidingCombo.clear();
-        if (UtilValidate.isNotEmpty(partyList)) {
-            for (Map<String, String> party : partyList) {
-                name = party.get("lastName");
-                email = party.get("infoString");
-                phone = party.get("contactNumber");
-                String partyId = party.get("partyId");
-                m_clientListBidingCombo.add(partyId);
-                card = party.get("cardId");
-                name = name == null ? "" : name;
-                email = email == null ? "" : email;
-                phone = phone == null ? "" : phone;
-                card = card == null ? "" : card;
-                if (first) { // Most of the time the 1st is enough...
-                    m_nameEdit.setText(name);
-                    m_emailEdit.setText(email);
-                    m_phoneEdit.setText(phone);
-                    m_cardEdit.setText(card);
-                    m_partyId = partyId;
-                }
-                m_clientListCombo.addItem(name + " | " + email + " | " + phone + " | " + card);
-
-                first = false;
-            }
-        }
-    }
-
-    public void actionPerformed(ActionEvent e) {
-        XComboBox clientListCombo = (XComboBox) e.getSource();
-        String client = (String) clientListCombo.getSelectedItem();
-        if (UtilValidate.isNotEmpty(client)) {
-            String[] clientInfos = client.split(" \\| ");
-            String name = clientInfos.length > 0 ? clientInfos[0] : "";
-            String email = clientInfos.length > 1 ? clientInfos[1] : "";
-            String phone = clientInfos.length > 2 ? clientInfos[2] : "";
-            String card = clientInfos.length > 3 ? clientInfos[3] : "";
-            if (UtilValidate.isNotEmpty(card) && SWIP_WITH_CARD &&  card.startsWith(START_SENTINEL) && card.endsWith(END_SENTINEL)) {
-                card = card.substring(1, card.length() - 1);
-            }
-            m_nameEdit.setText(name);
-            m_emailEdit.setText(email);
-            m_phoneEdit.setText(phone);
-            m_cardEdit.setText(card);
-            m_partyId = m_clientListBidingCombo.get(clientListCombo.getSelectedIndex());
-        }
-    }
-
-    private void editClientProfile(String name, String email,String  phone, String card, String editType, String partyId) {
-        final ClassLoader cl = this.getClassLoader(m_pos);
-        Thread.currentThread().setContextClassLoader(cl);
-        String result = m_trans.editClientProfile(name, email, phone, card, m_pos, editType, partyId);
-        if (UtilValidate.isNotEmpty(result)) { // new party ?
-            m_partyId = result;
-        }
-        searchClientProfile(name, email, phone, card); // Only to update the combo
-    }
-
-    public synchronized void select() {
-        if (wasMouseClicked() && UtilValidate.isNotEmpty(m_partyId)) {
-            m_dialog.closeDlg();
-        }
-    }
-
-    private ClassLoader getClassLoader(PosScreen pos) {
-        ClassLoader cl = pos.getClassLoader();
-        if (cl == null) {
-            try {
-                cl = Thread.currentThread().getContextClassLoader();
-            } catch (Throwable t) {
-            }
-            if (cl == null) {
-                Debug.logInfo("No context classloader available; using class classloader", module);
-                try {
-                    cl = this.getClass().getClassLoader();
-                } catch (Throwable t) {
-                    Debug.logError(t, module);
-                }
-            }
-        }
-        return cl;
-    }
-}
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.ofbiz.pos.screen;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.swing.DefaultComboBoxModel;
+
+import net.xoetrope.swing.XButton;
+import net.xoetrope.swing.XComboBox;
+import net.xoetrope.swing.XDialog;
+import net.xoetrope.swing.XEdit;
+import net.xoetrope.swing.XLabel;
+import net.xoetrope.swing.XRadioButton;
+import net.xoetrope.xui.XPage;
+import net.xoetrope.xui.events.XEventHelper;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.GenericValue;
+import org.ofbiz.pos.PosTransaction;
+
+
+@SuppressWarnings("serial")
+public class ClientProfile extends XPage implements ActionListener {
+
+    /**
+     * To allow searching, creating or editing a client profile (ie for now : Name, Email Address, Phone Number, Membership Card Number)
+     */
+
+    public static final String module = ClientProfile.class.getName();
+    protected static PosScreen m_pos = null;
+    protected XDialog m_dialog = null;
+    protected XLabel m_nameLabel = null;
+    protected XEdit m_nameEdit = null;
+    protected XRadioButton m_nameRadioEquals = null;
+    protected XRadioButton m_nameRadioContains = null;
+    protected XLabel m_emailLabel = null;
+    protected XEdit m_emailEdit = null;
+    protected XLabel m_phoneLabel = null;
+    protected XEdit m_phoneEdit = null;
+    protected XLabel m_cardLabel = null;
+    protected XEdit m_cardEdit = null;
+    protected XLabel m_clientListLabel = null;
+    protected XComboBox m_clientListCombo = null;
+    protected List<String> m_clientListBidingCombo = new LinkedList<String>();
+    protected XLabel m_tipLoginPwdLabel = null;
+    protected XButton m_search = null;
+    protected XButton m_create = null;
+    protected XButton m_edit = null;
+    protected XButton m_select = null;
+    protected XButton m_cancel = null;
+    protected DefaultComboBoxModel m_comboModel = null;
+    protected static PosTransaction m_trans = null;
+    protected String m_type = null;
+    protected boolean cancelled = false;
+    private static final Boolean SWIP_WITH_CARD = UtilProperties.propertyValueEqualsIgnoreCase("parameters", "SwipWithCard", "Y");
+    private static final String START_SENTINEL = UtilProperties.getPropertyValue("parameters", "StartSentinel", ";");
+    private static final String END_SENTINEL = UtilProperties.getPropertyValue("parameters", "EndSentinel", "?");
+    private static Locale locale = Locale.getDefault();
+    private String m_partyId = null;
+
+    //TODO : make getter and setter for members (ie m_*) if needed (extern calls). For that in Eclipse use Source/Generate Getters and setters
+
+    public ClientProfile(PosTransaction trans, PosScreen page) {
+        m_trans = trans;
+        m_pos = page;
+    }
+
+    public void openDlg() {
+        m_dialog = (XDialog) pageMgr.loadPage(m_pos.getScreenLocation() + "/dialog/ClientProfile");
+
+        m_nameEdit = (XEdit) m_dialog.findComponent("nameEdit"); // 1st for focus (still does not work)
+        m_nameLabel = (XLabel) m_dialog.findComponent("nameLabel");
+        m_nameRadioEquals = (XRadioButton) m_dialog.findComponent("NameRadioEquals");
+        m_nameRadioEquals.setToolTipText(UtilProperties.getMessage(PosTransaction.resource, "PosTipNameRadioEquals", locale));
+        m_nameRadioContains = (XRadioButton) m_dialog.findComponent("NameRadioContain");
+        m_nameRadioContains.setToolTipText(UtilProperties.getMessage(PosTransaction.resource, "PosTipNameRadioContains", locale));
+
+        m_emailLabel = (XLabel) m_dialog.findComponent("emailLabel");
+        m_emailEdit = (XEdit) m_dialog.findComponent("emailEdit");
+        m_phoneLabel = (XLabel) m_dialog.findComponent("phoneLabel");
+        m_phoneEdit = (XEdit) m_dialog.findComponent("phoneEdit");
+        m_cardLabel = (XLabel) m_dialog.findComponent("cardLabel");
+        m_cardEdit = (XEdit) m_dialog.findComponent("cardEdit");
+
+        m_clientListLabel = (XLabel) m_dialog.findComponent("clientListLabel");
+        m_clientListCombo = (XComboBox) m_dialog.findComponent("clientListCombo");
+
+        m_tipLoginPwdLabel = (XLabel) m_dialog.findComponent("tipLoginPwdLabel");
+
+        m_search = (XButton) m_dialog.findComponent("BtnSearch");
+        m_create = (XButton) m_dialog.findComponent("BtnCreate");
+        m_edit = (XButton) m_dialog.findComponent("BtnEdit");
+        m_select = (XButton) m_dialog.findComponent("BtnSelect");
+        m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
+
+        XEventHelper.addMouseHandler(this, m_search, "search");
+        XEventHelper.addMouseHandler(this, m_create, "edit(create)");
+        XEventHelper.addMouseHandler(this, m_edit, "edit(update)");
+        XEventHelper.addMouseHandler(this, m_select, "select");
+        XEventHelper.addMouseHandler(this, m_cancel, "cancel");
+        XEventHelper.addMouseHandler(this, m_nameEdit, "editName");
+        XEventHelper.addMouseHandler(this, m_emailEdit, "editEmail");
+        XEventHelper.addMouseHandler(this, m_phoneEdit, "editPhone");
+        XEventHelper.addMouseHandler(this, m_cardEdit, "editCard");
+
+        m_comboModel = new DefaultComboBoxModel();
+        m_dialog.setCaption(UtilProperties.getMessage(PosTransaction.resource, "PosClientProfile", locale));
+        m_clientListCombo.setModel(m_comboModel);
+        m_clientListCombo.setToolTipText(UtilProperties.getMessage(PosTransaction.resource, "PosSelectClientToEdit", locale));
+        m_clientListCombo.addActionListener(this);
+
+        m_dialog.pack();
+        m_nameEdit.requestFocusInWindow();
+        m_dialog.showDialog(this);
+        if (!cancelled) {
+            GenericValue  person = null;
+            try {
+                person = m_trans.getSession().getDelegator().findOne("Person", UtilMisc.toMap("partyId", m_partyId), false);
+            } catch (GenericEntityException e) {
+                Debug.logError(e, module);
+            }
+            if (UtilValidate.isNotEmpty(person)) {
+                String cardId = person.getString("cardId");
+                if (UtilValidate.isNotEmpty(cardId)) {
+                    String partyId = m_trans.getPartyId();
+                    m_trans.setPartyId(m_partyId);
+                    String result = m_trans.addProductPromoCode(cardId);
+                    if (UtilValidate.isEmpty(result)) {
+                        m_pos.getPromoStatusBar().displayClient(person.getString("lastName"));
+                        m_pos.getPromoStatusBar().addPromoCode(cardId);
+                    } else {
+                        m_trans.setPartyId(partyId);
+                        m_pos.showDialog("dialog/error/exception", result);
+                    }
+                }
+            }
+        }
+    }
+
+    public synchronized void cancel() {
+        if (wasMouseClicked()) {
+            cancelled = true;
+            m_dialog.closeDlg();
+        }
+    }
+
+    public synchronized void editName() {
+        if (wasMouseClicked() && UtilProperties.propertyValueEqualsIgnoreCase("parameters", "ShowKeyboardInSaveSale", "Y")) {
+            try {
+                Keyboard keyboard = new Keyboard(m_pos);
+                keyboard.setText(m_nameEdit.getText());
+                m_nameEdit.setText(keyboard.openDlg());
+            } catch (Exception e) {
+                Debug.logError(e, module);
+            }
+            m_dialog.repaint();
+        }
+        return;
+    }
+
+    public synchronized void editEmail() {
+        if (wasMouseClicked() && UtilProperties.propertyValueEqualsIgnoreCase("parameters", "ShowKeyboardInSaveSale", "Y")) {
+            try {
+                Keyboard keyboard = new Keyboard(m_pos);
+                keyboard.setText(m_emailEdit.getText());
+                m_emailEdit.setText(keyboard.openDlg());
+            } catch (Exception e) {
+                Debug.logError(e, module);
+            }
+            m_dialog.repaint();
+        }
+        return;
+    }
+
+    public synchronized void editPhone() {
+        if (wasMouseClicked() && UtilProperties.propertyValueEqualsIgnoreCase("parameters", "ShowKeyboardInSaveSale", "Y")) {
+            try {
+                NumericKeypad numericKeypad = new NumericKeypad(m_pos);
+                numericKeypad.setMinus(false); // this order must be respected
+                numericKeypad.setPercent(false);
+                numericKeypad.setText(m_phoneEdit.getText());
+                m_phoneEdit.setText(numericKeypad.openDlg());
+            } catch (Exception e) {
+                Debug.logError(e, module);
+            }
+            m_dialog.repaint();
+        }
+        return;
+    }
+
+
+
+    public synchronized void editCard() {
+        if (wasMouseClicked() && UtilProperties.propertyValueEqualsIgnoreCase("parameters", "ShowKeyboardInSaveSale", "Y") && !SWIP_WITH_CARD) {
+            try {
+                NumericKeypad numericKeypad = new NumericKeypad(m_pos);
+                numericKeypad.setMinus(false); // this order must be respected
+                numericKeypad.setPercent(false);
+                numericKeypad.setText(m_cardEdit.getText());
+                m_cardEdit.setText(numericKeypad.openDlg());
+            } catch (Exception e) {
+                Debug.logError(e, module);
+            }
+            m_dialog.repaint();
+        } else {
+            String card = m_cardEdit.getText();
+            if (SWIP_WITH_CARD && UtilValidate.isNotEmpty(m_cardEdit.getText())
+                    && (card.startsWith(START_SENTINEL) && card.endsWith(END_SENTINEL))) {
+                m_cardEdit.setText(card.substring(1, card.length() - 1));
+            }
+        }
+
+        return;
+    }
+
+    public synchronized void search() {
+        if (wasMouseClicked()) {
+            String name = m_nameEdit.getText().trim();
+            String email = m_emailEdit.getText().trim();
+            String phone = m_phoneEdit.getText().trim();
+            String card = m_cardEdit.getText().trim();
+            searchClientProfile(name, email, phone, card);
+        }
+    }
+
+    public synchronized void edit(String editType) {
+        if (wasMouseClicked()) {
+            String name = m_nameEdit.getText().trim();
+            String email = m_emailEdit.getText().trim();
+            String phone = m_phoneEdit.getText().trim();
+            String card = m_cardEdit.getText().trim();
+            if (UtilValidate.isNotEmpty(name)) {
+                if (UtilValidate.isNotEmpty(card) && SWIP_WITH_CARD &&  card.startsWith(START_SENTINEL) && card.endsWith(END_SENTINEL)) {
+                    card = card.substring(1, card.length() - 1);
+                }
+                editClientProfile(name, email, phone, card, editType, m_partyId);
+            } else {
+                m_pos.showDialog("dialog/error/exception", UtilProperties.getMessage(PosTransaction.resource, "PosFieldsRequired", locale));
+            }
+        }
+    }
+
+    private void searchClientProfile(String name, String email, String  phone, String card) {
+        final ClassLoader cl = this.getClassLoader(m_pos);
+        Thread.currentThread().setContextClassLoader(cl);
+        Boolean equalsName = m_nameRadioEquals.isSelected();
+        List<Map<String, String>> partyList = m_trans.searchClientProfile(name, email, phone, card, m_pos, equalsName);
+        boolean first = true;
+        m_clientListCombo.removeAll();
+        m_clientListBidingCombo.clear();
+        if (UtilValidate.isNotEmpty(partyList)) {
+            for (Map<String, String> party : partyList) {
+                name = party.get("lastName");
+                email = party.get("infoString");
+                phone = party.get("contactNumber");
+                String partyId = party.get("partyId");
+                m_clientListBidingCombo.add(partyId);
+                card = party.get("cardId");
+                name = name == null ? "" : name;
+                email = email == null ? "" : email;
+                phone = phone == null ? "" : phone;
+                card = card == null ? "" : card;
+                if (first) { // Most of the time the 1st is enough...
+                    m_nameEdit.setText(name);
+                    m_emailEdit.setText(email);
+                    m_phoneEdit.setText(phone);
+                    m_cardEdit.setText(card);
+                    m_partyId = partyId;
+                }
+                m_clientListCombo.addItem(name + " | " + email + " | " + phone + " | " + card);
+
+                first = false;
+            }
+        }
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        XComboBox clientListCombo = (XComboBox) e.getSource();
+        String client = (String) clientListCombo.getSelectedItem();
+        if (UtilValidate.isNotEmpty(client)) {
+            String[] clientInfos = client.split(" \\| ");
+            String name = clientInfos.length > 0 ? clientInfos[0] : "";
+            String email = clientInfos.length > 1 ? clientInfos[1] : "";
+            String phone = clientInfos.length > 2 ? clientInfos[2] : "";
+            String card = clientInfos.length > 3 ? clientInfos[3] : "";
+            if (UtilValidate.isNotEmpty(card) && SWIP_WITH_CARD &&  card.startsWith(START_SENTINEL) && card.endsWith(END_SENTINEL)) {
+                card = card.substring(1, card.length() - 1);
+            }
+            m_nameEdit.setText(name);
+            m_emailEdit.setText(email);
+            m_phoneEdit.setText(phone);
+            m_cardEdit.setText(card);
+            m_partyId = m_clientListBidingCombo.get(clientListCombo.getSelectedIndex());
+        }
+    }
+
+    private void editClientProfile(String name, String email,String  phone, String card, String editType, String partyId) {
+        final ClassLoader cl = this.getClassLoader(m_pos);
+        Thread.currentThread().setContextClassLoader(cl);
+        String result = m_trans.editClientProfile(name, email, phone, card, m_pos, editType, partyId);
+        if (UtilValidate.isNotEmpty(result)) { // new party ?
+            m_partyId = result;
+        }
+        searchClientProfile(name, email, phone, card); // Only to update the combo
+    }
+
+    public synchronized void select() {
+        if (wasMouseClicked() && UtilValidate.isNotEmpty(m_partyId)) {
+            m_dialog.closeDlg();
+        }
+    }
+
+    private ClassLoader getClassLoader(PosScreen pos) {
+        ClassLoader cl = pos.getClassLoader();
+        if (cl == null) {
+            try {
+                cl = Thread.currentThread().getContextClassLoader();
+            } catch (Throwable t) {
+            }
+            if (cl == null) {
+                Debug.logInfo("No context classloader available; using class classloader", module);
+                try {
+                    cl = this.getClass().getClassLoader();
+                } catch (Throwable t) {
+                    Debug.logError(t, module);
+                }
+            }
+        }
+        return cl;
+    }
+}

Propchange: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ClientProfile.java
            ('svn:eol-style' removed)