Advertisement
Guest User

Untitled

a guest
Oct 31st, 2020
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.82 KB | None | 0 0
  1. package com.beetlehand.model.service;
  2.  
  3. import com.beetlehand.model.*;
  4. import com.beetlehand.model.dao.AbstractDaoInterface;
  5.  
  6. public class CatalogService extends AbstractService {
  7.  
  8.     public AttributeEntity addAttribute(AttributeEntity attributeEntity) {
  9.         AbstractDaoInterface attributeDao = this.getDaoInstance("attribute_dao");
  10.         attributeDao.saveRow(attributeEntity);
  11.  
  12.         return attributeEntity;
  13.     }
  14.  
  15.     public AttributeValueEntity addAttributeValue(AttributeValueEntity attributeValueEntity) {
  16.        AbstractDaoInterface attributeValueDao = this.getDaoInstance("attribute_value_dao") ;
  17.        attributeValueDao.saveRow(attributeValueEntity);
  18.  
  19.        return attributeValueEntity;
  20.     }
  21.  
  22.     public CategoryEntity addCategory(CategoryEntity categoryEntity) {
  23.         AbstractDaoInterface categoryDao = this.getDaoInstance("category_dao");
  24.         categoryDao.saveRow(categoryEntity);
  25.  
  26.         return categoryEntity;
  27.     }
  28.  
  29.     public DepartmentEntity addDepartment(DepartmentEntity departmentEntity) {
  30.         AbstractDaoInterface departmentDao = this.getDaoInstance("department_dao");
  31.         departmentDao.saveRow(departmentEntity);
  32.  
  33.         return departmentEntity;
  34.     }
  35.  
  36.     public ProductEntity addProductToCategory(ProductEntity productEntity, int categoryId) {
  37.         AbstractDaoInterface productDao = this.getDaoInstance("product_dao");
  38.         productDao.saveRow(productEntity);
  39.  
  40.         ProductCategoryEntity productCategoryEntity = new ProductCategoryEntity();
  41.         productCategoryEntity.setProductId(productEntity.getProductId());
  42.         productCategoryEntity.setCategoryId(categoryId);
  43.  
  44.         AbstractDaoInterface productCategoryDao = this.getDaoInstance("product_category_dao");
  45.         productCategoryDao.saveRow(productEntity);
  46.  
  47.         return productEntity;
  48.     }
  49.  
  50. }
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement