Search in sources :

Example 1 with SvCatalog

use of com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvCatalog in project AN15 by IharDubkou.

the class SvCatalogServiceImpl method showProductsByCategory.

@Override
public void showProductsByCategory(ProductCategory category, SvCatalog catalog) {
    ArrayList<SvProduct> products = catalog.getCatalogList();
    System.out.println("\nВсе товары категории " + category.toString());
    for (SvProduct p : products) {
        if (p.getProductCategory().equals(category)) {
            System.out.println(p);
        }
    }
}
Also used : SvProduct(com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvProduct)

Example 2 with SvCatalog

use of com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvCatalog in project AN15 by IharDubkou.

the class MainTask3 method catalogProductAndCategoryCreator.

static SvCatalog catalogProductAndCategoryCreator() {
    SvCatalog catalog = new SvCatalog();
    catalog.addProduct(new SvProduct(ProductCategory.SPORT, "Мяч", 30, ProductRank.HIGH));
    catalog.addProduct(new SvProduct(ProductCategory.SPORT, "Гиря", 20, ProductRank.HIGH));
    catalog.addProduct(new SvProduct(ProductCategory.ELECTRONIC, "Телефон", 100, ProductRank.HIGH));
    catalog.addProduct(new SvProduct(ProductCategory.ELECTRONIC, "Ноутбук", 210, ProductRank.HIGH));
    catalog.addProduct(new SvProduct(ProductCategory.HOUSEHOLD, "Кофеварка", 170, ProductRank.HIGH));
    catalog.addProduct(new SvProduct(ProductCategory.HOUSEHOLD, "Блендер", 90, ProductRank.HIGH));
    return catalog;
}
Also used : SvCatalog(com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvCatalog) SvProduct(com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvProduct)

Example 3 with SvCatalog

use of com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvCatalog in project AN15 by IharDubkou.

the class MainTask3 method svCatalogServiceTest.

static void svCatalogServiceTest(SvCatalog catalog, SvUser user) {
    System.out.println("\nTest CatalogService:");
    SvCatalogServiceImpl service = new SvCatalogServiceImpl();
    service.showAllProducts(catalog);
    service.showProductsByCategory(ProductCategory.ELECTRONIC, catalog);
    // пока не знаю как здесь удобнее реализовать!!!!
    // поэтому хардкорно передаем элемент списка.
    service.addProductInBasket(user, catalog.getCatalogList().get(2));
    service.addProductInBasket(user, new SvProduct(ProductCategory.HOUSEHOLD, "Блендер", 90, ProductRank.HIGH));
    service.buyProduct(user, catalog.getCatalogList().get(2));
    System.out.println("\nЧто может пользователь:");
    for (UsersActions e : UsersActions.values()) {
        System.out.println(e);
    }
}
Also used : SvCatalogServiceImpl(com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.services.implimentations.SvCatalogServiceImpl) SvProduct(com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvProduct) UsersActions(com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.enums.UsersActions)

Example 4 with SvCatalog

use of com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvCatalog in project AN15 by IharDubkou.

the class SvCatalogServiceImpl method showAllProducts.

@Override
public void showAllProducts(SvCatalog catalog) {
    ArrayList<SvProduct> products = catalog.getCatalogList();
    System.out.println("\nВсе товары в каталоге");
    for (SvProduct p : products) {
        System.out.println(p.toString());
    }
}
Also used : SvProduct(com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvProduct)

Example 5 with SvCatalog

use of com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvCatalog in project AN15 by IharDubkou.

the class MainTask3 method main.

public static void main(String[] args) {
    SvCatalog catalog;
    // Понадобится чтобы в дальнейшем не заморачиваться
    catalog = catalogProductAndCategoryCreator();
    SvUser user = new SvUser("User", "Qwerty");
    svAuthenticationServiceTest(user);
    svCatalogServiceTest(catalog, user);
}
Also used : SvCatalog(com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvCatalog) SvUser(com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvUser)

Aggregations

SvProduct (com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvProduct)4 SvCatalog (com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvCatalog)2 UsersActions (com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.enums.UsersActions)1 SvUser (com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.models.SvUser)1 SvCatalogServiceImpl (com.teachMeSkills.an15.VorobyovSergey.hwSix.Task3.services.implimentations.SvCatalogServiceImpl)1