Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.beetlehand.model.service;
- import com.beetlehand.model.*;
- import com.beetlehand.model.dao.AbstractDaoInterface;
- public class CatalogService extends AbstractService {
- public AttributeEntity addAttribute(AttributeEntity attributeEntity) {
- AbstractDaoInterface attributeDao = this.getDaoInstance("attribute_dao");
- attributeDao.saveRow(attributeEntity);
- return attributeEntity;
- }
- public AttributeValueEntity addAttributeValue(AttributeValueEntity attributeValueEntity) {
- AbstractDaoInterface attributeValueDao = this.getDaoInstance("attribute_value_dao") ;
- attributeValueDao.saveRow(attributeValueEntity);
- return attributeValueEntity;
- }
- public CategoryEntity addCategory(CategoryEntity categoryEntity) {
- AbstractDaoInterface categoryDao = this.getDaoInstance("category_dao");
- categoryDao.saveRow(categoryEntity);
- return categoryEntity;
- }
- public DepartmentEntity addDepartment(DepartmentEntity departmentEntity) {
- AbstractDaoInterface departmentDao = this.getDaoInstance("department_dao");
- departmentDao.saveRow(departmentEntity);
- return departmentEntity;
- }
- public ProductEntity addProductToCategory(ProductEntity productEntity, int categoryId) {
- AbstractDaoInterface productDao = this.getDaoInstance("product_dao");
- productDao.saveRow(productEntity);
- ProductCategoryEntity productCategoryEntity = new ProductCategoryEntity();
- productCategoryEntity.setProductId(productEntity.getProductId());
- productCategoryEntity.setCategoryId(categoryId);
- AbstractDaoInterface productCategoryDao = this.getDaoInstance("product_category_dao");
- productCategoryDao.saveRow(productEntity);
- return productEntity;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement