001/** 002 * Copyright 2005-2016 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.ksb.impl.registry; 017 018import org.kuali.rice.core.api.mo.ModelObjectBasic; 019import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator; 020import org.kuali.rice.ksb.api.registry.ServiceDescriptor; 021import org.kuali.rice.ksb.api.registry.ServiceDescriptorContract; 022 023import javax.persistence.Column; 024import javax.persistence.Entity; 025import javax.persistence.GeneratedValue; 026import javax.persistence.Id; 027import javax.persistence.Lob; 028import javax.persistence.Table; 029 030@Entity 031@Table(name="KRSB_SVC_DSCRPTR_T") 032public class ServiceDescriptorBo implements ServiceDescriptorContract, ModelObjectBasic { 033 034 @Id 035 @GeneratedValue(generator = "KRSB_SVC_DSCRPTR_S") 036 @PortableSequenceGenerator(name = "KRSB_SVC_DSCRPTR_S") 037 @Column(name="SVC_DSCRPTR_ID") 038 private String id; 039 040 @Lob 041 @Column(name="DSCRPTR", length = 4000) 042 private String descriptor; 043 044 public String getId() { 045 return id; 046 } 047 048 public void setId(String id) { 049 this.id = id; 050 } 051 052 public String getDescriptor() { 053 return descriptor; 054 } 055 056 public void setDescriptor(String descriptor) { 057 this.descriptor = descriptor; 058 } 059 060 @Override 061 public Long getVersionNumber() { 062 return null; 063 } 064 065 public static ServiceDescriptor to(ServiceDescriptorBo bo) { 066 if (bo == null) { 067 return null; 068 } 069 return ServiceDescriptor.Builder.create(bo).build(); 070 } 071 072 public static ServiceDescriptorBo from(ServiceDescriptor im) { 073 if (im == null) { 074 return null; 075 } 076 077 ServiceDescriptorBo bo = new ServiceDescriptorBo(); 078 bo.id = im.getId(); 079 bo.descriptor = im.getDescriptor(); 080 081 return bo; 082 } 083 084}