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.kim.impl.responsibility; 017 018import javax.persistence.Column; 019import javax.persistence.Entity; 020import javax.persistence.GeneratedValue; 021import javax.persistence.Id; 022import javax.persistence.JoinColumn; 023import javax.persistence.ManyToOne; 024import javax.persistence.Table; 025 026import org.kuali.rice.kim.api.common.attribute.KimAttribute; 027import org.kuali.rice.kim.api.common.attribute.KimAttributeData; 028import org.kuali.rice.kim.api.common.attribute.KimAttributeDataContract; 029import org.kuali.rice.kim.api.type.KimType; 030import org.kuali.rice.kim.impl.common.attribute.KimAttributeBo; 031import org.kuali.rice.kim.impl.common.attribute.KimAttributeDataBo; 032import org.kuali.rice.krad.bo.BusinessObject; 033import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator; 034 035/** 036 * @author Kuali Rice Team (rice.collab@kuali.org) 037 */ 038@Entity 039@Table(name = "KRIM_RSP_ATTR_DATA_T") 040public class ResponsibilityAttributeBo extends KimAttributeDataBo implements KimAttributeDataContract, BusinessObject { 041 private static final long serialVersionUID = 1L; 042 043 @PortableSequenceGenerator(name = "KRIM_ATTR_DATA_ID_S") 044 @GeneratedValue(generator = "KRIM_ATTR_DATA_ID_S") 045 @Id 046 @Column(name = "ATTR_DATA_ID") 047 private String id; 048 049 @Column(name = "RSP_ID") 050 private String assignedToId; 051 052 /** 053 * Converts a mutable bo to its immutable counterpart 054 * 055 * @param bo the mutable business object 056 * @return the immutable object 057 */ 058 public static KimAttributeData to(ResponsibilityAttributeBo bo) { 059 if (bo == null) { 060 return null; 061 } 062 return KimAttributeData.Builder.create(bo).build(); 063 } 064 065 /** 066 * Converts a immutable object to its mutable counterpart 067 * 068 * @param im immutable object 069 * @return the mutable bo 070 */ 071 public static ResponsibilityAttributeBo from(KimAttributeData im) { 072 if (im == null) { 073 return null; 074 } 075 ResponsibilityAttributeBo bo = new ResponsibilityAttributeBo(); 076 bo.setId(im.getId()); 077 bo.setKimAttribute(KimAttributeBo.from(im.getKimAttribute())); 078 final KimAttribute attribute = im.getKimAttribute(); 079 bo.setKimAttributeId((attribute == null ? null : attribute.getId())); 080 bo.setAttributeValue(bo.getAttributeValue()); 081 final KimType type = im.getKimType(); 082 bo.setKimTypeId((type == null ? null : type.getId())); 083 bo.setVersionNumber(im.getVersionNumber()); 084 bo.setObjectId(im.getObjectId()); 085 return bo; 086 } 087 088 @Override 089 public String getId() { 090 return id; 091 } 092 093 @Override 094 public void setId(String id) { 095 this.id = id; 096 } 097 098 @Override 099 public String getAssignedToId() { 100 return assignedToId; 101 } 102 103 @Override 104 public void setAssignedToId(String assignedToId) { 105 this.assignedToId = assignedToId; 106 } 107 108 @Override 109 public void refresh() { 110 } 111}