1
2
3
4
5
6
7
8
9 package org.kuali.student.core.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 public abstract class VersionEntity extends MetaEntity {
18
19 @Embedded
20 private Version version;
21
22 @Override
23 protected void onPrePersist(){
24 super.onPrePersist();
25 if(version == null){
26 version = new Version();
27 }
28 if(version.getSequenceNumber()==null){
29 version.setSequenceNumber(Long.valueOf(1));
30 }
31 version.setVersionIndId(UUIDHelper.genStringUUID(version.getVersionIndId()));
32 }
33
34
35 public Version getVersion() {
36 return version;
37 }
38
39 public void setVersion(Version version) {
40 this.version = version;
41 }
42 }