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.bo.ui;
017
018import org.apache.commons.lang.StringUtils;
019import org.hibernate.annotations.GenericGenerator;
020import org.hibernate.annotations.Parameter;
021import org.kuali.rice.kim.api.services.KimApiServiceLocator;
022import org.kuali.rice.kim.impl.type.KimTypeBo;
023
024import javax.persistence.Column;
025import javax.persistence.Entity;
026import javax.persistence.GeneratedValue;
027import javax.persistence.Id;
028import javax.persistence.IdClass;
029import javax.persistence.Table;
030import javax.persistence.Transient;
031
032/**
033 * This is a description of what this class does - shyu don't forget to fill this in. 
034 * 
035 * @author Kuali Rice Team (rice.collab@kuali.org)
036 *
037 */
038@IdClass(PersonDocumentGroupId.class) 
039@Entity
040@Table(name="KRIM_PND_GRP_PRNCPL_MT")
041public class PersonDocumentGroup extends KimDocumentBoActivatableToFromEditableBase {
042        private static final long serialVersionUID = -1551337026170706411L;
043        @Id
044        @GeneratedValue(generator="KRIM_GRP_MBR_ID_S")
045        @GenericGenerator(name="KRIM_GRP_MBR_ID_S",strategy="org.kuali.rice.core.jpa.spring.RiceNumericStringSequenceStyleGenerator",parameters={
046                        @Parameter(name="sequence_name",value="KRIM_GRP_MBR_ID_S"),
047                        @Parameter(name="value_column",value="id")
048                })
049        @Column(name="GRP_MBR_ID")
050        protected String groupMemberId;
051        @Column(name="GRP_TYPE")
052        protected String groupType;
053                
054        @Column(name="GRP_ID")
055        protected String groupId;
056        @Column(name="GRP_NM")
057        protected String groupName;
058        @Column(name="NMSPC_CD")
059        protected String namespaceCode;
060        @Column(name="PRNCPL_ID")
061        protected String principalId;
062        @Transient
063        protected transient KimTypeBo kimGroupType;
064        @Transient
065        protected String kimTypeId;
066        
067        public String getGroupId() {
068                return this.groupId;
069        }
070
071        public void setGroupId(String groupId) {
072                this.groupId = groupId;
073        }
074
075        public String getGroupName() {
076                return this.groupName;
077        }
078
079        public void setGroupName(String groupName) {
080                this.groupName = groupName;
081        }
082
083        public KimTypeBo getKimGroupType() {
084        if (StringUtils.isNotBlank(getKimTypeId())) {
085            if ( kimGroupType == null || (!StringUtils.equals( kimGroupType.getId(), kimTypeId )) ) {
086                            kimGroupType = KimTypeBo.from(KimApiServiceLocator.getKimTypeInfoService().getKimType(kimTypeId));
087                    }
088        }
089                return kimGroupType;
090        }
091
092        public String getKimTypeId() {
093                return this.kimTypeId;
094        }
095
096        public void setKimTypeId(String kimTypeId) {
097                this.kimTypeId = kimTypeId;
098        }
099
100        public String getGroupMemberId() {
101                return this.groupMemberId;
102        }
103
104        public void setGroupMemberId(String groupMemberId) {
105                this.groupMemberId = groupMemberId;
106        }
107
108        public String getPrincipalId() {
109                return this.principalId;
110        }
111
112        public void setPrincipalId(String principalId) {
113                this.principalId = principalId;
114        }
115
116        public String getGroupType() {
117                return this.groupType;
118        }
119
120        public void setGroupType(String groupType) {
121                this.groupType = groupType;
122        }
123
124        public String getNamespaceCode() {
125                return this.namespaceCode;
126        }
127
128        public void setNamespaceCode(String namespaceCode) {
129                this.namespaceCode = namespaceCode;
130        }
131
132
133}