1 | |
package org.kuali.rice.krad.valuefinder; |
2 | |
|
3 | |
import org.kuali.rice.krad.bo.BusinessObject; |
4 | |
import org.kuali.rice.krad.service.KRADServiceLocator; |
5 | |
import org.kuali.rice.krad.service.SequenceAccessorService; |
6 | |
|
7 | |
public class SequenceValueFinder implements ValueFinder { |
8 | |
|
9 | |
private final Class<? extends BusinessObject> associatedBo; |
10 | |
private final String sequenceName; |
11 | |
|
12 | 0 | public SequenceValueFinder(final Class<? extends BusinessObject> associatedBo, final String sequenceName) { |
13 | 0 | this.associatedBo = associatedBo; |
14 | 0 | this.sequenceName = sequenceName; |
15 | 0 | } |
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
public final Long getLongValue() { |
21 | 0 | SequenceAccessorService sas = KRADServiceLocator.getSequenceAccessorService(); |
22 | 0 | return sas.getNextAvailableSequenceNumber(sequenceName, associatedBo); |
23 | |
} |
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
public final String getValue() { |
29 | 0 | return getLongValue().toString(); |
30 | |
} |
31 | |
|
32 | |
public final String getSequenceName() { |
33 | 0 | return sequenceName; |
34 | |
} |
35 | |
|
36 | |
public final Class<? extends BusinessObject> getAssociatedBo() { |
37 | 0 | return associatedBo; |
38 | |
} |
39 | |
} |