View Javadoc

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.r1.common.entity;
10  
11  import javax.persistence.Embedded;
12  import javax.persistence.MappedSuperclass;
13  
14  import org.kuali.student.common.util.UUIDHelper;
15  
16  @Deprecated
17  @MappedSuperclass
18  public abstract class VersionEntity extends MetaEntity {
19  
20  	@Embedded
21  	private Version version;
22  	
23  	@Override
24  	protected void onPrePersist(){
25  		super.onPrePersist();
26  		if(version == null){
27  			version = new Version();
28  		}
29  		if(version.getSequenceNumber()==null){
30  			version.setSequenceNumber(Long.valueOf(1));
31  		}
32  		version.setVersionIndId(UUIDHelper.genStringUUID(version.getVersionIndId()));
33  	}
34  	
35  	
36  	public Version getVersion() {
37  		return version;
38  	}
39  
40  	public void setVersion(Version version) {
41  		this.version = version;
42  	}
43  }