1 /**************************************************************************
2 Copyright 2005 Webstersmalley
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 *************************************************************************/
16
17
18
19 package com.webstersmalley.picweb.online.bus;
20
21 import java.util.Collection;
22
23 import org.springframework.dao.DataAccessException;
24
25 import com.webstersmalley.picweb.online.db.CategoryDao;
26
27 public class CategoryManagerImpl implements CategoryManager {
28 private CategoryDao categoryDao;
29
30 public void setCategoryDao(CategoryDao categoryDao) {
31 this.categoryDao = categoryDao;
32 }
33
34
35
36
37
38
39
40 public void createAndStoreCategory(Category cat) {
41 categoryDao.createAndStoreCategory(cat);
42 }
43
44
45
46
47
48
49 public Category getCategory(String name) {
50 return categoryDao.getCategory(name);
51 }
52
53
54
55
56
57
58 public Collection loadCategories() throws DataAccessException {
59 return categoryDao.loadCategories();
60 }
61
62 public Collection getRootCategories() {
63 return categoryDao.getRootCategories();
64 }
65
66 public Collection getSubcategories(Category cat) {
67 return cat.getSubcategories();
68 }
69
70 public Category getCategory(int id) {
71 return categoryDao.getCategory(id);
72 }
73 }