PageRenderTime 56ms CodeModel.GetById 42ms app.highlight 9ms RepoModel.GetById 2ms app.codeStats 0ms

/jcg-andygene-web-archetype/src/main/resources/archetype-resources/src/main/java/service/impl/ReportsServiceImpl.java

http://jcg-andygene-web.googlecode.com/
Java | 44 lines | 34 code | 10 blank | 0 comment | 1 complexity | c822f55c346ad4c2bbfd95f76910470c MD5 | raw file
 1#set( $symbol_pound = '#' )
 2#set( $symbol_dollar = '$' )
 3#set( $symbol_escape = '\' )
 4package ${package}.service.impl;
 5
 6
 7import java.util.List;
 8
 9import org.slf4j.Logger;
10import org.slf4j.LoggerFactory;
11import org.springframework.beans.factory.annotation.Autowired;
12import org.springframework.stereotype.Service;
13import org.springframework.transaction.annotation.Transactional;
14
15import ${package}.dao.ReportsDAO;
16import ${package}.domain.Reports;
17import ${package}.service.ReportsService;
18@Service("reportsService")
19public class ReportsServiceImpl implements ReportsService {
20	
21	private Logger log = LoggerFactory.getLogger(ReportsService.class);
22	
23	@Autowired
24	private ReportsDAO reportsDAO;
25	
26	@Transactional
27	public void initReports(int maxNumbers) {
28		log.info("Generating [{}] reports data",maxNumbers);
29		Reports reports = null;
30		for(int i = 0;i < maxNumbers;i++) {
31			reports = new Reports();
32			reports.setName("Name"+i);
33			reports.setPrice((double)i);
34			reports.setDescription("Description"+i);
35			reportsDAO.persist(reports);
36		}
37
38	}
39
40	public List<Reports> getReports() {
41		return reportsDAO.findAll();
42	}
43
44}