1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.service.impl;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.krad.bo.DocumentHeader;
20 import org.kuali.rice.krad.dao.DocumentHeaderDao;
21 import org.kuali.rice.krad.service.DocumentHeaderService;
22 import org.kuali.rice.krad.service.KRADServiceLocator;
23 import org.springframework.transaction.annotation.Transactional;
24
25
26
27
28
29
30
31
32 @Transactional
33 public class DocumentHeaderServiceImpl implements DocumentHeaderService {
34 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(DocumentHeaderServiceImpl.class);
35 private DocumentHeaderDao documentHeaderDao;
36
37
38
39
40 public Class<? extends DocumentHeader> getDocumentHeaderBaseClass() {
41 Class documentHeaderClass = documentHeaderDao.getDocumentHeaderBaseClass();
42 if ( (documentHeaderClass == null) || (!DocumentHeader.class.isAssignableFrom(documentHeaderClass)) ) {
43 throw new RuntimeException("invalid document header base class '" + documentHeaderClass + "' returned by dao '" + documentHeaderDao.getClass().getName() + "'");
44 }
45 return documentHeaderClass;
46 }
47
48
49
50
51 public DocumentHeader getDocumentHeaderById(String documentHeaderId) {
52 if (StringUtils.isBlank(documentHeaderId)) {
53 throw new IllegalArgumentException("document header id given is blank");
54 }
55 return documentHeaderDao.getByDocumentHeaderId(documentHeaderId);
56 }
57
58
59
60
61 public void saveDocumentHeader(DocumentHeader documentHeader) {
62 KRADServiceLocator.getBusinessObjectService().save(documentHeader);
63 }
64
65
66
67
68 public void deleteDocumentHeader(DocumentHeader documentHeader) {
69 KRADServiceLocator.getBusinessObjectService().delete(documentHeader);
70 }
71
72
73
74
75
76
77 public void setDocumentHeaderDao(DocumentHeaderDao documentHeaderDao) {
78 this.documentHeaderDao = documentHeaderDao;
79 }
80
81 }