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.messaging;
017
018import java.io.Serializable;
019
020import javax.persistence.Column;
021import javax.persistence.Entity;
022import javax.persistence.GeneratedValue;
023import javax.persistence.Id;
024import javax.persistence.Lob;
025import javax.persistence.Table;
026
027import org.hibernate.annotations.GenericGenerator;
028import org.hibernate.annotations.Parameter;
029import org.kuali.rice.core.framework.persistence.jpa.OrmUtils;
030import org.kuali.rice.ksb.service.KSBServiceLocator;
031
032/**
033 * A convenience class for encapsulating the serialized version of a ServiceDefinition object, allowing it to be lazy-loaded.
034 * 
035 * @author Kuali Rice Team (rice.collab@kuali.org)
036 */
037@Entity
038@Table(name="KRSB_FLT_SVC_DEF_T")
039//@Sequence(name="KRSB_FLT_SVC_DEF_S", property="flattenedServiceDefinitionId")
040public class FlattenedServiceDefinition implements Serializable {
041        private static final long serialVersionUID = -4622179363250818637L;
042        
043        @Id
044        @GeneratedValue(generator="KRSB_FLT_SVC_DEF_S")
045        @GenericGenerator(name="KRSB_FLT_SVC_DEF_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={
046                        @Parameter(name="sequence_name",value="KRSB_FLT_SVC_DEF_S"),
047                        @Parameter(name="value_column",value="id")
048        })
049        @Column(name="FLT_SVC_DEF_ID")  
050        private Long flattenedServiceDefinitionId;
051        @Lob
052        @Column(name="FLT_SVC_DEF", length=4000)
053        private String flattenedServiceDefinitionData;
054        
055        //@PrePersist
056    public void beforeInsert() {
057        OrmUtils.populateAutoIncValue(this, KSBServiceLocator.getRegistryEntityManagerFactory().createEntityManager());
058    }
059        
060        public FlattenedServiceDefinition() {
061        }
062        
063        public FlattenedServiceDefinition(String flattenedServiceDefinitionData) {
064                this.flattenedServiceDefinitionData = flattenedServiceDefinitionData;
065        }
066        
067        public Long getFlattenedServiceDefinitionId() {
068                return this.flattenedServiceDefinitionId;
069        }
070        public void setFlattenedServiceDefinitionId(Long flattenedServiceDefinitionId) {
071                this.flattenedServiceDefinitionId = flattenedServiceDefinitionId;
072        }
073        
074        public String getFlattenedServiceDefinitionData() {
075                return this.flattenedServiceDefinitionData;
076        }
077        public void setFlattenedServiceDefinitionData(String flattenedServiceDefinitionData) {
078                this.flattenedServiceDefinitionData = flattenedServiceDefinitionData;
079        }
080        
081}