| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| KIMNextIdFinder |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Copyright 2007-2008 The Kuali Foundation | |
| 3 | * | |
| 4 | * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php | |
| 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 | package org.kuali.rice.kim.lookup.valuefinder; | |
| 17 | ||
| 18 | import org.kuali.rice.kim.bo.entity.impl.KimEntityImpl; | |
| 19 | import org.kuali.rice.kns.lookup.valueFinder.ValueFinder; | |
| 20 | import org.kuali.rice.kns.service.KNSServiceLocator; | |
| 21 | import org.kuali.rice.kns.service.SequenceAccessorService; | |
| 22 | ||
| 23 | /** | |
| 24 | * This is a description of what this class does - ag266 don't forget to fill this in. | |
| 25 | * | |
| 26 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 27 | * | |
| 28 | */ | |
| 29 | public abstract class KIMNextIdFinder implements ValueFinder { | |
| 30 | ||
| 31 | private String sequenceName; | |
| 32 | ||
| 33 | 0 | public KIMNextIdFinder( String sequenceName ) { |
| 34 | 0 | this.sequenceName = sequenceName; |
| 35 | 0 | } |
| 36 | ||
| 37 | /** | |
| 38 | * Get the next sequence number value as a Long. | |
| 39 | */ | |
| 40 | public Long getLongValue() { | |
| 41 | // no constant because this is the only place the sequence name is used | |
| 42 | 0 | SequenceAccessorService sas = KNSServiceLocator.getSequenceAccessorService(); |
| 43 | 0 | return sas.getNextAvailableSequenceNumber(sequenceName, KimEntityImpl.class); |
| 44 | } | |
| 45 | ||
| 46 | /** | |
| 47 | * @see org.kuali.rice.kns.lookup.valueFinder.ValueFinder#getValue() | |
| 48 | */ | |
| 49 | public String getValue() { | |
| 50 | 0 | return getLongValue().toString(); |
| 51 | } | |
| 52 | ||
| 53 | public final String getSequenceName() { | |
| 54 | 0 | return sequenceName; |
| 55 | } | |
| 56 | } |