001    /*
002     * Copyright 2007-2008 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     */
016    package org.kuali.rice.kim.bo.role.impl;
017    
018    import java.util.LinkedHashMap;
019    
020    import javax.persistence.CascadeType;
021    import javax.persistence.Column;
022    import javax.persistence.Entity;
023    import javax.persistence.FetchType;
024    import javax.persistence.Id;
025    import javax.persistence.JoinColumn;
026    import javax.persistence.OneToOne;
027    import javax.persistence.Table;
028    
029    import org.kuali.rice.kns.bo.Inactivateable;
030    import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
031    
032    /**
033     * @author Kuali Rice Team (rice.collab@kuali.org)
034     */
035    @Entity
036    @Table(name="KRIM_ROLE_PERM_T")
037    public class RolePermissionImpl extends PersistableBusinessObjectBase implements Inactivateable{
038    
039            private static final long serialVersionUID = 1L;
040            
041            @Id
042            @Column(name="ROLE_PERM_ID")
043            protected String rolePermissionId;
044            @Column(name="ROLE_ID")
045            protected String roleId;
046            @Column(name="PERM_ID")
047            protected String permissionId;
048            
049            @Column(name="ACTV_IND")
050            protected boolean active;
051    
052            @OneToOne(targetEntity=KimPermissionImpl.class, fetch = FetchType.LAZY, cascade = { CascadeType.ALL })
053            @JoinColumn(name = "PERM_ID", insertable = false, updatable = false)
054            protected KimPermissionImpl kimPermission;
055            
056            public KimPermissionImpl getPermission() {
057                    return kimPermission;
058            }
059    
060            public String getPermissionId() {
061                    return permissionId;
062            }
063            
064            public String getRoleId() {
065                    return roleId;
066            }
067    
068            public String getRolePermissionId() {
069                    return rolePermissionId;
070            }
071    
072            public void setPermissionId(String permissionId) {
073                    this.permissionId = permissionId;
074            }
075    
076            public void setRoleId(String roleId) {
077                    this.roleId = roleId;
078            }
079    
080            /**
081             * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
082             */
083            @SuppressWarnings("unchecked")
084            @Override
085            protected LinkedHashMap toStringMapper() {
086                    LinkedHashMap m = new LinkedHashMap();
087                    m.put( "rolePermissionId", rolePermissionId );
088                    m.put( "roleId", roleId );
089                    m.put( "permissionId", permissionId );
090                    return m;
091            }
092    
093            public boolean isActive() {
094                    return this.active;
095            }
096    
097            public void setActive(boolean active) {
098                    this.active = active;
099            }
100    
101            public void setRolePermissionId(String rolePermissionId) {
102                    this.rolePermissionId = rolePermissionId;
103            }
104    
105            /**
106             * @return the kimPermission
107             */
108            public KimPermissionImpl getKimPermission() {
109                    return this.kimPermission;
110            }
111    
112            /**
113             * @param kimPermission the kimPermission to set
114             */
115            public void setKimPermission(KimPermissionImpl kimPermission) {
116                    this.kimPermission = kimPermission;
117            }
118    
119    }