01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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: package org.kuali.kfs.service.impl;
17:
18: import java.util.Collection;
19:
20: import org.kuali.core.bo.KualiCode;
21: import org.kuali.kfs.dao.KualiCodeDao;
22: import org.kuali.kfs.service.KualiCodeService;
23: import org.springframework.transaction.annotation.Transactional;
24:
25: /**
26: * This class is the service implementation for the KualiCodeBase structure. This is the default implementation, that is delivered
27: * with Kuali.
28: */
29: @Transactional
30: public class KualiCodeServiceImpl implements KualiCodeService {
31: private KualiCodeDao kualiCodeDao;
32:
33: /**
34: * Retrieves an KualiCodeBase object by a given code.
35: *
36: * @param className - the name of the object being used, either KualiCodeBase or a subclass
37: * @param code - code to search for
38: * @return KualiCodeBase
39: */
40: public KualiCode getByCode(Class queryClass, String code) {
41: return kualiCodeDao.getByCode(queryClass, code);
42: }
43:
44: public KualiCode getSystemCode(Class clazz, String code) {
45: return kualiCodeDao.getSystemCode(clazz, code);
46: }
47:
48: /**
49: * Retrieves an KualiCodeBase object by a given exact name.
50: *
51: * @param className - the name of the object being used, either KualiCodeBase or a subclass
52: * @param name - name to search for
53: * @return KualiCodeBase
54: */
55: public KualiCode getByName(Class queryClass, String name) {
56: return kualiCodeDao.getByName(queryClass, name);
57: }
58:
59: /**
60: * Pass the method a populated KualiCodeBase object, and it will be saved.
61: *
62: * @param kualiCode
63: */
64: public void save(KualiCode kualiCode) {
65: // if no validation failures, commit the save
66: kualiCodeDao.save(kualiCode);
67: }
68:
69: /**
70: * @see org.kuali.core.service.KualiCodeService#getAll(java.lang.Class)
71: */
72: public Collection getAll(Class queryClass) {
73: return kualiCodeDao.getAll(queryClass);
74: }
75:
76: /**
77: * Pass the method a populated KualiCodeBase object, and it will be deleted.
78: *
79: * @param kualiCode
80: */
81: public void delete(KualiCode kualiCode) {
82: kualiCodeDao.delete(kualiCode);
83: }
84:
85: /**
86: * @return KualiCodeBase - Getter for the KualiCodeBase object.
87: */
88: public KualiCodeDao getKualiCodeDao() {
89: return kualiCodeDao;
90: }
91:
92: /**
93: * @param kualiCodeDao - Setter for the KualiCodeBase object.
94: */
95: public void setKualiCodeDao(KualiCodeDao kualiCodeDao) {
96: this.kualiCodeDao = kualiCodeDao;
97: }
98: }
|