1
2
3
4
5
6
7
8
9
10
11
12
13 package org.kuali.rice.kns.service.impl;
14
15 import org.apache.commons.lang.StringUtils;
16 import org.kuali.rice.kns.bo.BusinessObject;
17 import org.kuali.rice.kns.dao.SequenceAccessorDao;
18 import org.kuali.rice.kns.service.SequenceAccessorService;
19 import org.springframework.transaction.annotation.Transactional;
20
21 @Transactional
22 public class SequenceAccessorServiceImpl implements SequenceAccessorService {
23 private SequenceAccessorDao sequenceAccessorDao;
24
25 public Long getNextAvailableSequenceNumber(String sequenceName,
26 Class<? extends BusinessObject> clazz) {
27 if (StringUtils.isBlank(sequenceName)) {
28 throw new RuntimeException("Sequence name cannot be blank.");
29 }
30 return sequenceAccessorDao.getNextAvailableSequenceNumber(sequenceName, clazz);
31 }
32
33
34
35
36 public Long getNextAvailableSequenceNumber(String sequenceName) {
37 if (StringUtils.isBlank(sequenceName)) {
38 throw new RuntimeException("Sequence name cannot be blank.");
39 }
40 return sequenceAccessorDao.getNextAvailableSequenceNumber(sequenceName);
41 }
42
43 public void setSequenceAccessorDao(SequenceAccessorDao sequenceAccessorDao) {
44 this.sequenceAccessorDao = sequenceAccessorDao;
45 }
46 }