public static String manufacturerUrl(String id) { ItemSearch itemSearch = new ItemSearch(); ArrayList<String> ids = new ArrayList<>(); ids.add(id); itemSearch.setManufacturerIds(ids); return UrlUtils.browseUrl(itemSearch, null); }
public static String browseToModel(ItemSearch itemSearch, String name) { ModelSearch modelSearch = new ModelSearch(); if (itemSearch.getCategoryIds() != null && !itemSearch.getCategoryIds().isEmpty()) { modelSearch.setCategoryId(itemSearch.getCategoryIds().get(0)); } modelSearch.setKeyword(itemSearch.getKeyword()); modelSearch.setManufacturerIds(itemSearch.getManufacturerIds()); modelSearch.setProperties(itemSearch.getProperties()); return UrlUtils.modelBrowseUrl(modelSearch, name); }
public static String browseToItem(ModelSearch modelSearch, String name) { ItemSearch itemSearch = new ItemSearch(); if (modelSearch.getCategoryId() != null && !modelSearch.getCategoryId().trim().equals("")) { itemSearch.setCategoryIds(new ArrayList<String>()); itemSearch.getCategoryIds().add(modelSearch.getCategoryId()); } itemSearch.setKeyword(modelSearch.getKeyword()); itemSearch.setManufacturerIds(modelSearch.getManufacturerIds()); itemSearch.setProperties(modelSearch.getProperties()); return UrlUtils.browseUrl(itemSearch, name); }
public static String shopBrowseUrl(ItemSearch sourceItemSearch, String alias, String strChange) { ItemSearch itemSearch; try { itemSearch = (ItemSearch) BeanUtils.cloneBean(sourceItemSearch); } catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException ex) { itemSearch = new ItemSearch(); } if (strChange != null && !strChange.equals("")) { List<Map<String, String>> changes = (List<Map<String, String>>) JsonUtils.decode(strChange, new TypeToken<List<Map<String, String>>>() {}.getType()); for (Map<String, String> ch : changes) { String op = ch.get("op"); String key = ch.get("key"); String val = ch.get("val"); if (key.equals("cid")) { itemSearch.setShopCategoryId(val); } if (key.equals("keyword")) { if (op.equals("mk")) { itemSearch.setKeyword(val); } else if (op.equals("rm")) { itemSearch.setKeyword(null); } } if (key.equals("promotionId")) { if (op.equals("mk")) { itemSearch.setPromotionId(val); } else if (op.equals("rm")) { itemSearch.setPromotionId(null); } } if (key.equals("order")) { try { itemSearch.setOrderBy(Integer.parseInt(val)); } catch (NumberFormatException ex) { } } if (key.equals("page")) { try { itemSearch.setPageIndex(Integer.parseInt(val)); } catch (NumberFormatException ex) { } } } } return UrlUtils.shopBrowseUrl(itemSearch, alias); }
public static String modelBrowseUrl( ModelSearch sourceModelSearch, String name, String strChange) { ModelSearch modelSearch; try { modelSearch = (ModelSearch) BeanUtils.cloneBean(sourceModelSearch); modelSearch.setManufacturerIds(new ArrayList<>(sourceModelSearch.getManufacturerIds())); modelSearch.setProperties(new ArrayList<>(sourceModelSearch.getProperties())); } catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException ex) { modelSearch = new ModelSearch(); } if (strChange != null && !strChange.equals("")) { List<Map<String, String>> changes = (List<Map<String, String>>) JsonUtils.decode(strChange, new TypeToken<List<Map<String, String>>>() {}.getType()); for (Map<String, String> ch : changes) { String op = ch.get("op"); String key = ch.get("key"); String val = ch.get("val"); if (key.equals("cid")) { modelSearch.setCategoryId(val); } if (key.equals("keyword")) { if (op.equals("mk")) { modelSearch.setKeyword(val); } else if (op.equals("rm")) { modelSearch.setKeyword(null); } } if (key.equals("manufacturers")) { if (op.equals("mk")) { modelSearch.getManufacturerIds().remove(val); modelSearch.getManufacturerIds().add(val); } else if (op.equals("rm")) { modelSearch.getManufacturerIds().remove(val); } else if (op.equals("cl")) { modelSearch.getManufacturerIds().clear(); } } if (key.equals("properties")) { PropertySearch ps = (PropertySearch) JsonUtils.decode(val, new TypeToken<PropertySearch>() {}.getType()); if (op.equals("mk")) { modelSearch.getProperties().remove(ps); modelSearch.getProperties().add(ps); } else if (op.equals("rm")) { modelSearch.getProperties().remove(ps); } else if (op.equals("cl")) { modelSearch.getProperties().clear(); } } if (key.equals("order")) { try { modelSearch.setOrderBy(Integer.parseInt(val)); } catch (NumberFormatException ex) { } } if (key.equals("page")) { try { modelSearch.setPageIndex(Integer.parseInt(val)); } catch (NumberFormatException ex) { } } } } return UrlUtils.modelBrowseUrl(modelSearch, name); }
public static String browse(String id, String name) { ItemSearch itemSearch = new ItemSearch(); itemSearch.setCategoryIds(new ArrayList<String>()); itemSearch.getCategoryIds().add(id); return UrlUtils.browseUrl(itemSearch, name); }
public static String browseUrl(ItemSearch sourceItemSearch, String name, String strChange) { ItemSearch itemSearch; try { itemSearch = (ItemSearch) BeanUtils.cloneBean(sourceItemSearch); itemSearch.setManufacturerIds(new ArrayList<>(sourceItemSearch.getManufacturerIds())); itemSearch.setModelIds(new ArrayList<>(sourceItemSearch.getModelIds())); itemSearch.setCityIds(new ArrayList<>(sourceItemSearch.getCityIds())); itemSearch.setProperties(new ArrayList<>(sourceItemSearch.getProperties())); } catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException ex) { itemSearch = new ItemSearch(); } if (strChange != null && !strChange.equals("")) { List<Map<String, String>> changes = (List<Map<String, String>>) JsonUtils.decode(strChange, new TypeToken<List<Map<String, String>>>() {}.getType()); for (Map<String, String> ch : changes) { String op = ch.get("op"); String key = ch.get("key"); String val = ch.get("val"); if (key.equals("cid")) { if (op.equals("mk")) { itemSearch.setCategoryIds(new ArrayList<String>()); itemSearch.getCategoryIds().add(val); } else if (op.equals("rm")) { itemSearch.setCategoryIds(null); itemSearch.setCategoryId(null); } } if (key.equals("keyword")) { if (op.equals("mk")) { itemSearch.setKeyword(val); } else if (op.equals("rm")) { itemSearch.setKeyword(null); } } if (key.equals("sellerId")) { if (op.equals("mk")) { itemSearch.setSellerId(val); } else if (op.equals("rm")) { itemSearch.setSellerId(null); } } if (key.equals("manufacturers")) { if (op.equals("mk")) { itemSearch.getManufacturerIds().remove(val); itemSearch.getManufacturerIds().add(val); } else if (op.equals("rm")) { itemSearch.getManufacturerIds().remove(val); } else if (op.equals("cl")) { itemSearch.getManufacturerIds().clear(); } } if (key.equals("models")) { if (op.equals("mk")) { itemSearch.getModelIds().remove(val); itemSearch.getModelIds().add(val); } else if (op.equals("rm")) { itemSearch.getModelIds().remove(val); } else if (op.equals("cl")) { itemSearch.getModelIds().clear(); } } if (key.equals("cities")) { if (op.equals("mk")) { itemSearch.getCityIds().remove(val); itemSearch.getCityIds().add(val); } else if (op.equals("rm")) { itemSearch.getCityIds().remove(val); } else if (op.equals("cl")) { itemSearch.getCityIds().clear(); } } if (key.equals("properties")) { PropertySearch ps = (PropertySearch) JsonUtils.decode(val, new TypeToken<PropertySearch>() {}.getType()); if (op.equals("mk")) { itemSearch.getProperties().remove(ps); itemSearch.getProperties().add(ps); } else if (op.equals("rm")) { itemSearch.getProperties().remove(ps); } else if (op.equals("cl")) { itemSearch.getProperties().clear(); } } if (key.equals("freeship")) { if (op.equals("mk")) { itemSearch.setFreeShip(true); } else if (op.equals("rm")) { itemSearch.setFreeShip(false); } } if (key.equals("cod")) { if (op.equals("mk")) { itemSearch.setCod(true); } else if (op.equals("rm")) { itemSearch.setCod(false); } } if (key.equals("onlinepayment")) { if (op.equals("mk")) { itemSearch.setOnlinePayment(true); } else if (op.equals("rm")) { itemSearch.setOnlinePayment(false); } } if (key.equals("promotion")) { if (op.equals("mk")) { itemSearch.setPromotion(true); } else if (op.equals("rm")) { itemSearch.setPromotion(false); } } if (key.equals("promotionId")) { if (op.equals("mk")) { itemSearch.setPromotionId(val); } else if (op.equals("rm")) { itemSearch.setPromotionId(null); } } if (key.equals("type")) { try { if (val.equals("BUYNOW")) { itemSearch.setListingType(ListingType.BUYNOW); } else if (val.equals("AUCTION")) { itemSearch.setListingType(ListingType.AUCTION); } else { itemSearch.setListingType(null); } } catch (NumberFormatException ex) { } } if (key.equals("condition")) { try { if (val.equals("NEW")) { itemSearch.setCondition(Condition.NEW); } else if (val.equals("OLD")) { itemSearch.setCondition(Condition.OLD); } else { itemSearch.setCondition(null); } } catch (NumberFormatException ex) { } } if (key.equals("pricefrom")) { try { itemSearch.setPriceFrom(Integer.parseInt(val)); } catch (NumberFormatException ex) { } } if (key.equals("priceto")) { try { itemSearch.setPriceTo(Integer.parseInt(val)); } catch (NumberFormatException ex) { } } if (key.equals("order")) { try { itemSearch.setOrderBy(Integer.parseInt(val)); } catch (NumberFormatException ex) { } } if (key.equals("page")) { try { itemSearch.setPageIndex(Integer.parseInt(val)); } catch (NumberFormatException ex) { } } } } return UrlUtils.browseUrl(itemSearch, name); }