| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| VersionEntity |
|
| 1.6666666666666667;1.667 |
| 1 | /** | |
| 2 | * Copyright 2010 The Kuali Foundation Licensed under the Educational Community License, Version 2.0 (the "License"); you may | |
| 3 | * not use this file except in compliance with the License. You may obtain a copy of the License at | |
| 4 | * http://www.osedu.org/licenses/ECL-2.0 Unless required by applicable law or agreed to in writing, software distributed | |
| 5 | * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | |
| 6 | * implied. See the License for the specific language governing permissions and limitations under the License. | |
| 7 | */ | |
| 8 | ||
| 9 | package org.kuali.student.common.entity; | |
| 10 | ||
| 11 | import javax.persistence.Embedded; | |
| 12 | import javax.persistence.MappedSuperclass; | |
| 13 | ||
| 14 | import org.kuali.student.common.util.UUIDHelper; | |
| 15 | ||
| 16 | @MappedSuperclass | |
| 17 | 0 | public abstract class VersionEntity extends MetaEntity { |
| 18 | ||
| 19 | @Embedded | |
| 20 | private Version version; | |
| 21 | ||
| 22 | @Override | |
| 23 | protected void onPrePersist(){ | |
| 24 | 0 | super.onPrePersist(); |
| 25 | 0 | if(version == null){ |
| 26 | 0 | version = new Version(); |
| 27 | } | |
| 28 | 0 | if(version.getSequenceNumber()==null){ |
| 29 | 0 | version.setSequenceNumber(Long.valueOf(1)); |
| 30 | } | |
| 31 | 0 | version.setVersionIndId(UUIDHelper.genStringUUID(version.getVersionIndId())); |
| 32 | 0 | } |
| 33 | ||
| 34 | ||
| 35 | public Version getVersion() { | |
| 36 | 0 | return version; |
| 37 | } | |
| 38 | ||
| 39 | public void setVersion(Version version) { | |
| 40 | 0 | this.version = version; |
| 41 | 0 | } |
| 42 | } |