Android Open Source - Grocery-Mate Gorcery Mate Uri Handler






From Project

Back to project page Grocery-Mate.

License

The source code is released under:

Apache License

If you think the Android project Grocery-Mate listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
* Copyright (C) 2011 iMellon/*from   w ww .ja  v  a 2s  .  c  o m*/
*
* 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 com.imellon.android.grocerymate.util;

import java.util.Formatter;

/**
* @author Christos Papazafeiropoulos, Dimitris Makris
*/

public class GorceryMateUriHandler {
  private static final String productList = "http://epriceservice.cloudapp.net/PriceServices.svc/Product";
  private static final String findProductPricesForAProductId = "http://epriceservice.cloudapp.net/PriceServices.svc/PoiProductPrice?$filter=ProductId%seq%s%s&$orderby=Price%sdesc";
  private static final String findProductByProductId = "http://epriceservice.cloudapp.net/PriceServices.svc/Product?$filter=ProductId%seq%s%s";
  private static final String findProductByName = "http://epriceservice.cloudapp.net/PriceServices.svc/Product?$filter=substringof('%s',Name)%seq%strue";
  private static final String findCompanyNameOfPoiId = "http://epriceservice.cloudapp.net/PriceServices.svc/Poi?$filter=PoiId%seq%s%s";
  private static final String findInitialTerritoriesNameId = "http://epriceservice.cloudapp.net/PriceServices.svc/Territory?$select=Name,TerritoryId";
  private static final String findSubTerritoriesNameId = "http://epriceservice.cloudapp.net/PriceServices.svc/Territory(%s)/Territory1?$select=Name,TerritoryId";
  private static final String findPoisInTerritory = "http://epriceservice.cloudapp.net/PriceServices.svc/Poi?$filter=TerritoryId%seq%s%s&$select=PoiId,Name,Source,Address";
  private static final String findPoiProducts = "http://epriceservice.cloudapp.net/PriceServices.svc/PoiProductPrice?$filter=PoiId%seq%s%s&$select=ProductId,Price";
  private static final String findCompanyPoiPriceList = "http://epriceservice.cloudapp.net/PriceServices.svc/Product?$format=json&$filter=ProductId%seq%s%s&$select=ProductId,Name,PoiProductPrice&$expand=PoiProductPrice/Poi/PoiCompany";
  
  
  public static final String getProductPricesForAProductIdFormatedURL(
      String productId) {
    Formatter formatter = new Formatter();
    formatter.format(findProductPricesForAProductId, "%20", "%20",
        productId, "%20");
    return formatter.toString();
  }

  public static final String getProductByProductIdFormatedURL(
      String productId) {
    Formatter formatter = new Formatter();
    formatter.format(findProductByProductId, "%20", "%20", productId);
    return formatter.toString();
  }

  public static final String getProductByNameFormatedURL(String name) {
    Formatter formatter = new Formatter();
    formatter.format(findProductByName, name, "%20", "%20");
    return formatter.toString();
  }

  public static final String getCompanyNameOfPoiIdFormatedURL(String id) {
    Formatter formatter = new Formatter();
    formatter.format(findCompanyNameOfPoiId, "%20", "%20", id);
    return formatter.toString();
  }

  public static final String getProductListFormatedURL() {
    return productList;
  }
  
  public static final String getInitialTerritoriesNameIdFormatedURL() {
    return findInitialTerritoriesNameId;
  }
  
  public static final String getSubTerritoriesNameIdFormatedURL(String id) {
    Formatter formatter = new Formatter();
    formatter.format(findSubTerritoriesNameId, id);
    return formatter.toString();
  }
  
  public static final String getPoisInTerritoryFormatedURL(
      String territoryId) {
    Formatter formatter = new Formatter();
    formatter.format(findPoisInTerritory, "%20", "%20", territoryId);
    return formatter.toString();
  }
  
  public static final String getPoiProductsFormatedURL(
      String id) {
    Formatter formatter = new Formatter();
    formatter.format(findPoiProducts, "%20", "%20", id);
    return formatter.toString();
  }
  
  public static final String getCompanyPoiPriceListFormatedURL(
      String poiId) {
    Formatter formatter = new Formatter();
    formatter.format(findCompanyPoiPriceList, "%20", "%20", poiId);
    return formatter.toString();
  }
  
}




Java Source Code List

com.imellon.android.grocerymate.GroceryMateApp.java
com.imellon.android.grocerymate.GroceryMatePreferences.java
com.imellon.android.grocerymate.activity.HomeActivity.java
com.imellon.android.grocerymate.activity.ProductSearchActivity.java
com.imellon.android.grocerymate.activity.ShoppingBasketActivity.java
com.imellon.android.grocerymate.cache.MemoryCache.java
com.imellon.android.grocerymate.io.DownloadAsyncTaskIface.java
com.imellon.android.grocerymate.io.DownloadAsyncTask.java
com.imellon.android.grocerymate.io.JsonParser.java
com.imellon.android.grocerymate.io.JsonProcessorAsyncTaskInterface.java
com.imellon.android.grocerymate.io.JsonProcessorAsyncTask.java
com.imellon.android.grocerymate.model.AbstractObjectType.java
com.imellon.android.grocerymate.model.CompanyPoiPriceList.java
com.imellon.android.grocerymate.model.CompanyPoiPrice.java
com.imellon.android.grocerymate.model.PoiList.java
com.imellon.android.grocerymate.model.PoiProductPriceList.java
com.imellon.android.grocerymate.model.PoiProductPrice.java
com.imellon.android.grocerymate.model.Poi.java
com.imellon.android.grocerymate.model.ProductList.java
com.imellon.android.grocerymate.model.Product.java
com.imellon.android.grocerymate.model.TerritoryList.java
com.imellon.android.grocerymate.util.BasketAdapter.java
com.imellon.android.grocerymate.util.GorceryMateUriHandler.java
com.imellon.android.grocerymate.util.HttpManager.java
com.imellon.android.grocerymate.util.ResultsAdapter.java
com.imellon.android.grocerymate.util.UserTask.java