Add some service to PublicationHouseServiceImpl file
[smart-bookstore.git] / ServiceImplementation / src / main / java / com / smartitengineering / bookstore / serviceimplementation / PublicationHouseServiceImpl.java
blobc0589748509a33273970f38798b1b77e54771800
1 /*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5 package com.smartitengineering.bookstore.serviceimplementation;
7 import com.smartitengineering.bookstore.domain.PublicationHouse;
8 import com.smartitengineering.bookstore.domain.filter.PublicationHouseFilter;
9 import com.smartitengineering.bookstore.service.api.PublicationHouseService;
10 import com.smartitengineering.dao.impl.hibernate.AbstractCommonDaoImpl;
11 import com.smartitengineering.domain.PersistentDTO;
12 import java.util.Collection;
13 import java.util.HashSet;
14 import java.util.List;
15 import java.util.Set;
16 import org.springframework.beans.BeansException;
17 import org.springframework.context.ApplicationContext;
18 import org.springframework.context.support.ClassPathXmlApplicationContext;
20 /**
22 * @author modhu7
24 public class PublicationHouseServiceImpl implements PublicationHouseService {
26 private static ApplicationContext context;
28 public PublicationHouseServiceImpl() {
29 if (context == null) {
30 context = new ClassPathXmlApplicationContext("app-context.xml");
34 public void create(PublicationHouse publicationHouse) {
35 AbstractCommonDaoImpl<PublicationHouse> publicationHouseInstance = getDaoInstance();
36 //AbstractDaoImpl<PublicationHouse> publicationHouseInstance = new AbstractDaoImpl<PublicationHouse>();
37 try {
38 System.out.println("Starting..............");
39 publicationHouseInstance.save(publicationHouse);
40 System.out.println("Successful............");
41 } catch (Exception ex) {
45 public void update(PublicationHouse publicationHouse) {
46 throw new UnsupportedOperationException("Not supported yet.");
49 public void delete(PublicationHouse publicationHouse) {
50 throw new UnsupportedOperationException("Not supported yet.");
53 public Collection<PublicationHouse> search(PublicationHouseFilter houseFilter) {
54 throw new UnsupportedOperationException("Not supported yet.");
57 public PublicationHouse getByUniqueShortName(String uniqueShortName) {
58 throw new UnsupportedOperationException("Not supported yet.");
61 private <T extends PersistentDTO<T>> AbstractCommonDaoImpl<T> getDaoInstance()
62 throws BeansException {
63 AbstractCommonDaoImpl<T> instance =
64 (AbstractCommonDaoImpl<T>) context.getBean("daoImpl");
65 return instance;
68 public Set<PublicationHouse> getAllPublicationHouse() {
69 AbstractCommonDaoImpl<PublicationHouse> publicationHouseInstance = getDaoInstance();
70 Set setPublicationHouse = new HashSet();
71 try {
72 setPublicationHouse = publicationHouseInstance.getAll();
73 } catch (Exception ex) {
75 return setPublicationHouse;