Interface ShopOperations


  • public interface ShopOperations
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int createShop​(java.lang.String name, java.lang.String cityName)
      Creates new shop with 0% discount.
      int getArticleCount​(int articleId)
      Gets count og articles in shop.
      java.util.List<java.lang.Integer> getArticles​(int shopId)
      Gets all articles.
      int getCity​(int shopId)
      Gets city's id
      int getDiscount​(int shopId)
      Get discount for shop.
      int increaseArticleCount​(int articleId, int increment)
      Increases number of articles in the shop.
      int setCity​(int shopId, java.lang.String cityName)
      Changes city for shop.
      int setDiscount​(int shopId, int discountPercentage)
      Sets discount for shop.
    • Method Detail

      • createShop

        int createShop​(java.lang.String name,
                       java.lang.String cityName)
        Creates new shop with 0% discount. Shops must have unique name.
        Parameters:
        name - name of the shop
        cityName - name of the city
        Returns:
        id of the shop, or -1 in failure
      • setCity

        int setCity​(int shopId,
                    java.lang.String cityName)
        Changes city for shop.
        Parameters:
        shopId - id of the shop
        cityName - name of the city
        Returns:
        1 on success, -1 on failure
      • getCity

        int getCity​(int shopId)
        Gets city's id
        Parameters:
        shopId - city for shop
        Returns:
        city's id
      • setDiscount

        int setDiscount​(int shopId,
                        int discountPercentage)
        Sets discount for shop.
        Parameters:
        shopId - id of the shop
        discountPercentage - discount in percentege
        Returns:
        1 on success, -1 on failure
      • increaseArticleCount

        int increaseArticleCount​(int articleId,
                                 int increment)
        Increases number of articles in the shop.
        Parameters:
        articleId - id of the article
        increment - number of articles to be stored in shop
        Returns:
        number of articles after storing, -1 in failure
      • getArticleCount

        int getArticleCount​(int articleId)
        Gets count og articles in shop.
        Parameters:
        articleId - id of the article
        Returns:
        number of articles in shop
      • getArticles

        java.util.List<java.lang.Integer> getArticles​(int shopId)
        Gets all articles.
        Parameters:
        shopId - shop's id
        Returns:
        gets all article's ids in shop
      • getDiscount

        int getDiscount​(int shopId)
        Get discount for shop.
        Parameters:
        shopId - shop's id
        Returns:
        discount percentage