View Javadoc
1   /**
2    * Copyright 2005-2016 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.kuali.rice.core.api.mo.ModelObjectBasic;
19  import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
20  import org.kuali.rice.ksb.api.registry.ServiceDescriptor;
21  import org.kuali.rice.ksb.api.registry.ServiceDescriptorContract;
22  
23  import javax.persistence.Column;
24  import javax.persistence.Entity;
25  import javax.persistence.GeneratedValue;
26  import javax.persistence.Id;
27  import javax.persistence.Lob;
28  import javax.persistence.Table;
29  
30  @Entity
31  @Table(name="KRSB_SVC_DSCRPTR_T")
32  public class ServiceDescriptorBo implements ServiceDescriptorContract, ModelObjectBasic {
33  
34      @Id
35      @GeneratedValue(generator = "KRSB_SVC_DSCRPTR_S")
36      @PortableSequenceGenerator(name = "KRSB_SVC_DSCRPTR_S")
37      @Column(name="SVC_DSCRPTR_ID")
38  	private String id;
39  	
40  	@Lob
41  	@Column(name="DSCRPTR", length = 4000)
42  	private String descriptor;
43  
44      public String getId() {
45          return id;
46      }
47  
48      public void setId(String id) {
49          this.id = id;
50      }
51  
52      public String getDescriptor() {
53          return descriptor;
54      }
55  
56      public void setDescriptor(String descriptor) {
57          this.descriptor = descriptor;
58      }
59  
60      @Override
61      public Long getVersionNumber() {
62          return null;
63      }
64  
65      public static ServiceDescriptor to(ServiceDescriptorBo bo) {
66  		if (bo == null) {
67  			return null;
68  		}
69  		return ServiceDescriptor.Builder.create(bo).build();
70  	}
71  	
72  	public static ServiceDescriptorBo from(ServiceDescriptor im) {
73  		if (im == null) {
74  			return null;
75  		}
76  
77  		ServiceDescriptorBo bo = new ServiceDescriptorBo();
78  		bo.id = im.getId();
79  		bo.descriptor = im.getDescriptor();
80  
81  		return bo;
82  	}
83  
84  }