View Javadoc

1   /**
2    * Copyright 2005-2013 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.ksb.impl.registry;
17  
18  import org.hibernate.annotations.Parameter;
19  import org.kuali.rice.core.api.mo.ModelObjectBasic;
20  import org.kuali.rice.ksb.api.registry.ServiceDescriptor;
21  import org.kuali.rice.ksb.api.registry.ServiceDescriptorContract;
22  
23  /**
24   * TODO... 
25   * 
26   * @author Kuali Rice Team (rice.collab@kuali.org)
27   *
28   */
29  @javax.persistence.Entity
30  @javax.persistence.Table(name="KRSB_SVC_DSCRPTR_T")
31  public class ServiceDescriptorBo implements ServiceDescriptorContract, ModelObjectBasic {
32  
33  	@javax.persistence.Id
34  	@javax.persistence.GeneratedValue(generator="KRSB_SVC_DSCRPTR_S")
35  	@org.hibernate.annotations.GenericGenerator(name="KRSB_FLT_SVC_DEF_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={
36  			@Parameter(name="sequence_name", value="KRSB_SVC_DSCRPTR_S"),
37  			@Parameter(name="value_column", value="id")
38      })
39  	@javax.persistence.Column(name="SVC_DSCRPTR_ID")
40  	private String id;
41  	
42  	@javax.persistence.Lob
43  	@javax.persistence.Column(name="DSCRPTR", length=4000)
44  	private String descriptor;
45  	
46  	@javax.persistence.Version
47  	@javax.persistence.Column(name="VER_NBR")
48  	private Long versionNumber;
49  
50      public String getId() {
51          return id;
52      }
53  
54      public void setId(String id) {
55          this.id = id;
56      }
57  
58      public String getDescriptor() {
59          return descriptor;
60      }
61  
62      public void setDescriptor(String descriptor) {
63          this.descriptor = descriptor;
64      }
65  
66      public Long getVersionNumber() {
67          return versionNumber;
68      }
69  
70      public void setVersionNumber(Long versionNumber) {
71          this.versionNumber = versionNumber;
72      }
73  
74      public static ServiceDescriptor to(ServiceDescriptorBo bo) {
75  		if (bo == null) {
76  			return null;
77  		}
78  		return ServiceDescriptor.Builder.create(bo).build();
79  	}
80  	
81  	public static ServiceDescriptorBo from(ServiceDescriptor im) {
82  		if (im == null) {
83  			return null;
84  		}
85  
86  		ServiceDescriptorBo bo = new ServiceDescriptorBo();
87  		bo.id = im.getId();
88  		bo.descriptor = im.getDescriptor();
89  		bo.versionNumber = im.getVersionNumber();
90  
91  		return bo;
92  	}
93  
94  }